CVE-2021-32714: Hyper Integer Overflow Vulnerability
MODERATECVE-2021-32714 is a MODERATE (CVSS 5.9) integer overflow vulnerability (CWE-190: Integer Overflow or Wraparound) affecting Hyper libraries in the crates.io ecosystem. The issue involves integer overflow in chunked transfer-encoding. Remediation is available by upgrading affected packages to version 0.14.10.
CVE-2021-32714 at a Glance
Security Impact
CVSS: 5.9
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H).
How to Fix CVE-2021-32714
To remediate this vulnerability, upgrade all affected Hyper dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade hyper to 0.14.10
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for hyper
How to Check if You Are Affected
To determine whether your application is affected by CVE-2021-32714, inspect your project dependencies for Hyper:
inspect dependencies for hyper
Analyze the terminal output to locate any version of Hyper in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.14.10), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-190: Integer Overflow or Wraparound, where the product performs a calculation that can produce an integer overflow or wraparound when the logic assumes that the resulting value will always be larger than the original value. this occurs when an integer value is incremented to a value that is too large to store in the associated representation. when this occurs, the value may become a very small or negative number. In Hyper, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2021-32714 Affected Hyper Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
hyper
|
crates.io |
< 0.14.10
|
0.14.10
|
References
Frequently Asked Questions
What is CVE-2021-32714?
Which Hyper versions are affected?
What version fixes CVE-2021-32714?
Is hyper affected?
What is the CVSS score of CVE-2021-32714?
What CWE is associated with CVE-2021-32714?
How can I check crates.io dependencies for CVE-2021-32714?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-5h46-h7hh-c6x9",
"modified" : "2021-09-07T21:47:36Z",
"published" : "2021-07-12T16:55:37Z",
"aliases" : [ "CVE-2021-32714" ],
"summary" : "Integer Overflow in Chunked Transfer-Encoding",
"details" : "### Summary\n\nhyper's HTTP server and client code had a flaw that could trigger an integer overflow when decoding chunk sizes that are too big. This allows possible data loss, or if combined with an upstream HTTP proxy that allows chunk sizes larger than hyper does, can result in \"request smuggling\" or \"desync attacks\".\n\n### Vulnerability\n\nExample:\n\n```\nGET / HTTP/1.1\nHost: example.com\nTransfer-Encoding: chunked\n\nf0000000000000003\nabc\n0\n\n```\n\nhyper only reads the rightmost 64-bit integer as the chunk size. So it reads `f0000000000000003` as `3`. A loss of data can occur since hyper would then read only 3 bytes of the body. Additionally, an HTTP request smuggling vulnerability would occur if using a proxy which instead has prefix truncation in the chunk size, or that understands larger than 64-bit chunk sizes.\n\nRead more about desync attacks: https://portswigger.net/research/http-desync-attacks-request-smuggling-reborn\n\n### Impact\n\nTo determine if vulnerable to _data loss_, these things must be true:\n\n- **Using HTTP/1.1.** Since HTTP/2 does not use chunked encoding, it is not vulnerable.\n- **Using hyper as a server or client.** The body would be improperly truncated in either case.\n- **Users send requests or responses with chunk sizes greater than 18 exabytes**.\n\nTo determine if vulnerable to _desync attacks_, these things must be true:\n\n- **Using an upstream proxy that allows chunks sizes larger than 64-bit.** If the proxy rejects chunk sizes that are too large, that request won't be forwarded to hyper.\n\n### Patches\n\nWe have released the following patch versions:\n\n - v0.14.10 (to be released when this advisory is published)\n\n### Workarounds\n\nBesides upgrading hyper, you can take the following options:\n\n- Reject requests manually that contain a `Transfer-Encoding` header.\n- Ensure any upstream proxy rejects `Transfer-Encoding` chunk sizes greater than what fits in 64-bit unsigned integers.\n\n\n### Credits\nThis issue was initially reported by [Mattias Grenfeldt](https://grenfeldt.dev/) and Asta Olofsson.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "crates.io",
"name" : "hyper"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.14.10"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/hyperium/hyper/security/advisories/GHSA-5h46-h7hh-c6x9"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-32714"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/hyperium/hyper"
}, {
"type" : "WEB",
"url" : "https://rustsec.org/advisories/RUSTSEC-2021-0079.html"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-190" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2021-07-07T20:05:15Z",
"nvd_published_at" : "2021-07-07T20:15:00Z"
}
}