CVE-2025-59822: Http4s vulnerable to HTTP Request Smuggling due to improper handling of HTTP trailer section
N/A
Basic Information
Technical Details
| Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
|---|---|---|---|
| org.http4s:http4s-ember-core_2.12 | maven | < 0.23.31 | 0.23.31 |
| org.http4s:http4s-ember-core_2.13 | maven | < 0.23.31 | 0.23.31 |
| org.http4s:http4s-ember-core_3 | maven | < 0.23.31 | 0.23.31 |
| org.http4s:http4s-ember-core_2.13 | maven | >= 1.0.0-M1, < 1.0.0-M45 | 1.0.0-M45 |
| org.http4s:http4s-ember-core_3 | maven | >= 1.0.0-M1, < 1.0.0-M45 | 1.0.0-M45 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability is a classic HTTP Request Smuggling issue (CWE-444) within the http4s library, specifically in the ember-core module. The root cause lies in the incorrect parsing of HTTP trailer headers.
The core of the vulnerability is in the org.http4s.ember.core.Parser.HeaderP.parse function. The original implementation had flawed logic that would incorrectly identify the end of the headers. When parsing a header line that was missing the expected colon (:), the parser would not raise an error but would instead continue until it found a single carriage return/line feed (CRLF). It would then incorrectly terminate the header parsing process. This allowed an attacker to craft a chunked HTTP request where the trailer section contained a malformed header followed by a complete, second HTTP request. The server would parse up to the malformed trailer, stop, and then process the remaining data in the buffer as a new, smuggled request.
The exploitation is initiated when the application processes a chunked request with trailers. The function org.http4s.ember.core.ChunkedEncoding.parseTrailers is responsible for this, and it directly invokes the vulnerable parse method. Therefore, both functions are critical runtime indicators of this vulnerability being triggered.
The patch addresses the vulnerability by introducing stricter validation within the parse function. It now explicitly checks for and rejects invalid characters (like whitespace) in a header field name, throwing a ParseHeadersError. This prevents the parser from being tricked into prematurely ending the header section, thus mitigating the request smuggling vulnerability.
Vulnerable functions
org.http4s.ember.core.Parser.HeaderP.parseember-core/shared/src/main/scala/org/http4s/ember/core/Parser.scala
org.http4s.ember.core.ChunkedEncoding.parseTrailersember-core/shared/src/main/scala/org/http4s/ember/core/ChunkedEncoding.scala