NewApp Monitoring is liveSign up free
AgentbeamBeta
AI agent vulnerability · Claude Code

CVE-2025-65099: Claude Code vulnerable to command execution prior to startup trust dialog

highCVSS 4.0 7.7GHSA-5hhx-v7f6-x7gv

Claude Code before 1.0.39 ran `yarn --version` before the user accepted the directory trust dialog. On a machine with Yarn installed, a malicious repository's Yarn config (plugins or `yarnPath`) could run code at that moment. Opening an untrusted folder was enough. Upgrade to 1.0.39 or later.

Published Nov 19, 2025 · Updated Dec 22, 2025 · Analysis Nov 1, 2026

What an attacker can do

The trust dialog exists so that a user can decide whether to work in an untrusted directory before Claude Code acts on anything inside it. Here, Claude Code called yarn --version at startup, ahead of that prompt. Yarn reads .yarnrc.yml from the current directory even for --version. A yarnPath setting points Yarn at a project-supplied script to run in its place, and plugins entries load project-supplied code. Either one executes as soon as Yarn starts.

The attacker needs the victim to start Claude Code inside a directory they control, such as a cloned repository, an unpacked archive or a pull request checkout, on a machine where Yarn is installed. The victim does not have to accept anything first, which is the whole point of the bypass; the CVSS 4.0 vector shows only passive user interaction.

The code runs as the user. It can read source, SSH keys, tokens in the environment and cloud credentials, or plant persistence. Developers who review other people's repositories with an AI agent are the most exposed.

Who is affected

@anthropic-ai/claude-code below 1.0.39, on machines that also have Yarn installed. Auto-updating installs received the fix. Check CLI versions on workstations, dev containers and CI images:

claude --version
yarn --version

Run the Yarn check only outside untrusted directories, since Yarn reads config from the current folder.

@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 Claude Code 1.0.39 or later:

npm install -g @anthropic-ai/claude-code@latest

The advisory names no other workaround. Until you upgrade, do not launch Claude Code in directories you have not reviewed. Before doing so in a cloned repository, look for .yarnrc.yml files and check them for yarnPath and plugins entries.

How to tell if you were hit

In repositories you opened with Claude Code before updating, check .yarnrc.yml and .yarn/ for a yarnPath that points to a project script, or a plugins: list, particularly in a repo you did not write. Check shell history, process logs and EDR data for a yarn process started from the claude process at startup that spawned other programs, or for outbound network connections at that moment. Look for new files in the home directory, shell profiles and ~/.ssh created around the time you opened the folder.

Beam records the commands an agent runs once its hooks are active, but this bug fires before any hook decision, so check the Yarn configuration directly.

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!

Questions

Do I need Yarn installed to be affected by CVE-2025-65099?

Yes. The flaw is triggered by Claude Code running yarn --version, so it requires Yarn on the machine. Config files in the opened directory then control what runs.

Which Claude Code version fixes it?

1.0.39. Standard auto-update users already received it; manual installs should update.

Does the trust dialog protect me?

Not in affected versions. The code ran before the dialog appeared, so declining it came too late.

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 entries