Skip to content

Refuse Transfer-Encoding in HTTP/1.0 messages - #91

Merged
MDA2AV merged 1 commit into
mainfrom
http10-transfer-encoding
Nov 13, 2026
Merged

MDA2AV merged 1 commit into
mainfrom
http10-transfer-encoding

Conversation

@MDA2AV

@MDA2AV MDA2AV commented Nov 13, 2026

Copy link
Copy Markdown
Member

Fixes #90

Why

RFC 9112 §6.1: "A server or client that receives an HTTP/1.0 message containing a Transfer-Encoding header field MUST treat the message as if the framing is faulty, even if a Content-Length is present, and close the connection after processing the message."

Both hardened parsers checked Transfer-Encoding against Content-Length and against any value but chunked, never against the version. So POST / HTTP/1.0 or HTTP/1.0 200 with Transfer-Encoding: chunked parsed, and BodyFramingDetector framed it as chunked. HTTP/1.0 has no transfer codings, so a hop that speaks only 1.0 frames such a body another way, and what it leaves on the connection is read as the next message.

What changes

  • UltraHardenedParser.FullHeader.ROM.cs and UltraHardenedParser.FullResponse.ROM.cs: after the TE + CL check, Transfer-Encoding in an HTTP/1.0 message throws Transfer-Encoding in an HTTP/1.0 message. (400). The version is the one the start line already validated, so this is one byte compare, made only when Transfer-Encoding is present.
  • SECURITY.md: a "Transfer-Encoding in HTTP/1.0" entry under Request Smuggling.

Decisions worth reviewing

  • Refuse. For a request, faulty framing is a 400 and a closed connection, which is what a server already does with an HttpParseException. For a response, refusing is all a client can safely do with a message whose end it can't know.
  • In the parsers, not in BodyFramingDetector. The detector frames what it is given, and FlexibleParser input is trusted by contract (SECURITY.md). The rule sits with the other smuggling checks, so every UltraHardenedParser caller gets it.
  • Any Transfer-Encoding. The RFC names the field, not a value; since the parser already refuses every value but chunked, in practice it is chunked.

Downstream

MDA2AV/ioxide#565 checks this in ioxide's HTTP client for now. Once a release carries this, that can become a version bump.

Tests

  • UltraHardenedParser.Semantics.cs: an HTTP/1.0 request with Transfer-Encoding: chunked throws 400; with Content-Length it parses. ROM and multi-segment.
  • UltraHardenedParser.Response.cs: an HTTP/1.0 200 and an HTTP/1.0 304 with Transfer-Encoding: chunked throw; a 200 with Content-Length parses.
  • Without the fix the five refusal cases fail and the four controls pass.
  • dotnet test -f net10.0: 1134 passed (1125 before), 0 failed. dotnet build src/Glyph11.sln builds with no new warnings. net8.0 and net9.0 aren't installed on this machine; CI runs them.

RFC 9112 §6.1: a recipient of an HTTP/1.0 message with Transfer-Encoding
MUST treat its framing as faulty, even with a Content-Length, and close
the connection after it. Both hardened parsers checked Transfer-Encoding
against Content-Length and against any value but chunked, never against
the version, so an HTTP/1.0 request or response with
Transfer-Encoding: chunked parsed and was framed as chunked. HTTP/1.0 has
no transfer codings, so a hop that speaks only 1.0 frames such a body
another way.

Both now refuse it beside the TE + CL check, as 400 for a request.

Fixes #90
@MDA2AV
MDA2AV merged commit 5c5f7c3 into main Nov 13, 2026
1 of 2 checks passed
@MDA2AV MDA2AV mentioned this pull request Nov 13, 2026
MDA2AV added a commit to MDA2AV/ioxide that referenced this pull request Nov 13, 2026
… faulty framing, and its connection closed, rather than read as chunked

RFC 9112 6.1: a client that receives an HTTP/1.0 message with a
Transfer-Encoding MUST treat its framing as faulty and close the
connection after it. The client takes its framing from Glyph11, which had
no such rule. Glyph11 0.4.1 refuses the message in its hardened parsers
(dotnet-web-stack/Glyph11#91), and the client turns that into a failed
request on a discarded connection, as it does any malformed head.

The client moves from Glyph11 0.3.7 to 0.4.1, onto TryParseResponseHeader:
TryExtractFullResponseHeaderROM is obsolete since 0.4.0, and the new entry
point reports the header block's true length, so the + 1 goes. Glyph11's
other response fixes since 0.3.7 come with it, among them a bare-LF head
refused at once rather than waited on (Glyph11#85), status codes above 599
refused (Glyph11#80), and Content-Length lists and oversized values framed
by their length (Glyph11#74, Glyph11#75, Glyph11#77).

HttpClientHttp10Tests: the issue's test, a 304, and a keep-alive response
whose connection must not be reused, beside the Content-Length control.
On Glyph11 0.4.0 the three refusals fail; on 0.4.1 they pass.
MDA2AV added a commit to MDA2AV/ioxide that referenced this pull request Nov 14, 2026
… faulty framing, and its connection closed, rather than read as chunked (#565)

RFC 9112 6.1: a client that receives an HTTP/1.0 message with a
Transfer-Encoding MUST treat its framing as faulty and close the
connection after it. The client takes its framing from Glyph11, which had
no such rule. Glyph11 0.4.1 refuses the message in its hardened parsers
(dotnet-web-stack/Glyph11#91), and the client turns that into a failed
request on a discarded connection, as it does any malformed head.

The client moves from Glyph11 0.3.7 to 0.4.1, onto TryParseResponseHeader:
TryExtractFullResponseHeaderROM is obsolete since 0.4.0, and the new entry
point reports the header block's true length, so the + 1 goes. Glyph11's
other response fixes since 0.3.7 come with it, among them a bare-LF head
refused at once rather than waited on (Glyph11#85), status codes above 599
refused (Glyph11#80), and Content-Length lists and oversized values framed
by their length (Glyph11#74, Glyph11#75, Glyph11#77).

HttpClientHttp10Tests: the issue's test, a 304, and a keep-alive response
whose connection must not be reused, beside the Content-Length control.
On Glyph11 0.4.0 the three refusals fail; on 0.4.1 they pass.
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

Successfully merging this pull request may close these issues.

An HTTP/1.0 message with Transfer-Encoding parses, and is framed as chunked

1 participant