netty / netty/netty

http2: headers validation is non-exhaustive, allows requests with completely empty headers

Open
#10,633 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
35.1k
Forks
16.3k
Avg merge
1d 5h
Merged PRs (30d)
143

Description

Expected behavior

If netty's http2 headers validation is enabled, headers are validated exhaustively as described in spec.

Actual behavior

Only tiny subset from 8.1.2 is accounted.

Looking at HpackDecoder one may assume that at least pseudo-headers are checked, but in reality netty's http2 server handler accepts requests without any pseudo-headers - which are invalid, and should be rejected.

In fact netty's http2 server handler accepts requests without any headers at all.

http2 spec enumerates allowed headers and pseudo-headers in context of potential vulnerabilities,

Note that these requirements are intended to protect against several types of common attacks against HTTP; 
they are deliberately strict because being permissive can expose  implementations to these vulnerabilities

I dont know if these are applied to netty due to extra lax headers checks, but I think they must be stricter so library clients
do not have to apply protocol checks in application code just to avoid NPEs on Http2Headers path(), scheme(), method() etc

Steps to reproduce
Minimal yet complete reproducer code (or URL to code)
Netty version

4.1.52

JVM version (e.g. java -version)
OS version (e.g. uname -a)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the validation path in codec-http2/src/main/java/io/netty/handler/codec/http2/HpackDecoder.java and the HTTP/2 server handler, then compare their behavior with RFC 7540 section 8.1.2. Verify how requests with missing pseudo-headers or no headers are handled; done means invalid requests are rejected when headers validation is enabled.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.