Skip to content
This repository

A tool for automated MITM attacks on SSL connections.

branch: master
Octocat-spinner-32 certificate don't crash if certificate loading fails October 17, 2011
Octocat-spinner-32 certs Initial import. 0.7 release. April 23, 2011
Octocat-spinner-32 http http header field names are case insensitive (RFC2616, sec 4.2): adde… October 18, 2011
Octocat-spinner-32 updates Initial import. 0.7 release. April 23, 2011
Octocat-spinner-32 util Initial import. 0.7 release. April 23, 2011
Octocat-spinner-32 .gitignore Added .gitignore October 17, 2011
Octocat-spinner-32 AUTHORS Initial import. 0.7 release. April 23, 2011
Octocat-spinner-32 Bridge.hpp Initial import. 0.7 release. April 23, 2011
Octocat-spinner-32 COPYING Initial import. 0.7 release. April 23, 2011
Octocat-spinner-32 ChangeLog Initial import. 0.7 release. April 23, 2011
Octocat-spinner-32 FingerprintManager.cpp Add iOS fingerprinting mode, allow intermediate certificate specifica… July 25, 2011
Octocat-spinner-32 FingerprintManager.hpp Initial import. 0.7 release. April 23, 2011
Octocat-spinner-32 FirefoxAddonUpdater.cpp Initial import. 0.7 release. April 23, 2011
Octocat-spinner-32 FirefoxAddonUpdater.hpp Initial import. 0.7 release. April 23, 2011
Octocat-spinner-32 FirefoxUpdater.cpp Initial import. 0.7 release. April 23, 2011
Octocat-spinner-32 FirefoxUpdater.hpp Initial import. 0.7 release. April 23, 2011
Octocat-spinner-32 HTTPSBridge.cpp removed unused variable October 18, 2011
Octocat-spinner-32 HTTPSBridge.hpp Initial import. 0.7 release. April 23, 2011
Octocat-spinner-32 INSTALL Initial import. 0.7 release. April 23, 2011
Octocat-spinner-32 IPSCACLASEA1.crt Initial import. 0.7 release. April 23, 2011
Octocat-spinner-32 Logger.cpp Initial import. 0.7 release. April 23, 2011
Octocat-spinner-32 Logger.hpp Initial import. 0.7 release. April 23, 2011
Octocat-spinner-32 Makefile.am Initial import. 0.7 release. April 23, 2011
Octocat-spinner-32 NEWS Initial import. 0.7 release. April 23, 2011
Octocat-spinner-32 README updated version to 0.8 July 25, 2011
Octocat-spinner-32 RawBridge.hpp Initial import. 0.7 release. April 23, 2011
Octocat-spinner-32 SSLBridge.cpp Add iOS fingerprinting mode, allow intermediate certificate specifica… July 25, 2011
Octocat-spinner-32 SSLBridge.hpp Add iOS fingerprinting mode, allow intermediate certificate specifica… July 25, 2011
Octocat-spinner-32 SSLConnectionManager.cpp Initial import. 0.7 release. April 23, 2011
Octocat-spinner-32 SSLConnectionManager.hpp Initial import. 0.7 release. April 23, 2011
Octocat-spinner-32 SessionCache.cpp Initial import. 0.7 release. April 23, 2011
Octocat-spinner-32 SessionCache.hpp Initial import. 0.7 release. April 23, 2011
Octocat-spinner-32 UpdateManager.cpp Initial import. 0.7 release. April 23, 2011
Octocat-spinner-32 UpdateManager.hpp Initial import. 0.7 release. April 23, 2011
Octocat-spinner-32 configure.ac updated version to 0.8 July 25, 2011
Octocat-spinner-32 leafcert.pem Initial import. 0.7 release. April 23, 2011
Octocat-spinner-32 sslsniff.cpp Add iOS fingerprinting mode, allow intermediate certificate specifica… July 25, 2011
Octocat-spinner-32 sslsniff.hpp Initial import. 0.7 release. April 23, 2011
README
sslsniff v0.8
Moxie Marlinspike <moxie@thoughtcrime.org>
------------------------------------

REQUIRES: openssl, libboost1.35-dev, libboost-filesystem1.35-dev, 
          libboost-thread1.35-dev, liblog4cpp5-dev, Linux 2.4/2.6 (or BSD)

