Showing posts with label network spoofing. Show all posts
Showing posts with label network spoofing. Show all posts

Friday, February 17, 2012

hexinject

Privilege Escalation -> Spoofing Attacks -> Network Spoofing -> hexinject

hexinject is capable to inject any packet to the network, which we construct on our own in hex. The tool doesn't do any verification, so it will send even a sentence like 'jaj de finom ez a leves' (this soup is really tasty - in Hungarian). Thus if we screw up the various protocols' structure another software won't be able to understand it. It has a sniffing mode, where we can listen to the network traffic. It's quite hard to use on its own, but using pipes or scripts it can be really useful.

Examples:

hexinject -s -i eth0 -> sniffing eth0 interface


hexinject -s -i eth0 -r -> output in raw format

hexinject -s -i eth0 -r | strings -> using strings


hexinject -s -i eth0 -r | strings | Host -> filtering on hosts 


echo 'Jaj de finom ez a leves' | hexinject -p -i eth0 -r -> sending a custom string to the network


This will create a packet like this:


The possibilities are unlimited, it's worth to read the documentation and other examples on its webpage:

Thursday, February 16, 2012

yersinia

Privilege Escalation -> Spoofing Attacks -> Network Spoofing -> yersinia

yersinia is a vulnerability testing tool for LAN protocols (cdp, dhcp, dot1q, dot1x, dtp, hsrp, isl, stp, vtp). For example, we can do:
- CDP flooding
- Trunk port creation with DTP (dynamic trunking protocol)
- VLAN creation / removal with VTP
- Creating fake Spanning Tree root device
etc...

It has 2 main modes: command line and GUI based, for using the first one, we need to dig a lot in its manual in order to do something, and the graphical interface is said to be only in beta. In reality both modes has a few bugs. Unfortunately I can't do examples, cause I don't have a switch to test with.

Starting GUI mode:

yersinia -G


We can start an attack at the "launch attack" menu, and stop in the "list attacks" menu.

Protection for the various protocols:

cdp - enable only where needed
dhcp - dhcp snooping
dot1q - configure static access ports towards the hosts
dot1x - use certificate authentication
dtp - turn it off, and use static trunk / access ports
hsrp - use authentication
isl - see dot1q
stp - use spanning tree protection features like BPDU guard, root guard, etc...
vtp - use authentication, or don't use vtp at all

Wednesday, February 15, 2012

ettercap + example: DNS spoofing

ettercap is a tool for doing LAN based MitM attacks, which based on ARP spoofing. After it succeeded to step in the traffic flow path, we can do several things with it, for example:
- data modification
- extracting passwords
All of these are accomplished by plug ins.

In order to get ARP spoofing work properly we need to turn on IP forwarding:

echo 1 > /proc/sys/net/ipv4/ip_forward

Ettercap is already installed in the 64bit version, in the 32 bit version we need to install it:

apt-get install ettercap

We can use the tool in 3 modes: text, cursor, graphical:
ettercap -T
ettercap -C
ettercap -G

I will use the graphical.


Once started, choose the Sniff -> unified sniffing menu, and make a device discovery, which will send an ARP message to all IPs in the subnet. We can load the devices from a file.


Then add the two devices, which you want to sniff to the target list. I used the default gateway and my laptops IP here.


Then load the plugin you want to use.


With choosing MiTM -> Arp spoofingot we can perform the attack, and now we are in the traffic's path between the two machines. At the Start -> Start sniffing menu we can actually activate the attack. For the DNS spoofing we can set the fake domain - IP pairs in the following config file:

/usr/share/ettercap/ether.dns

If all goes well, we can redirect the computer's traffic to a custom target:

The ettercap log:


Stopping can be done in the Mitm -> Stop mitm attack menu.

Protection:

1. Basically we need to protect against ARP spoofing, which is the same what I described at the arpspoof tool.
2. Don't use DNS - this can be realistic in some cases
3. Use IDS / IPS on the LAN - this is not so common, and not too effective against such attacks like this
4. Use DNSSEC - DNS signed with a certificate, this one also not widely used

Monday, February 13, 2012

arpspoof

We can start the tool simple from the terminal. I don't want to go into the details how arpspoof works, there are tons of writing about that on the Internet. In short, we can become a man in the middle between two hosts on a LAN, with overwriting their ARP table with a false entry, which points to us, instead of the real address - this can be done with ARP.

Before we start it, we need to tun on IP forwarfing on Linux:

root@bt:~# echo 1 > /proc/sys/net/ipv4/ip_forward

Usage:

arpspoof [-i interface] [-t target] host
where
target - the hosts, whos traffic we want to sniff
host - The host we want to personate

Thus we need to run this from two windows, because running it for a single host we will see only one part of the traffic. We need to personate two hosts.

Example:

root@bt:~# arpspoof -i eth1 -t 192.168.1.2 192.168.1.18
root@bt:~# arpspoof -i eth1 -t 192.168.1.18 192.168.1.2



after that we can see the traffic in Wireshark:


The tool is part of the dsniff package, which is available here:


Protection:

Most modern switches already have a service, which tracks what MAC address is used on a port, and it allows only valid ARP traffic, which means that only those ARP packets will be allowed, which contains the MAC address of the host on that port. Cisco and Juniper calls it "Dynamic Arp Inspection (DAI)". More information: