MEDIUM 6.1

CVE-2026-46406: Claude Code /copy Command Local Information Disclosure and Symlink Exploitation

Claude Code versions 2.1.59 through 2.1.128 had a local file handling vulnerability in the /copy command that could leak sensitive information or allow file manipulation. When the command executed, it wrote responses to a predictable location (/tmp/claude/response.md) with insufficient protections. Any user on the system could read files written there, potentially exposing secrets or credentials. Additionally, an attacker could plant a symlink at that location to trick the tool into overwriting arbitrary files with command output. This vulnerability requires local system access and relies on a privileged user running the /copy command, limiting its scope but creating real risk in multi-user or containerized environments.

Source data · NVD / CISA · public domain

CVSS
3.1 · 6.1 MEDIUM · CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:L/I:L/A:H
Weaknesses (CWE)
CWE-200, CWE-377, CWE-59
Affected products
1 configuration(s)
Published / Modified
2026-06-29 / 2026-06-30

NVD description (verbatim)

Claude Code is an agentic coding tool. From 2.1.59 until 2.1.128, the Claude Code /copy command wrote responses to a hardcoded, predictable path (/tmp/claude/response.md) without UID isolation, randomness, or symlink protection. The file was created world-readable (0644) in a world-traversable directory (0755), allowing any local user to read a privileged user's Claude response, which could contain secrets or credentials. Additionally, because the path was static and predictable, a local attacker could pre-create the directory and plant a symlink at the expected file path, causing the privileged process to follow the symlink and overwrite an attacker-chosen file with the response text. Exploiting this required a local unprivileged user on the same system and a privileged user to run the /copy command. This vulnerability is fixed in 2.1.128.

1 reference(s) · View on NVD →

SEC.co analysis · AI-assisted, reviewed against source

Technical summary

The vulnerability stems from three compounding weaknesses in path handling. First, the /copy command used a static, world-readable path (/tmp/claude/response.md) without per-user isolation or random components. Second, the file was created with 0644 permissions in a 0755 directory, making it readable to any local user. Third, no symlink protection or O_EXCL flag was used during file creation, allowing an attacker to pre-populate the directory with a symlink pointing to a target file, causing the privileged process to follow that symlink and overwrite the attacker's chosen destination. The vulnerability affects CWE-200 (exposure of sensitive information), CWE-377 (insecure temporary file), and CWE-59 (symlink following). Exploitation requires both local access and a privileged user performing the /copy operation on the same system.

Business impact

The primary business risk is credential or secret exposure. Claude Code users may include API keys, authentication tokens, or other sensitive data in their /copy requests; if a lower-privileged user or attacker reads the response file, those secrets are compromised. The secondary risk is file corruption or privilege escalation through symlink manipulation—an attacker could overwrite system or application files if the privileged process has sufficient permissions. In environments where Claude Code runs as a service account or root, this could lead to system unavailability or unauthorized modification of critical files. The impact is most acute in shared systems, containerized deployments where user isolation is weak, or high-security environments handling sensitive intellectual property or credentials.

Affected systems

Claude Code versions 2.1.59 through 2.1.128 are affected. Version 2.1.128 and later include the fix. Organizations should inventory deployments of Claude Code in this version range, particularly in multi-user systems, CI/CD pipelines, or shared container environments where local privilege boundaries matter. The vulnerability is local-only, so remote exposure is not possible; however, any system allowing multiple local user accounts or running untrusted code poses risk.

Exploitability

Exploitability is moderate. An attacker must have local system access and unprivileged user credentials—they cannot trigger the vulnerability remotely. The attack surface narrows further because the /copy command must be invoked by a privileged user (such as a service account or administrator) at roughly the same time the attacker is monitoring or manipulating /tmp/claude/. No user interaction is required beyond the privileged user running /copy; the attacker's symlink or file read happens automatically. In practice, this favors scenarios with predictable execution patterns (e.g., scheduled tasks, automated CI/CD jobs, or long-running services) where timing is easier to predict.

Remediation

