Ecosyste.ms: Advisories
An open API service providing security vulnerability metadata for many open source software ecosystems.
Security Advisories: GSA_kwCzR0hTQS1jZ3c2LWYzbWotaDc0Ms4AArs1
RustEmbed generated `get` method allows for directory traversal when reading files from disk
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.
#[derive(rust_embed::RustEmbed)]
#[folder = "src/"]
pub struct Asset;
fn main() {
let d = Asset::get("../../../etc/passwd").unwrap().data;
println!("{}", String::from_utf8_lossy(&d));
}
The flaw was corrected by canonicalizing the input filename and ensuring that
it starts with the canonicalized folder path.
JSON: https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1jZ3c2LWYzbWotaDc0Ms4AArs1
Source: GitHub Advisory Database
Origin: Unspecified
Severity: Moderate
Classification: General
Published: almost 2 years ago
Updated: over 1 year ago
Identifiers: GHSA-cgw6-f3mj-h742
References:
- https://github.com/pyros2097/rust-embed/issues/159
- https://rustsec.org/advisories/RUSTSEC-2021-0126.html
- https://github.com/advisories/GHSA-cgw6-f3mj-h742
Blast Radius: 0.0
Affected Packages
cargo:rust-embed
Dependent packages: 309Dependent repositories: 1,570
Downloads: 5,917,296 total
Affected Version Ranges: < 6.3.0
Fixed in: 6.3.0
All affected versions: 0.2.0, 0.3.0, 0.3.2, 0.3.4, 0.3.5, 0.4.0, 0.5.0, 0.5.1, 0.5.2, 1.0.0, 1.1.0, 1.1.1, 2.0.0, 3.0.0, 3.0.1, 3.0.2, 4.0.0, 4.1.0, 4.2.0, 4.3.0, 4.4.0, 4.5.0, 5.0.0, 5.0.1, 5.0.2, 5.0.3, 5.0.4, 5.0.5, 5.1.0, 5.2.0, 5.3.0, 5.4.0, 5.5.0, 5.5.1, 5.6.0, 5.7.0, 5.8.0, 5.9.0, 6.0.0, 6.0.1, 6.1.0, 6.2.0
All unaffected versions: 6.3.0, 6.4.0, 6.4.1, 6.4.2, 6.5.0, 6.6.0, 6.6.1, 6.7.0, 6.8.0, 6.8.1, 8.0.0, 8.1.0, 8.2.0, 8.3.0