CVE-2020-8131 Path Traversal in Yarn
Attackers can write to arbitrary filesystem paths via malicious packages, potentially leading to code execution in Yarn.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- A user has to click or open something
- Fix
- Available
What is CVE-2020-8131?
CVE-2020-8131 is a high-severity path traversal vulnerability in yarn, published on 24 Feb 2020. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Official description
Arbitrary filesystem write vulnerability in Yarn before 1.22.0 allows attackers to write to any path on the filesystem and potentially lead to arbitrary code execution by forcing the user to install a malicious package.
Weakness: CWE-22
Which versions are affected by CVE-2020-8131?
2 open source packages ship an affected version, including yarn. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
yarn npm | All versions | 1.22.0 |
yarn npm | All versions | 1.22.0 |
Products include Yarnpkg Yarn.
How do I fix CVE-2020-8131?
Upgrade yarn to 1.22.0 or later.
Upgrade, and resolve every user-supplied path against an allowed base folder before opening it. More about Path traversal.
Is CVE-2020-8131 being exploited?
There is no known exploitation of CVE-2020-8131 in the wild and no public exploit code.
Other vulnerabilities in yarn
- CVE-2019-5448 Missing Encryption of Sensitive Data in yarn
- CVE-2019-10773 Yarn Improper link resolution before file access (Link Following)
- CVE-2021-4435 Yarn: untrusted search path
- CVE-2019-15608 TOCTOU Race Condition in Yarn
- CVE-2025-8262 yarnpkg Yarn hosted-git-resolver.js explodeHostedGitFragment redos
Sources
Also known as DEBIAN-CVE-2020-8131, GHSA-8mfc-v7wv-p62g, ROOT-APP-NPM-CVE-2020-8131.