The three steps to get this running are:

    * Download and run sslsniff-0.8.tar.gz
    * Setup iptables (or pf on BSD)
    * Run arpspoof (or whatever method you'd like to use to redirect traffic).

Installing sslsniff
-------------------

    * Unpack sslsniff-0.8.tar.gz, run "./configure" and "make". (You'll have
      to make some changes to build on BSD systems, see below under "Setting up 
      pf")
    * There are two ways to run this: in "authority" mode or "targeted" mode.

    Authority Mode:

    In this mode, sslsniff acts as if it is a CA which dynamically generates
    certificates on the fly.  If you were, for instance, able to obtain a CA
    certificate somehow, you could run it in this mode and it would dynamically
    create and sign new certificates for whatever site you're trying to connect
    to.

    This mode is also useful for exploiting implementations that do not properly
    verify BasicConstraints, as any valid leaf node certificate could be used
    instead of a CA cert.

    You would run sslsniff as: 
    ./sslsniff -a -s <$listenPort> -w <$logFile> -c <$caCert>

    Targeted Mode:

    In this mode, sslsniff is given a directory full of certificates, which it 
    uses for targeted MITM attacks against the hosts those certificates are 
    signed for.  This mode is useful if you are able to forge specific 
    certificates, or if you have certificates that were obtained for the "null 
    prefix" vulnerability that I published.  There are sample null prefix 
    certificates in the "certs" directory that comes with sslsniff, but be
    sure to specify "-m IPSCACLASEA1.crt" if you wish to use those. (Note:
    the targeted certs have been removed for legal reasons, but the universal
    wildcard cert remains)

    You would run sslsniff as: 
    ./sslsniff -t -s <$listenPort> -w <$logFile> -m IPSCACLASEA1.crt \
      -c <$certDir>

    Other options:
    
    * sslsniff can be configured to only attack certain clients.  In this case, 
      you need to specify -f <ff,ie,safari,opera> -h <$httpListenPort> 
    
    * sslsniff can be configured to deny OCSP requests from clients.  In this 
      case, you need to specify -d

    * sslsniff can be configured to only log HTTP POSTS.  In this case, you 
      need to specify -p

    * sslsniff can be configured to hijack Mozilla auto-updates.  In this case, 
      you need to specify -u <$updateXmlDir>, where $updateXmlDir contains the 
      XML files for whatever binaries you want to have sslsniff auto-update, 
      one for each platform.  There are sample XML files in the "update" 
      directory that comes with sslsniff.

    * sslsniff can be configured to hijack Firefox/Thunderbird addon 
      auto-updates. In this case, you need to specify -e <url> -j <sha256sum> 
      where <url> is the URL where your custom addon is located, and <sha256sum> 
      is the sha256sum of that addon.


Setting up iptables
-------------------

    * Flip your machine into ip_forward mode 
      (echo 1 > /proc/sys/net/ipv4/ip_forward)

    * Add a rule to intercept HTTPS traffic 
      (iptables -t nat -A PREROUTING -p tcp --destination-port 443
       -j REDIRECT --to-ports <$listenPort>)

    * If you're going to do client fingerprinting, add a rule to
      intercept HTTP traffic:
      (iptables -t nat -A PREROUTING -p tcp --destination-port 80
      -j REDIRECT --to-ports <$httpListenPort>)

    * Add a rule to intercept imaps traffic:
      (iptables -t nat -A PREROUTING -p tcp --destination-port 993 \
       -j REDIRECT --to-ports <$listenPort>)

    * Add a rule to intercept pop3s traffic:
      (iptables -t nat -A PREROUTING -p tcp --destination-port 995 \
       -j REDIRECT --to-ports <$listenPort>)

    * Add a rule to intercept irc over ssl traffic:
      (iptables -t nat -A PREROUTING -p tcp --destination-port 6697 \
       -j REDIRECT --to-ports <$listenPort>)

Setting up pf
-------------

Basic support for pf is now included. Set up firewall rules similar to
those above, and change util/Destination.cpp by undefining HAVE_NETFILTER
and defining HAVE_PF at the top.


Running arpspoof
--------------------------

Assuming we want to intercept SSL traffic from 172.17.10.36, we need to 
trick that host into thinking that we're the router.  Using arpspoof, we 
can convince the target that the router's MAC address is our MAC address.

    * arpspoof -i eth0 -t 172.17.10.36 172.17.8.1

At this point, any SSL traffic should get proxied by sslsniff and logged to 
a file.

How does this work?
-------------------

First, arpspoof convinces a host that our MAC address is the router's MAC 
address, and the target begins to send us all its network traffic.  The 
kernel forwards everything along except for traffic destined to port 443, 
which it redirects to $listenPort (10000, for example).

At this point, sslsniff receives the client connection, makes a connection 
to the real SSL site, and looks at the information in its certificate.  
sslsniff then either sends a forged certificate if available 
(targeted certificate mode), or it dynamically forges a certificate and signs
it with your authoritative certificate (authority mode).

Something went wrong with that request. Please try again.