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:


Update (November 2026)

This series gained a new 5th part 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.


If you deploy developer tooling in a corporate environment, you learn to love centralized configuration. You drop a root-owned file into /etc, lock down file permissions, and tell your compliance auditor that workstations have strict guardrails.

Claude Code supports this model through managed settings. System administrators can define mandatory rules in /etc/claude-code/managed-settings.json to prevent dangerous bash commands, block access to sensitive file paths, and enforce pre-tool execution hooks.

Or so we thought.

While auditing the startup policy engine in Claude Code 2.1.234, I discovered that the multi-tiered settings hierarchy does not merge policies at all. It uses a naive first-wins precedence.

The consequence is alarming: if your organization pushes even a single cosmetic remote setting, such as setting commit attribution text to empty strings, the entire root-owned /etc policy file is silently dropped.

No error is logged. No warning is shown. Your compliance scanner sees the root file and reports green, while the AI agent runs completely unrestricted.

The illusion of policy layering

Claude Code advertises three distinct configuration tiers for enterprise policy enforcement:

  1. remote: Delivered dynamically from the Anthropic console / organization.
  2. mdm: Delivered via OS-level management profiles (plist on macOS, registry on Windows).
  3. file: Stored in a local, root-owned file at /etc/claude-code/managed-settings.json (on Linux).

In standard security architecture, when multiple policy layers exist, you expect a hierarchical merge. Restrictive security controls (like deny rules, command hooks, and tool blocklists) should accumulate or take strict precedence over permissive ones. At the very least, a machine-level root administrator should not have their entire rule set discarded because a remote API sent a cosmetic preference.

That is not what happens under the hood.

The root cause: First non-null takes all

Decompiling the tier-resolution routine in the Claude Code runtime reveals a surprising loading strategy:

// Tier resolution logic extracted from Claude Code runtime
let u = [r, o, s].filter((y) => y !== null), // r = remote, o = mdm, s = /etc file
  d = u[0] ?? null; // FIRST non-null tier wins; the rest are dropped entirely

The array [r, o, s] puts remote first, mdm second, and file third. The engine filters for non-null values and picks u[0].

Only four very narrow keys are merged across tiers: allowManagedPermissionRulesOnly, two sandbox flags, and environment variables under env.

Everything else: permissions, hooks, disable*, and allow* toggles, comes solely from d, the winner. If r (remote) is present and schema-valid, the entire local /etc/claude-code/managed-settings.json file is ignored.

Because the remote payload is considered “present” whenever it contains any non-empty JSON object matching the settings schema, a completely benign remote flag replaces the whole local policy.

Reproducing the silent drop

Let us reproduce this step by step on a Linux machine.

First, create a strict root-owned policy file that forbids reading /etc and requires an approval hook before running shell commands:

$ sudo mkdir -p /etc/claude-code
$ sudo tee /etc/claude-code/managed-settings.json << 'EOF'
{
  "permissions": {
    "deny": ["Read(//etc/claude-code/**)"],
    "allow": ["Bash(make test)"]
  },
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Bash",
        "hooks": [
          {
            "type": "command",
            "command": "/usr/local/bin/security-guard.sh"
          }
        ]
      }
    ]
  }
}
EOF
$ sudo chmod 644 /etc/claude-code/managed-settings.json

If the organization has zero remote settings configured in the Anthropic console, Claude Code loads this file on startup. Deny rules and hooks work as advertised.

Now, imagine an engineering manager logs into the Anthropic web console and sets a standard commit attribution policy:

{
  "attribution": {
    "commit": "",
    "pr": ""
  }
}

This is not a security policy. It is a cosmetic preference about whether git commits created by Claude Code contain a trailer.

Launch Claude Code with debug logging enabled:

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

Inspect the debug output:

2026-08-24T09:59:00.162Z [DEBUG] Programmatic settings change notification for policySettings
2026-08-24T09:59:00.173Z [DEBUG] Settings changed from policySettings, updating app state
2026-08-24T09:59:00.188Z [DEBUG] Replacing all allow rules for destination 'policySettings' with 0 rule(s): []
2026-08-24T09:59:00.188Z [DEBUG] Replacing all deny rules for destination 'policySettings' with 0 rule(s): []
2026-08-24T09:59:00.188Z [DEBUG] Replacing all ask rules for destination 'policySettings' with 0 rule(s): []

Look at those lines: Replacing all deny rules... with 0 rule(s).

The local deny list is gone. The PreToolUse hook script is gone. The root-owned file was parsed, but because remote existed, d = u[0] grabbed the remote object and discarded the file tier without uttering a single warning.

Why this is dangerous

This behavior creates a classic Interpretation Conflict (CWE-436) and a Protection Mechanism Failure (CWE-693).

  1. Silent fail-open: System administrators and compliance monitoring agents rely on configuration presence on disk. An auditor verifying that /etc/claude-code/managed-settings.json exists will certify the host as compliant. In reality, the runtime operates in a completely unconstrained state.
  2. Blast radius across entire organizations: Because remote settings are scoped at the organization level, an admin rolling out a cosmetic metadata change instantly voids the local security controls of every machine running in the fleet.
  3. Foundation for privilege escalation: As we will see in the next posts of this series, this tier-shadowing bug forms the backbone of a full security boundary bypass that can be triggered locally by any unprivileged user.

The necessary fix

Managed settings must follow a merge strategy, not first-wins.

At minimum:

  • Restrictive policies (permissions.deny, hooks, disable* toggles) must be merged additively across all tiers. No higher or lower tier should be able to silently erase a restriction declared in another tier.
  • Shadowed rules should produce visible warnings during session startup.
  • The claude doctor command should inspect all available tiers and flag conflicts or superseded configurations.

In Part 2, we will look at how Claude Code handles network errors during startup, and how disconnecting your network for twenty seconds completely turns off remote policies.