CVE-2025-59828: Claude Code Vulnerable to Arbitrary Code Execution via Plugin Autoloading with Specific Yarn Versions
When Yarn is installed, Claude Code ran `yarn --version` in a project directory before the user accepted the trust dialog. A malicious Yarn config (a plugin or a `yarnPath` entry) executes code at that moment. Versions of `@anthropic-ai/claude-code` before 1.0.39 are affected. Auto-update users already have the fix.
Published Sep 24, 2025 · Updated Dec 22, 2025 · Analysis Nov 1, 2026
What an attacker can do
Yarn reads configuration from the project folder, and some of that configuration can run code: plugins, and the yarnPath setting that points Yarn at a custom script. Merely calling yarn --version in a folder with a hostile .yarnrc.yml triggers them. Claude Code made that call on startup, before the user had answered the trust prompt that is meant to guard untrusted directories.
An attacker therefore only needs a repository that contains a crafted Yarn config and a victim who opens Claude Code in it with Yarn on the machine. The CVSS 4.0 vector reflects that: no privileges, passive user interaction, and an attack requirement (Yarn must be present). The code runs as the developer, so it can read source, SSH keys, cloud credentials and tokens in the environment.
The advisory describes this as a bypass of the directory trust dialog. CWE-829 and CWE-862 fit: functionality from an untrusted folder was used without the user's authorization. The weakness is in the check that ran before trust, not in Yarn itself.
Who is affected
Affected: @anthropic-ai/claude-code before 1.0.39, on machines where the yarn binary is available. Checking an untrusted repository with an old Claude Code is the risky case. Installs that follow standard auto-update have already moved on.
Check your version:
claude --version
npm ls -g @anthropic-ai/claude-code@anthropic-ai/claude-code
- Ecosystem
- npm
- Affected
- < 1.0.39
- Fixed in
- 1.0.39
- Check
npm ls @anthropic-ai/claude-code
How to fix it
Upgrade to @anthropic-ai/claude-code 1.0.39 or later:
npm install -g @anthropic-ai/claude-code@latestThe advisory says auto-update users received the fix automatically and that manual updaters should take the latest version. It lists no other workaround. Until you upgrade, avoid starting Claude Code in repositories you did not write or review, especially ones containing .yarnrc.yml or a .yarn folder.
How to tell if you were hit
In repositories you opened with a version below 1.0.39, inspect .yarnrc.yml for a yarnPath value or a plugins list that you did not add, and look inside .yarn/plugins and .yarn/releases for unfamiliar scripts. Check shell history and the process list for yarn or node processes started right when Claude Code launched. Beam records agent shell commands and file access, which helps you reconstruct what ran in a session.
Original advisory
From the GitHub Advisory Database (CC BY 4.0).
When using Claude Code with Yarn installed, Yarn config files can trigger code execution when running yarn --version. This could lead to a bypass of the directory trust dialog in Claude Code, as plugins and yarnPath could be executed prior to the user accepting the risks of working in an untrusted directory. Users on standard Claude Code auto-update will have received this fix automatically. Users performing manual updates are advised to update to the latest version.
Thank you to Benjamin Faller, Redguard AG and Michael Hess for reporting this issue!
Credited to cai0duque.
Questions
- Do I have to use Yarn to be affected?
Yes. The flaw is triggered through
yarn --version, so Yarn must be installed. Without Yarn the sources describe no code execution path.- Which Claude Code version fixes CVE-2025-59828?
Version 1.0.39 contains the fix. Anything older is vulnerable.
- Does the user need to accept the trust dialog first?
No, that is the issue. Plugins and
yarnPathcould run before the user accepted the risks of working in an untrusted directory.
References
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology
More Claude Code vulnerabilities
All Claude Code entriesCVE-2026-88968
Claude Code: TOCTOU Race in Edit Tool Allows File Writes Outside the Workspace
high7.7Nov 9, 2026CVE-2026-86063
Claude Code: Plugin Hash Pin Bypass Allows Bypass of Hash Pinning
high7.5Oct 15, 2026CVE-2026-55607
Claude Code: Sandbox Escape via Git Worktree Path Confusion Allows Unsandboxed Code Execution
high7.7Jul 24, 2026CVE-2026-46406
@anthropic-ai/claude-code has an Insecure Temporary File in /copy Command that Enables Response Disclosure and Symlink-Based File Write
medium4.4Jun 25, 2026CVE-2026-54316
Claude Code: Out-of-Band Data Exfiltration via Pre-Approved HuggingFace Domain in WebFetch
medium9.1Jun 17, 2026CVE-2026-40068
Claude Code: Trust Dialog Bypass via Git Worktree Spoofing Allows Arbitrary Code Execution
high7.7Apr 24, 2026
