Dec 19, 2025 von Benjamin Faller

On a Sunday evening during the summer, we discovered a high-severity vulnerability in Anthropic’s Claude Code CLI tool. This flaw, assigned CVE-2025-59828/CVE-2025-65099, allowed attackers, who can trick a victim to start Claude Code prior to version 1.0.39 within an untrusted directory, to gain arbitrary code execution. Exploitation would have required any version of the Yarn package manager to be installed on the target machine. User interaction, such as acceptance of the startup trust dialog, was not necessary. This issue has been assigned a CVSS v4.0 score of 7.7 (High) and was addressed in version 1.0.39.
The vulnerability exists in how Claude Code initializes and inspects the local environment. When the claude command is executed, the tool attempts to identify installed tools and versions, including executing yarn --version.
This execution occurs before the application prompts the user to trust the current directory. Yarn allows for configuration via .yarnrc.yml files, which can define specific execution paths (yarnPath) or plugins that execute code upon invocation. Consequently, if a user runs Claude Code in a directory containing a malicious configuration, the code executes without the need for further confirmation or user interaction.
It should be noted that at the time of writing, the information given in the CVEs and GitHub advisories may not be fully accurate regarding the affected Yarn versions. This is due to Anthropic publishing two advisories and CVEs for the same flaw. Based on our tests, this attack is successful on all Yarn versions using the yarnPath technique, and starting from version 2.0.0-rc.23 for the plugin technique.
Further information and technical details can be found in a separately published article by the researchers.
A full PoC has been published on GitHub, demonstrating both attack techniques in more detail.
For instance, when using the yarnPath technique, attackers can create two files in a directory. First, a .yarnrc.yml configuration file that points the yarnPath to a malicious script:
1
yarnPath: "./script.js"
Second, a malicious script.js file:
1
2
const { execSync } = require('child_process');
execSync('echo "Pwned!" | tee proof.txt', { stdio: 'inherit' });
When a victim navigates to this directory and starts Claude Code using the claude command, the script.js file is executed immediately through yarn --version. This results in the creation of proof.txt (or any other arbitrary command execution) before the trust dialog appears or is accepted.
This vulnerability poses a significant threat to developers using Claude Code. If a victim can be tricked into running the tool inside a repository or folder containing malicious Yarn configuration files, the attackers achieve arbitrary code execution with the privileges of the current user. Because the execution happens silently in the background before the trust prompt is confirmed, the user has no opportunity to prevent the attack once Claude Code is started. This could lead to data theft, installation of malware, or full system compromise.
The vendor has patched this issue in Claude Code version 1.0.39. It is recommended that all users upgrade to the latest version of Claude Code. For additional defense-in-depth measures, Redguard recommends the following practices to reduce the impact of this and similar vulnerabilities:
The following timeline details the steps taken in the coordinated vulnerability disclosure process:
This advisory is not an exhaustive list of all potential security issues for the mentioned software. Other vulnerabilities may exist. The information provided is believed to be accurate at the time of publishing. Use of this information is at your own risk. Neither the author nor the publisher accepts any liability for any loss or damage arising from the use of, or reliance on, this information.