Closed ad-m closed 3 years ago
Yes - this looks like a valid bug!
How long does your fuzzing currently run? If you find multiple such errors I would prefer grouping everything into a single GitHub issue, but if you have a fuzzing strategy based on different frame types or other structured input data, I'd also be happy to see new issues per group et al.
How long does your fuzzing currently run?
A few seconds.
If you find multiple such errors I would prefer grouping everything into a single GitHub issue, but if you have a fuzzing strategy based on different frame types or other structured input data, I'd also be happy to see new issues per group et al.
I don't have multiple fuzzing strategy yet and does not use complex structures as input data.
This is a completely new world for me. h2
is the first project to integrate. I also have no deep knowledge of HTTP / 2. However, I want to take the time to get to know the topic and support this library. I would like setup eg. CIFuzz to verify regression ( https://google.github.io/oss-fuzz/getting-started/continuous-integration/ ) and os-fuzz
for continous integration. os-fuzz
use seperate issue tracker (see https://google.github.io/oss-fuzz/architecture/ ).
Quick analysis of the payload you found:
The last two bytes don't matter for this IndexError.
It correctly reads a HEADER frame:
HeadersFrame(stream_id=1862271040, flags=['END_HEADERS', 'END_STREAM']): exclusive=False, depends_on=0, stream_weight=0, data=<hex:0000050000000004>
The hpack blob is 0000050000000004
in hex.
I'm not sure if we should consider this a bug in h2 (obviously out-of-bounds reading of an empty headers name), or a decoding error in hpack.
@sethmlarson are empty header names even valid in hpack?
@Kriechi So I couldn't follow a trail from RFC 7540 to RFC 7231 to RFC 7230 but in spirit we know that "HTTP semantics" (RFC 7231) is a high-level capture of the semantics defined in "HTTP/1.1" (RFC 7230) so... yeah, this is the best I've got:
From RFC 7230 Section 3.2:
header-field = field-name ":" OWS field-value OWS field-name = token
and in the collected ABNF appendix:
token = 1*tchar
so as expected the header name/field should be 1 or more characters so I wouldn't expect an empty name to be valid for HPACK.
@sethmlarson I agree on the semantic reasoning. Curiously though, our hpack implementation AND the golang implementation AND a popular ruby gem all happily decode this payload into a header with empty name.
So right now, I'm leaning towards catching this in h2 by simply filtering out these invalid headers without throwing an error. It seems to be valid hpack. Valid hpack payload means it is a valid HEADERS frame. Valid HEADERS frame means it should be a valid request/response.
Any better ideas?
Hello,
I am working on integrating fuzzer to project
h2
. My goal is to include it in theoss-fuzz
project. I believe that this can be a valuable contribution to the library, the importance of which is becoming more and more higher, among others due to the use byhttpx
- the library which popularity also growing.I identified the first problems and I would like to know if such problems are interesting for your project and your are interested to handle them.