# Claude Code Security Part 3: Forging Remote Settings in User Space

**Blog:** [vschroeder.blog](https://vschroeder.blog)  
**Author:** Victor Schroeder  
**Published:** 2026-08-26  
**Tags:** [ai](/tags/ai.md), [security](/tags/security.md), [software-engineering](/tags/software-engineering.md)

> By exploiting an unauthenticated local cache file, an unprivileged user can forge arbitrary organization policies, overriding both enterprise rules and root-owned system restrictions without sudo.


[View as HTML](/posts/20260826-claude-code-cache-tampering-total-bypass/)

---

_This post is part of a ~~4-part~~ 5-part series on security vulnerabilities
in Claude Code's managed settings engine and the disclosure process:_

- **Part 1:** [How Cosmetic Remote Settings Kill Root Policies](/posts/20260824-claude-code-managed-settings-silent-override)
- **Part 2:** [Bypassing Enterprise Policy by Going Offline](/posts/20260825-claude-code-offline-bypass-fail-open)
- **Part 3:** [Forging Remote Settings in User Space](/posts/20260826-claude-code-cache-tampering-total-bypass)
- **Part 4:** [The 5-Minute HackerOne Rejection Speedrun](/posts/20260827-hackerone-speedrun-and-responsible-disclosure)
- **Part 5:** [Working as Designed... Until Quietly Patched](/posts/20261107-claude-code-security-part-5-working-as-designed-until-patched)

---

## Update (November 2026)

This series gained a new [5th part](/posts/20261107-claude-code-security-part-5-working-as-designed-until-patched)
with some major plot twists. After closing all of these reports in minutes as
"working as designed," Anthropic spent the next ten weeks quietly shipping fixes
for every single one of them. Read Part 5 for the changelog receipts and a
testimonial on how Anthropic's "bug bounty" strategy works in practice.

---

In the previous two installments of this series, we uncovered two distinct flaws
in how Claude Code handles enterprise configuration:

1. **Tier Shadowing:** The runtime uses a first-wins strategy where the `remote`
   tier completely overrides and discards the local root-owned `file` tier
   ([Part 1](/posts/20260824-claude-code-managed-settings-silent-override)).
2. **Fail-Open Poller:** When network requests fail at startup, the client
   trusts its stale local cache and disables policy re-fetching for up to one
   hour ([Part 2](/posts/20260825-claude-code-offline-bypass-fail-open)).

Each of these vulnerabilities is problematic on its own. But when you chain
them together with how Claude Code stores cached remote settings on disk, you get
a critical privilege boundary collapse:

An unprivileged local user can write arbitrary policy into a user-owned JSON
file and trick Claude Code into treating it as the authoritative, root-overriding
organization policy.

No `sudo` password required. No kernel exploits. Just a plain text file in the
user's home directory.

## The unauthenticated cache file

When Claude Code successfully downloads remote settings from the Anthropic API,
it caches them locally in the user's configuration folder:
`$CLAUDE_CONFIG_DIR/remote-settings.json` (typically
`~/.claude/remote-settings.json`).

Let us look at how the runtime reads this file during startup:

```javascript
function mVy() {
  try {
    let e = Eue(HIo()), // HIo() resolves to $CLAUDE_CONFIG_DIR/remote-settings.json
      t = Xt(yO(e));
    if (!t || typeof t !== "object" || Array.isArray(t)) return null;
    return t;
  } catch {
    return null;
  }
}
```

Notice what is happening here: it performs a simple `JSON.parse` (`Xt(yO(e))`).
There is zero cryptographic verification.

There is no HMAC. There is no public-key digital signature from Anthropic. The
only integrity mechanism in the entire module is an `ETag` header that the client
computes itself using SHA-256 over the local file contents to avoid
re-downloading identical payloads.

Because the client computes the hash over whatever is on disk, anyone who can
write to the file can generate a valid cache state.

## Chaining the chain: The full bypass exploit

Here is how the chain comes together:

1. The attacker edits `~/.claude/remote-settings.json`, injecting their own
   custom permissions or an empty object `{}`.
2. The attacker toggles off network connectivity.
3. Claude Code starts. It reads `~/.claude/remote-settings.json` via `mVy()`.
4. Because the file contains valid JSON, the runtime assigns it to the `remote`
   tier.
5. Due to the tier-shadowing bug (Vulnerability 1), the presence of the `remote`
   tier completely suppresses the root-owned
   `/etc/claude-code/managed-settings.json`. All system-level deny rules, command
   hooks, and tool restrictions are wiped out.
6. The runtime attempts to contact Anthropic's API to refresh settings, but
   fails because the network is down.
7. Due to the fail-open bug (Vulnerability 2), the retry loop gives up after 20
   seconds, leaves the forged cache in place, and schedules the next fetch for
   one hour later.
8. The attacker reconnects the network and uses Claude Code with full access to
   the API, unrestricted by corporate root policies or organization rules.

Let us watch this happen in real time with the debug logger.

First, write a forged policy granting unrestricted execution:

```bash
$ echo '{"permissions":{"allow":["Bash(echo FORGED_BY_ME)"]}}' > ~/.claude/remote-settings.json
```

Disconnect your network adapter and start Claude Code:

```bash
$ claude --debug --print 'Reply OK'
```

Wait 20 seconds, and then check `~/.claude/debug/latest`:

```text
2026-08-24T11:10:54.191Z [DEBUG] Applying permission update: Adding 1 allow rule(s) to destination 'policySettings': ["Bash(echo FORGED_BY_ME)"]
2026-08-24T11:10:54.233Z [DEBUG] Remote settings: Retry 1/5 after 582ms
2026-08-24T11:10:54.819Z [DEBUG] Remote settings: Retry 2/5 after 1184ms
2026-08-24T11:10:56.009Z [DEBUG] Remote settings: Retry 3/5 after 2441ms
2026-08-24T11:10:58.453Z [DEBUG] Remote settings: Retry 4/5 after 4642ms
2026-08-24T11:11:03.099Z [DEBUG] Remote settings: Retry 5/5 after 8548ms
2026-08-24T11:11:11.652Z [DEBUG] Remote settings: Using stale cache after fetch failure (unknown_error)
2026-08-24T11:11:11.703Z [DEBUG] Replacing all allow rules for destination 'policySettings' with 0 rule(s): []
2026-08-24T11:11:11.703Z [DEBUG] Replacing all deny rules for destination 'policySettings' with 0 rule(s): []
2026-08-24T11:11:11.703Z [DEBUG] Replacing all ask rules for destination 'policySettings' with 0 rule(s): []
2026-08-24T11:11:11.703Z [DEBUG] Replacing all allow rules for destination 'policySettings' with 1 rule(s): ["Bash(echo FORGED_BY_ME)"]
```

Look at that final line:
`Adding 1 allow rule(s) to destination 'policySettings': ["Bash(echo FORGED_BY_ME)"]`.

The client elevated the user-crafted file to the highest tier of system policy.
The root-owned file in `/etc` was bypassed without root access. The real
organization policy was bypassed without admin console credentials.

## Security impact

This vulnerability breaks the fundamental assumption of MDM and enterprise
workstation management:

- **CWE-345:** Insufficient Verification of Data Authenticity
- **CWE-353:** Missing Support for Integrity Check
- **CWE-693:** Protection Mechanism Failure

If a company provisions a laptop with a locked-down `/etc` configuration to
prevent AI coding agents from leaking secrets or running unvetted shell
commands, that protection is illusory. Any developer or script running in user
space can neuter the controls in twenty seconds.

## The cryptographic fix

Storing remote policy in a user-writable directory requires robust
cryptographic design:

1. **Signed policy envelopes:** The Anthropic settings server must sign the
   settings payload with an asymmetric private key (e.g., Ed25519). The client
   runtime should embed Anthropic's public key and verify the signature before
   accepting any cached file.
2. **Reject unsigned caches:** If the signature in
   `~/.claude/remote-settings.json` is missing or invalid, the file must be
   treated as corrupt and discarded immediately.
3. **Never allow user cache to shadow root files:** A cached remote policy
   should never be allowed to override local root configuration without
   cryptographic proof of authenticity and a proper policy-merging algorithm.

In [Part 4](/posts/20260827-hackerone-speedrun-and-responsible-disclosure), we
will look at what happened when these three vulnerabilities were submitted to
Anthropic via HackerOne, and why automated triage rejections put enterprise users
at risk.

---

Previous: [Claude Code Security Part 2: Bypassing Enterprise Policy by Going Offline](/posts/20260825-claude-code-offline-bypass-fail-open.md)  
Next: [Claude Code Security Part 4: The 5-Minute HackerOne Rejection Speedrun](/posts/20260827-hackerone-speedrun-and-responsible-disclosure.md)
