GitHub Advisoryadvisory · crates.io
GHSA-xrg3-hmf3-rvgw Path Traversal in rust-embed
HIGH
Official page ↗
- Aliases
- CVE-2021-45712
- Ecosystem
- crates.io
- Packages
- rust-embed
- Severity
- High
- CVSS vector
- CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
- Weaknesses
- CWE-22
- Reviewed
- 2022-01-05
Affected packages
• crates.io rust-embed: < 6.3.0 → fixed in 6.3.0
Description
When running in debug mode and the debug-embed (off by default) feature is not enabled, the generated get method does not check that the input path is a child of the folder given.
This allows attackers to read arbitrary files in the file system if they have control over the filename given. The following code will print the contents of your /etc/passwd if adjusted with a correct number of ../s depending on where it is run from.
Related
Alias · CVE (1)
- CVE-2021-45712 An issue was discovered in the rust-embed crate before 6.3.0 for Rust. vulnerability
Weakness · CWE (1)
- CWE-22 Improper Limitation of a Pathname to a Restricted Directory weakness
References
- https://nvd.nist.gov/vuln/detail/CVE-2021-45712 advisory
- https://github.com/pyros2097/rust-embed/issues/159 web
- https://github.com/pyros2097/rust-embed package
- https://raw.githubusercontent.com/rustsec/advisory-db/main/crates/rust-embed/RUSTSEC-2021-0126.md web
- https://rustsec.org/advisories/RUSTSEC-2021-0126.html web