RUSTSEC-2021-0067 CVE-2021-32629 GHSA-hpqh-2wqx-7qp5 PYSEC-2021-87
Memory access due to code generation flaw in Cranelift module
- Severity
- 8.8 / 10
- High · CVSS 3.1
- Exploit chance (EPSS)
- 0.46%
- Chance of exploitation in the next 30 days. Higher than 39.47% of scored vulnerabilities.
- Known exploited
- No
- Not in CISA's catalog
- Fix
- Available
- 2 packages have a fixed version
Description
There is a bug in 0.73.0 of the Cranelift x64 backend that can create a scenario that could result in a potential sandbox escape in a WebAssembly module. Users of versions 0.73.0 of Cranelift should upgrade to either 0.73.1 or 0.74 to remediate this vulnerability. Users of Cranelift prior to 0.73.0 should update to 0.73.1 or 0.74 if they were not using the old default backend.
More details can be found in the GitHub Security Advisory at:
https://github.com/bytecodealliance/wasmtime/security/advisories/GHSA-hpqh-2wqx-7qp5
Affected versions
PyPI
crates.io
| Package | Vulnerable | Fixed in |
|---|---|---|
| cranelift-codegen | < 0.73.1 |
0.73.1 |
| cranelift-codegen | >= 0.0.0-0, < 0.73.1 |
0.73.1 |
How to fix
Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.
wasmtime PyPI → 0.27.0
- pip
pip install --upgrade "wasmtime>=0.27.0"- poetry
poetry add "wasmtime>=0.27.0"- uv
uv add "wasmtime>=0.27.0"
cranelift-codegen crates.io → 0.73.1
- cargo
cargo update -p cranelift-codegen --precise 0.73.1
Severity breakdown
CVSS 3.1 8.8
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H
- Attack vector
- Local
- Attack complexity
- Low
- Privileges required
- Low
- User interaction
- None
- Scope
- Changed
- Confidentiality
- High
- Integrity
- High
- Availability
- High
Weakness
CWE-125: Out-of-bounds Read
The product reads data past the end, or before the beginning, of the intended buffer.
How to prevent it
- Implementation: Assume all input is malicious. Use an "accept known good" input validation strategy, i.e., use a list of acceptable inputs that strictly conform to specifications. Reject any input that does not strictly conform to specifications, or transform it into something that does. When performing input validation, consider all potentially relevant properties, including length, type of input, the full range of acceptable values, missing or extra inputs, syntax, consistency across related fields, and conformance to business rules. As an example of business rule logic, "boat" may be syntactically valid because it only contains alphanumeric characters, but it is not valid if the input is only expected to contain colors such as "red" or "blue." Do not rely exclusively on looking for malicious or malformed inputs. This is likely to miss at least one undesirable input, especially if the code's environment changes. This can give attackers enough room to bypass the intended validation. However, denylists can be useful for detecting potential attacks or determining which inputs are so malformed that they should be rejected outright. To reduce the likelihood of introducing an out-of-bounds read, ensure that you validate and ensure correct calculations for any length argument, buffer size calculation, or offset. Be especially careful of relying on a sentinel (i.e. special character such as NUL) in untrusted inputs.
- Architecture and Design: Use a language that provides appropriate memory abstractions.
CWE-788: Access of Memory Location After End of Buffer
The product reads or writes to a buffer using an index or pointer that references a memory location after the end of the buffer.
References
Advisories
Packages
Other links
- github.com/bytecodealliance/wasmtime/security/advisories/GHSA-hpqh-2wqx-7qp5
- github.com/bytecodealliance/wasmtime/commit/95559c01aaa7c061088a433040f31e8291f…
- crates.io/crates/cranelift-codegen
- github.com/RustSec/advisory-db/blob/main/crates/cranelift-codegen/RUSTSEC-2021-…
- github.com/pypa/advisory-database/tree/main/vulns/wasmtime/PYSEC-2021-87.yaml
- rustsec.org/advisories/RUSTSEC-2021-0067.html
- fastly.com/security-advisories/memory-access-due-to-code-generation-flaw-in-cra…
Timeline
- Published
- Last updated by the source
- Latest EPSS score
Related advisories
| Advisory | Severity | Why it's related |
|---|---|---|
| GHSA-hfr4-7c6c-48w2 Wasmtime has use-after-free bug after cloning `wasmtime::Linker` | Medium | Also affects wasmtime |
| GHSA-7qmx-3fpx-r45m Wasmtime race condition could lead to WebAssembly control-flow integrity and type safety violations | Low | Also affects wasmtime |
| GHSA-75hq-h6g9-h4q5 Wasmtime vulnerable to panic when using a dropped extenref-typed element segment | Medium | Also affects wasmtime |
| GHSA-xm67-587q-r2vw wasmtime vulnerable to miscompilation of `i8x16.select` with the same inputs on x86_64 | Medium | Also affects cranelift-codegen |
| GHSA-ff4p-7xrq-q5r8 wasmtime vulnerable to guest-controlled out-of-bounds read/write on x86_64 | Critical | Also affects cranelift-codegen |
| GHSA-5fhj-g3p3-pq9g Wasmtime vulnerable to Use After Free with `externref`s | High | Also affects cranelift-codegen |
| GHSA-jqwc-c49r-4w2x Miscompilation of `i8x16.swizzle` and `select` with v128 inputs | Medium | Also affects cranelift-codegen |
| GHSA-7f6x-jwh5-m9r4 Cranelift vulnerable to miscompilation of constant values in division on AArch64 | High | Also affects cranelift-codegen |
MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.
Check your repos with MergeHarbor