CVE-2021-45712 RustEmbed generated `get` method allows for directory traversal when reading files from disk
Attackers can read arbitrary files via directory traversal in debug mode of the rust-embed crate, requiring an upgrade to secure the application.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2021-45712?
CVE-2021-45712 is a high-severity path traversal vulnerability in n/a, published on 26 Dec 2021. An attacker can exploit it over the internet without logging in, with no action from the victim.
Official description
An issue was discovered in the rust-embed crate before 6.3.0 for Rust. A ../ directory traversal can sometimes occur in debug mode.
Weakness: CWE-22
Which versions are affected by CVE-2021-45712?
5 open source packages ship an affected version, including rust-embed. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
rust-embed crates.io | All versions | 6.3.0 |
rust-embed crates.io | All versions | 6.3.0 |
rust-embed crates.io | All versions | 6.3.0 |
rust-embed crates.io | All versions | 6.3.0 |
rust-embed crates.io | From 0.0.0-0 | 6.3.0 |
Products include Rust-Embed Project Rust-Embed.
How do I fix CVE-2021-45712?
Upgrade rust-embed to 6.3.0 or later.
Upgrade, and resolve every user-supplied path against an allowed base folder before opening it. More about Path traversal.
Is CVE-2021-45712 being exploited?
There is no known exploitation of CVE-2021-45712 in the wild and no public exploit code.
Sources
Also known as GHSA-cgw6-f3mj-h742, GHSA-xrg3-hmf3-rvgw, RUSTSEC-2021-0126.