-
Notifications
You must be signed in to change notification settings - Fork 293
h2: guard PADDED frames with zero-length payload #146
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
Conversation
|
The data is in a NIL-terminated string, so reading a 0-byte is 0. Do you have a tool which indicates this an OOB-read outside the buffer? The read should not be outside the buffer and is not an OOB-read. However, yes, the code is reading a byte when the remaining length in the frame is 0, even if the buffer has an extra |
|
I think this would be a simpler equivalent to your suggested patch: |
|
right; yeah, out-of-frame, not out-of-buffer. |
|
Thank you for the analysis and for putting together the PR. I am curious: did you use a tool which flagged this code for further review? Reviewing the code, I see that it has deterministic behavior reading the nil-terminated-string. The code tests the length after reading the padding byte in order to make a single check rather than two checks, knowing that the padding byte read is deterministic and valid even if 1 byte out of the frame (where |
Signed-off-by: Joshua Rogers <MegaManSec@users.noreply.github.com>
|
Done!
Yes; I'm using ZeroPath at the moment on some interesting (for me) codebases. Basically, it's an AI-powered vulnerability/bug scanner. For example in curl, I've reported (+ submitted patches) over 200 valid bugs (see this post or this article or this digest or this blog post). If you're interested, I could send you the raw results from the scan against lighttpd1.4? |
Yes, please. I am interested. |
Fix OOB read in h2_recv_data() and h2_recv_headers() when PADDED is set but frame length is 0: we now require ≥1 payload byte before reading the Pad Length octet. Sends GOAWAY/PROTOCOL_ERROR instead of touching OOB.