Upgrade Claude Code to version 2.1.128 or later immediately. This version addresses all three root causes: using per-user temporary directories with randomized paths, applying restrictive file permissions (0600), and implementing symlink-safe file creation (typically via mkstemp or equivalent secure temporary file APIs). For organizations unable to upgrade immediately, operational mitigations include restricting /tmp permissions, using AppArmor or SELinux to limit symlink following in /tmp, and limiting local user accounts on systems running Claude Code. However, these are defensive; patching is the correct long-term fix.

Patch guidance

Upgrade to Claude Code 2.1.128 or later. Verify the version in your deployment using the tool's version command or package manager. If using Docker or containerized Claude Code, rebuild images from the updated base or directly update the package. Test the upgrade in a non-production environment first to ensure compatibility with your workflows. No special migration steps or configuration changes are required; the fix is transparent to end users.

Detection guidance

Monitor for suspicious symlink activity in /tmp/claude/ directory. Use tools like auditd (on Linux) to log symlink creation and file access patterns in /tmp/claude/. Check file permissions on /tmp/claude/response.md after it is created; permissions should not be 0644 on patched versions. Scan process execution logs for the /copy command and cross-reference with local user login activity to detect timing patterns suggesting exploitation. Review /tmp for unexpected symlinks pointing to sensitive files (e.g., /etc/passwd, application config files). On systems with SELinux or AppArmor, ensure policies restrict symlink following in /tmp.

Why prioritize this

This vulnerability merits prompt but not emergency patching. The CVSS 3.1 score of 6.1 (MEDIUM) reflects the local-only attack vector and requirement for privileged user cooperation, but the integrity and confidentiality impacts (file read/write to arbitrary locations) and availability component (potential file corruption) justify swift remediation. Organizations should prioritize systems where Claude Code runs as a service account or with elevated privileges, or where /tmp isolation is weak. For standard development workstations or single-user systems, risk is lower but still non-zero.

Risk score, explained

CVSS 3.1 score 6.1 (MEDIUM) reflects: Attack Vector (Local) — requires local system access, reducing overall risk; Attack Complexity (Low) — no unusual conditions needed once access is gained; Privileges Required (Low) — unprivileged users can exploit it; User Interaction (Required) — depends on a privileged user running /copy, limiting autonomous exploitation; Scope (Unchanged) — impact confined to the local system; Confidentiality (Low) — secrets in response files are exposed, but impact is narrow to that single interaction; Integrity (Low) — symlink overwrite risk exists but is constrained by file permissions; Availability (High) — arbitrary file overwrite could disable services. The MEDIUM severity is appropriate for a local, context-dependent vulnerability with real but bounded impact.

Frequently asked questions

Does this vulnerability require network access?

No. It is strictly a local vulnerability. An attacker must have a user account or shell access on the same system running Claude Code. Remote exploitation is not possible.

What credentials or data types are most at risk?

Any data passed to the /copy command could be exposed: API keys, database credentials, authentication tokens, code snippets containing secrets, or other sensitive information in the response. The risk is highest in environments where Claude Code is used to process or manipulate sensitive materials.

Can I mitigate this without upgrading immediately?

Partial mitigations include restricting /tmp permissions, enforcing SELinux or AppArmor policies to block symlink following in /tmp, and limiting local user accounts on Claude Code systems. However, these are not substitutes for patching. Upgrade to 2.1.128+ as soon as operationally feasible.

Does this affect Claude Code in the cloud or SaaS versions?

This vulnerability applies only to local installations of Claude Code (versions 2.1.59–2.1.128). Cloud-based or SaaS offerings managed by Anthropic are not affected, as they do not expose the /tmp file system to end users.

This analysis is based on the official CVE description and CVSS scoring. Organizations should verify patch availability and version compatibility against Anthropic's official security advisories and release notes before deploying updates. Testing in a non-production environment is strongly recommended. SEC.co provides this information for educational and defensive planning purposes; any exploitation of vulnerabilities is unlawful and unethical. Source: NVD (public-domain), retrieved 2026-08-08. Analysis generated by SEC.co (claude-haiku-4-5).