简体   繁体   中英

Scapy unable to fragment IPv6 packet

I am currently working on a project regarding IPv6 security. I'm trying to replicate the results found in this document found here: https://www.tno.nl/downloads/testing_the_security_of_IPv6_implementations.pdf

Scroll down to section 4.4, page 29.

I want to test whether creating packets with unlimited extension headers will in fact be able to crash a system. The problem I run in to again and again is that when running the script based on the documentation I keep getting the error:

File "/usr/lib/python2.7/dist-packages/scapy/packet.py", line 787, in fragment
   return Scapy_Exception("cannot fragment this packet")
scapy.error.Scapy_Exception: cannot fragment this packet

And I need the packets to be fragmented. Otherwise I will not be able to create this endless stream of extension headers. I am testing this on a Debian 7 Wheezy system and using Python 2.7.

Here is the script I'm running:

from scapy.all import *

packet = IPv6(src="scrIP",dst="dstIP")
for x in range (0,100):
    packet = packet/IPv6ExtHdrDestOpt()/IPv6ExtHdrRouting()/IPv6ExtHdrHopByHop()

    send(packet)

I have been searching around but I cannot find anything with the same error. I hope someone can help.

You should check the version of scapy. The code work on my system (Ubuntu 14.04, scapy 2.2.0). Also try to run the code in the scapy shell as root:

$ sudo scapy 
Welcome to Scapy (2.2.0)
>>> p = IPv6(src='::1', dst='::1')
>>> for x in range(100): p = p/IPv6ExtHdrDestOpt()/IPv6ExtHdrRouting()/IPv6ExtHdrHopByHop()
... 
>>> send(p)
.
Sent 1 packets.

And of cause you have to replace scrIP and dstIP with real IPv6 adresses as strings.

There is something called scapy6:

http://www.secdev.org/conf/scapy-IPv6_HITB06.pdf

Try taking a look at page 128 and forward to see if you can get it to work, it should support IPv6.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM