HTTP/1: Transfer-Encoding parser accepts empty list elements and trailing commas

Open Beginner friendly
#740 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
75/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
c

Research direction

Start with src/net/http/http.c at http_validate_transfer_encoding() around lines 4567–4605, then inspect the public parser path shown by the reproduction. Reject empty coding tokens and malformed comma-separated lists with HTTP 400 before dispatch. Done means the listed malformed inputs fail validation while valid transfer-encoding lists continue to parse.

Written by the indexing model from the issue text.

Description

bug

Confirmed on dev at fd8cf045770459ebc0f6b6740f54dcd30a80ce6c.

http_validate_transfer_encoding() skips empty comma-separated elements instead of rejecting them. Inputs such as Transfer-Encoding: chunked,, ,chunked, and chunked,,chunked can therefore pass as valid chunked requests even though the list grammar is malformed.

Source: https://github.com/c4punks/CWIST/blob/fd8cf045770459ebc0f6b6740f54dcd30a80ce6c/src/net/http/http.c#L4567-L4605

A public-parser repro returned success for:

POST / HTTP/1.1
Host: example
Transfer-Encoding: chunked,

0

trailing_te_comma=1

Frontends and proxies that reject or normalize these inputs differently can disagree with CWIST about request framing, creating a request-smuggling risk. Require nonempty coding tokens and reject malformed lists with HTTP 400 before dispatch.

Dominant language
C
Stars
16
Forks
7
Avg merge
4h 54m
Merged PRs (30d)
185

Getting set up

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.

More from c4punks/CWIST

All issues in c4punks/CWIST

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.