Summary
HTTP Request Smuggling in hyper
hyper's HTTP server code had a flaw that incorrectly understands some requests with multiple transfer-encoding headers to have a chunked payload, when it should have been rejected as illegal. This combined with an upstream HTTP proxy that understands the request payload boundary differently can result in "request smuggling" or "desync attacks".
Vulnerability
The flaw was introduced in https://github.com/hyperium/hyper/commit/26417fc24a7d05df538e0f39239b373c5c3d61f6, released in v0.12.0.
Consider this example request:
POST /yolo HTTP/1.1
Transfer-Encoding: chunked
Transfer-Encoding: cow
This request should be rejected, according to RFC 7230, since it has a Transfer-Encoding header, but after folding, it does not end in chunked. hyper would notice the chunked in the first line, and then check the second line, and thanks to a missing boolean assignment, not set the error condition. hyper would treat the payload as being chunked. By differing from the spec, it is possible to send requests like these to endpoints that have different HTTP implementations, with different interpretations of the payload semantics, and cause "desync attacks".
There are several parts of the spec that must also be checked, and hyper correctly handles all of those. Additionally, hyper's client does not allow sending requests with improper headers, so the misunderstanding cannot be propagated further.
Read more about desync attacks: https://portswigger.net/research/http-desync-attacks-request-smuggling-reborn
Workarounds
Besides upgrading hyper, you can take the following options:
- Reject requests that contain a
transfer-encodingheader. - Ensure any upstream proxy handles
transfer-encodingcorrectly.
Credits
This issue was initially reported by ZeddYu Lu From Qi An Xin Technology Research Institute.
Impact
To determine if vulnerable, all these things must be true:
- Using hyper as an HTTP server. The client is not affected.
- Using HTTP/1.1. HTTP/2 does not use
transfer-encoding. - Using a vulnerable HTTP proxy upstream to hyper. If an upstream proxy correctly rejects the illegal transfer-encoding headers, the desync attack cannot succeed. If there is no proxy upstream of hyper, hyper cannot start the desync attack, as the client will repair the headers before forwarding.
CVE-2021-21299 has a CVSS score of 4.8 (Medium). The vector is network-reachable, no privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (0.14.3, 0.13.10, 0.12.36); upgrading removes the vulnerable code path.
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Already deployed Kodem?
See it in your environmentNew to Kodem? Get a demo →Remediation advice
We have released and backported the following patch versions:
- v0.14.3
- v0.13.10
Frequently Asked Questions
- What is CVE-2021-21299? CVE-2021-21299 is a medium-severity security vulnerability in hyper (rust), affecting versions >= 0.14.0, < 0.14.3. It is fixed in 0.14.3, 0.13.10, 0.12.36.
- How severe is CVE-2021-21299? CVE-2021-21299 has a CVSS score of 4.8 (Medium). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
- Which versions of hyper are affected by CVE-2021-21299? hyper (rust) versions >= 0.14.0, < 0.14.3 is affected.
- Is there a fix for CVE-2021-21299? Yes. CVE-2021-21299 is fixed in 0.14.3, 0.13.10, 0.12.36. Upgrade to this version or later.
- Is CVE-2021-21299 exploitable, and should I be worried? Whether CVE-2021-21299 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether CVE-2021-21299 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix CVE-2021-21299?
- Upgrade
hyperto 0.14.3 or later - Upgrade
hyperto 0.13.10 or later - Upgrade
hyperto 0.12.36 or later
- Upgrade