This post is a quick attempt to show how you can use scapy to craft an IPv6 TCP 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!
Let's craft a TCP packet. We will use TCP source port 9001 and destination port 445.
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::09", our destination "fec0::04" and a "nh" or next header field of "6" which represents TCP.
Let's now build our TCP header. Nothing special here, this is your typical TCP 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.
Putting together our packet and sending it along its way.
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 TCP packet along its merry way.
See this post for crafting your first IPv6 UDP packet and this for your first ICMPv6 packet.