Saturday, January 2, 2016

Crafting your first IPv6 UDP packet, with a taste of scapy

This post is a attempt to show how you can use scapy to craft an IPv6 UDP packet.

To verify that this works we will first configure a host running Windows 10 to use a site local address "fec0::4/64" and our Linux host to use site local "fec0::2/64"

The image below shows our Windows 10 site local configuration

Image below shows our Linux host IPv6 site local configuration
Now that we have our two hosts configured let's verify that these can ping each other. Just so we know that connectivity works with normal communication let's "ping6" host "fec0::4" from host "fec0::2".

Image below shows the ping has been successful

Looks like we are good to go!

Moving along!!

Let's craft a UDP packet. We will use TCP source port 9002 and destination port 123.

Let's first build our IPv6 layer. However, before we move ahead, let's see what fields we have available to us for the IPv6 header in scapy.

Now that we know our fields, let's build our IPv6 header out by specifying a spoofed source of "fec0::0a", our destination "fec0::04" and a "nh" or next header field of "17" which represents UDP.

Let's now build our UDP header. Nothing special here, this is your typical UDP header.

Let's finally add some data just to make it interesting. We will just create a variable named "data" and add some text.

Now that we have it all, let's put it together and send our packet along it's merry way! On the target host we will also be running Wireshark to ensure the packet is received on the Windows 10 system.

From above, we see 1 packet was sent. Let's see what the Windows 10 host received.

Awesome! It looks like we've successfully crafted and sent an IPv6 UDP packet along its merry way.

See this post for crafting your first IPv6 TCP packet and this for your first ICMPv6 packet.

No comments:

Post a Comment