CVE-2021-4435 is a high severity (CVSS 7.7) untrusted search path flaw in Yarn. If you run certain Yarn commands in a directory containing attacker controlled content, malicious commands could run. The record references the Yarn 1.22.13 release and a commit. Confirm the fixed version in the Red Hat advisory.
What's affected
- Yarn, with the affected range given only as a wildcard in the NVD record.
- The record references the v1.22.13 release tag and an upstream commit.
- Source conflict to note: the v1.22.13 release notes we read describe a Windows only issue where packages could run scripts despite an ignore setting, and they do not name this CVE. Red Hat is the source that ties the CVE to the Yarn commands. Treat 1.22.13 as the likely fix, and confirm it in the Red Hat advisory.
- The vector needs user interaction and high complexity, which is why the score stops at 7.7.
- KEV status: false.
How to check if you're exposed
Check which Yarn you run on developer machines and CI.
yarn --version
which -a yarn
Then look at where Yarn is invoked. The risky pattern is running Yarn inside a freshly cloned or downloaded directory you have not reviewed, such as a repository from an unknown contributor or an unpacked archive.
What to do now
- Upgrade Yarn Classic to 1.22.13 or later, and confirm against the Red Hat advisory that this is the fix for your version line.
- Do the same on CI runners and in base images, since they are easy to forget.
- Review code from untrusted sources before running package manager commands inside it.
- Where possible, run installs for untrusted code in a disposable container with no secrets mounted.
- Keep installation scripts disabled for dependencies you do not control, using your package manager settings.
Why it matters
The class is CWE-426, untrusted search path. When a program looks for another program or library by name and searches the current directory first, whoever controls that directory can supply a look alike. The record describes exactly that: commands run in a directory with attacker controlled content could execute malicious commands in unexpected ways.
This type of bug is a supply chain concern for developers, not only for servers. Reviewing a pull request, testing a sample project or opening a downloaded archive can all place you in a hostile directory. The fix is cheap, and the habit of isolating untrusted code is worth keeping either way.
Quick check
Does this affect servers that never clone unknown code?
Exposure is mostly where Yarn runs in a directory you do not control. Developer laptops and CI jobs that build external contributions are the common cases.
Is 1.22.13 confirmed as the fix?
The record points to that release and a commit, but the release notes we read do not name the CVE. Confirm with the Red Hat advisory before closing the ticket.
Sources
- Yarn v1.22.13 release notes
- Red Hat advisory (listed in the record, not retrieved)
- Upstream commit listed in the record
Last reviewed: 19 October 2026.