README 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. sslsniff v0.8
  2. Moxie Marlinspike <moxie@thoughtcrime.org>
  3. ------------------------------------
  4. REQUIRES: openssl, libboost1.35-dev, libboost-filesystem1.35-dev,
  5. libboost-thread1.35-dev, liblog4cpp5-dev, Linux 2.4/2.6 (or BSD)
  6. The three steps to get this running are:
  7. * Download and run sslsniff-0.8.tar.gz
  8. * Setup iptables (or pf on BSD)
  9. * Run arpspoof (or whatever method you'd like to use to redirect traffic).
  10. Installing sslsniff
  11. -------------------
  12. * Unpack sslsniff-0.8.tar.gz, run "./configure" and "make". (You'll have
  13. to make some changes to build on BSD systems, see below under "Setting up
  14. pf")
  15. * There are two ways to run this: in "authority" mode or "targeted" mode.
  16. Authority Mode:
  17. In this mode, sslsniff acts as if it is a CA which dynamically generates
  18. certificates on the fly. If you were, for instance, able to obtain a CA
  19. certificate somehow, you could run it in this mode and it would dynamically
  20. create and sign new certificates for whatever site you're trying to connect
  21. to.
  22. This mode is also useful for exploiting implementations that do not properly
  23. verify BasicConstraints, as any valid leaf node certificate could be used
  24. instead of a CA cert.
  25. You would run sslsniff as:
  26. ./sslsniff -a -s <$listenPort> -w <$logFile> -c <$caCert>
  27. Targeted Mode:
  28. In this mode, sslsniff is given a directory full of certificates, which it
  29. uses for targeted MITM attacks against the hosts those certificates are
  30. signed for. This mode is useful if you are able to forge specific
  31. certificates, or if you have certificates that were obtained for the "null
  32. prefix" vulnerability that I published. There are sample null prefix
  33. certificates in the "certs" directory that comes with sslsniff, but be
  34. sure to specify "-m IPSCACLASEA1.crt" if you wish to use those. (Note:
  35. the targeted certs have been removed for legal reasons, but the universal
  36. wildcard cert remains)
  37. You would run sslsniff as:
  38. ./sslsniff -t -s <$listenPort> -w <$logFile> -m IPSCACLASEA1.crt \
  39. -c <$certDir>
  40. Other options:
  41. * sslsniff can be configured to only attack certain clients. In this case,
  42. you need to specify -f <ff,ie,safari,opera> -h <$httpListenPort>
  43. * sslsniff can be configured to deny OCSP requests from clients. In this
  44. case, you need to specify -d
  45. * sslsniff can be configured to only log HTTP POSTS. In this case, you
  46. need to specify -p
  47. * sslsniff can be configured to hijack Mozilla auto-updates. In this case,
  48. you need to specify -u <$updateXmlDir>, where $updateXmlDir contains the
  49. XML files for whatever binaries you want to have sslsniff auto-update,
  50. one for each platform. There are sample XML files in the "update"
  51. directory that comes with sslsniff.
  52. * sslsniff can be configured to hijack Firefox/Thunderbird addon
  53. auto-updates. In this case, you need to specify -e <url> -j <sha256sum>
  54. where <url> is the URL where your custom addon is located, and <sha256sum>
  55. is the sha256sum of that addon.
  56. Setting up iptables
  57. -------------------
  58. * Flip your machine into ip_forward mode
  59. (echo 1 > /proc/sys/net/ipv4/ip_forward)
  60. * Add a rule to intercept HTTPS traffic
  61. (iptables -t nat -A PREROUTING -p tcp --destination-port 443
  62. -j REDIRECT --to-ports <$listenPort>)
  63. * If you're going to do client fingerprinting, add a rule to
  64. intercept HTTP traffic:
  65. (iptables -t nat -A PREROUTING -p tcp --destination-port 80
  66. -j REDIRECT --to-ports <$httpListenPort>)
  67. * Add a rule to intercept imaps traffic:
  68. (iptables -t nat -A PREROUTING -p tcp --destination-port 993 \
  69. -j REDIRECT --to-ports <$listenPort>)
  70. * Add a rule to intercept pop3s traffic:
  71. (iptables -t nat -A PREROUTING -p tcp --destination-port 995 \
  72. -j REDIRECT --to-ports <$listenPort>)
  73. * Add a rule to intercept irc over ssl traffic:
  74. (iptables -t nat -A PREROUTING -p tcp --destination-port 6697 \
  75. -j REDIRECT --to-ports <$listenPort>)
  76. Setting up pf
  77. -------------
  78. Basic support for pf is now included. Set up firewall rules similar to
  79. those above, and change util/Destination.cpp by undefining HAVE_NETFILTER
  80. and defining HAVE_PF at the top.
  81. Running arpspoof
  82. --------------------------
  83. Assuming we want to intercept SSL traffic from 172.17.10.36, we need to
  84. trick that host into thinking that we're the router. Using arpspoof, we
  85. can convince the target that the router's MAC address is our MAC address.
  86. * arpspoof -i eth0 -t 172.17.10.36 172.17.8.1
  87. At this point, any SSL traffic should get proxied by sslsniff and logged to
  88. a file.
  89. How does this work?
  90. -------------------
  91. First, arpspoof convinces a host that our MAC address is the router's MAC
  92. address, and the target begins to send us all its network traffic. The
  93. kernel forwards everything along except for traffic destined to port 443,
  94. which it redirects to $listenPort (10000, for example).
  95. At this point, sslsniff receives the client connection, makes a connection
  96. to the real SSL site, and looks at the information in its certificate.
  97. sslsniff then either sends a forged certificate if available
  98. (targeted certificate mode), or it dynamically forges a certificate and signs
  99. it with your authoritative certificate (authority mode).