Feb 8, 2026·6 min read·119 visits
Claude Code's file access restrictions could be bypassed using symbolic links. The tool validated the link's name rather than its target, allowing the AI to read 'denied' files like `/etc/passwd` if they were symlinked from an allowed path. Fixed in v2.1.7.
In the race to build autonomous coding agents, developers often forget the oldest tricks in the UNIX book. Claude Code, Anthropic's CLI tool for agentic coding, implemented a 'deny' list to prevent the AI from reading sensitive files (like keys or system configs). However, prior to version 2.1.7, this mechanism checked the filename, not the file's destination. By utilizing symbolic links, an attacker (or a malicious repository) could trick the agent into reading any file the user had access to, completely bypassing the application's security constraints.
We are living in the golden age of "Agentic AI." Tools like Claude Code are essentially remote shells that we willingly install, giving a Large Language Model (LLM) permission to read our files, execute terminal commands, and refactor our spaghetti code. It is a powerful concept, but it terrifyingly blurs the line between "user intent" and "arbitrary code execution."
To keep things from going off the rails, Anthropics implemented a safety feature: a settings.json configuration where paranoid users (like us) can define a deny list. This list tells the agent, "You can touch anything in this repo, except my .env file and definitely not /etc/shadow." Ideally, this creates a sandbox where the agent can play without burning down the house.
But here is the thing about software boundaries: they are often drawn with crayon. The vulnerability we are looking at today, CVE-2026-25724, is a classic example of logic failing to account for the underlying geometry of the filesystem. It is a story about how a simple symbolic link turned a security fence into a revolving door.
The root cause of this vulnerability is a canonicalization failure, specifically CWE-61 (UNIX Symbolic Link Following). When you ask a program to check if a file is safe to read, the program has to decide which path it is checking: the path you gave it, or the path the filesystem actually resolves to.
In Claude Code versions prior to 2.1.7, the application performed its security check on the user-provided path. If the deny list contained /etc/passwd, and the agent attempted to read ./cool-config.txt, the check would pass because ./cool-config.txt is not in the deny list.
However, if ./cool-config.txt happened to be a symbolic link pointing to /etc/passwd, the underlying fs.readFile (or equivalent system call) would happily follow the link and return the contents of the password file. The security check validated the label on the box, but the filesystem opened the contents of the box. This is a classic Time-of-Check to Time-of-Use (TOCTOU) adjacent issue where the object verified differs from the object accessed.
Let's look at a reconstruction of the vulnerable logic vs. the fixed logic. The flaw lies entirely in the order of operations: checking permissions before resolving the path.
// Pseudocode representation of the flaw
function isAllowed(filePath: string, denyList: string[]): boolean {
// FLAW: Checks the raw path string against the deny list
for (const denied of denyList) {
if (filePath.startsWith(denied)) {
return false;
}
}
return true;
}
// Usage
const target = "./innocent_link";
if (isAllowed(target, userSettings.deny)) {
// The runtime follows the symlink here, bypassing the check
const content = fs.readFileSync(target, 'utf-8');
console.log(content);
}The patch involves resolving the path to its absolute, physical location on the disk using realpath before performing any checks. This ensures that aliases cannot hide the true destination.
import { realpathSync } from 'fs';
function isAllowed(filePath: string, denyList: string[]): boolean {
try {
// FIX: Resolve symlinks to their true destination first
const resolvedPath = realpathSync(filePath);
for (const denied of denyList) {
if (resolvedPath.startsWith(denied)) {
return false;
}
}
return true;
} catch (e) {
// Handle dangling links or missing files
return false;
}
}> [!NOTE]
> This fix effectively neutralizes the attack because realpathSync expands ./innocent_link into /etc/passwd. The subsequent check sees that /etc/passwd matches the deny list entry and blocks the read operation.
While the CVSS score is low (2.3) because it requires the user to run the tool, the attack vector is fascinating for supply chain security. Imagine a malicious open-source repository designed to exfiltrate data from developers who use AI agents to review code.
An attacker creates a repository with a "helper script" or a config file that is actually a symlink to sensitive system files.
# Attacker sets up the repo
mkdir -p malicious-repo
cd malicious-repo
# Create a link to the user's SSH keys or global config
ln -s ~/.ssh/id_rsa ./debug_logs.txt
ln -s /etc/shadow ./shadow_copy.txt
git add .
git commit -m "Add debug logs for analysis"claude code.settings.json to deny access to ~/.ssh and /etc, thinking they are safe.debug_logs.txt. It checks the deny list. debug_logs.txt is allowed.id_rsa), ingests the private key into its context window, and sends it to the LLM API for processing. The private key is now in the chat history.If you look at the CVSS score of 2.3, you might be tempted to ignore this. "Low severity? Who cares?" But in the context of an Agentic AI, the impact is higher than the score suggests.
We are entrusting these tools with high-bandwidth IO. They read code, they write code, and crucially, they upload context to the cloud. A file read bypass isn't just a local display issue; it's a data exfiltration vector. If an agent inadvertently reads a secret because of a symlink bypass, that secret leaves your machine and ends up on Anthropic's servers (or wherever the API endpoint is).
Furthermore, this breaks the trust model. Users rely on the deny list as a safety rail. When safety rails fail silently, users engage in risky behavior (like running the agent on untrusted code) believing they are protected. It is a reminder that application-level permissions are rarely as robust as OS-level permissions.
The remediation is straightforward: Update to @anthropic-ai/claude-code version 2.1.7 or later. This version correctly resolves paths before authorization.
For developers building similar tools:
fs.realpath (Node) or filepath.EvalSymlinks (Go) before performing security checks./etc/passwd is risky; running it in a container where /etc/passwd doesn't matter is better.CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N| Product | Affected Versions | Fixed Version |
|---|---|---|
@anthropic-ai/claude-code Anthropics | < 2.1.7 | 2.1.7 |
| Attribute | Detail |
|---|---|
| CWE | CWE-61 (Symlink Following) |
| CVSS v4.0 | 2.3 (Low) |
| Attack Vector | Network (via malicious repo) |
| Privileges Required | None |
| User Interaction | Required (Passive) |
| Exploit Status | PoC Available |
CVE-2026-16454 is an object-level authorization bypass vulnerability (CWE-284, CWE-862) in Eclipse hawkBit versions 1.0.3 and prior. The flaw exists within the Direct Device Integration (DDI) REST controller (hawkbit-ddi-resource), where endpoints responsible for enumerating software module metadata and serving firmware binaries fail to verify whether the requested software module is assigned to the authenticated device. Consequently, any device with valid credentials (such as a TargetToken or GatewayToken) can enumerate software module identifiers and download arbitrary firmware artifacts across the entire tenant namespace.
CVE-2026-62284 (GHSA-5w5g-j6hw-6p8f) is a code injection and server-side request forgery vulnerability in the console-proxy component of the OSAC Operator. The RemoteConfigResolver parses Kubernetes Secrets containing kubeconfig files via clientcmd.RESTConfigFromKubeConfig without sanitizing execution-related fields. An attacker with RBAC permissions to create or modify labeled Secrets in monitored namespaces can supply a malicious exec credential plugin, resulting in arbitrary command execution within the console-proxy pod.
CVE-2026-62361 (GHSA-xgjr-7j9q-2h4r) is an authenticated SQL injection and authorization bypass vulnerability in listmonk, an open-source, self-hosted newsletter and mailing list manager written in Go. In versions prior to 6.2.0, the subscriber export endpoint (GET /api/subscribers/export) directly interpolates user-supplied SQL filter expressions into a PostgreSQL query without invoking the table allowlist validation function (validateQueryTables). Consequently, authenticated users possessing the subscribers:sql_query and subscribers:get_all permissions can bypass relational access controls, execute arbitrary subqueries against restricted tables such as users and settings, and modify database state via writable Common Table Expressions (CTEs).
CVE-2026-28385 (GHSA-3gq2-x4qg-p4g6) is a Server-Side Request Forgery (SSRF) vulnerability in Canonical LXD versions 4.12 through 6.9. An authenticated user possessing the can_create_images entitlement can force the LXD daemon to execute arbitrary outbound HTTP and HTTPS requests via the /1.0/images API endpoint. Due to the absence of egress destination validation, an attacker can probe host loopback services, RFC 1918 private network segments, and cloud Instance Metadata Services (IMDS) from the network position of the privileged LXD daemon.
Canonical LXD and LXC Incus contain an arbitrary file write vulnerability (CWE-73 / CWE-59) in the `/1.0/instances/<name>/exec` REST API endpoint. When an instance is unpacked from an image archive, top-level symbolic links are extracted directly onto the host filesystem within the instance storage directory. If a crafted image includes a symbolic link named `exec-output` pointing to an arbitrary host path, invoking the execution endpoint with `record-output: true` causes the privileged host daemon to follow the symlink and write command output files directly to the target host directory. An authenticated attacker with permissions to import images and execute commands can exploit this flaw to write controlled content to sensitive host directories such as `/etc/cron.d`, resulting in arbitrary code execution on the host as `root`.
CVE-2026-48749 (tracked as GHSA-vghh-5rfx-xhq8 for LXD and GHSA-2q3f-q5pq-g8wv for Incus) is a critical container escape vulnerability in the Canonical LXD and Linux Containers Incus system container managers. By importing a specially crafted container image archive containing duplicate tar member headers, an authenticated attacker can replace the instance rootfs directory with a symbolic link pointing to the underlying host root filesystem. When performing file operations on a stopped container, the privileged forkfile helper binary resolves the symbolic link without confinement and chroots directly into the host filesystem, granting arbitrary root-level file read and write access.