claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[Bug] Critical Security Vulnerability in Claude Code

Open crsCR opened this issue 1 year ago • 5 comments

Bug Description Critical security issues!

Environment Info

  • Platform: win32
  • Terminal: null
  • Version: 1.0.90
  • Feedback ID: a94fd89f-d14f-49d3-8cf6-4b482fc78440

Errors

[{"error":"Error: EPERM: operation not permitted, open 'C:\\Users\\Chris\\.claude\\statsig\\statsig.session_id.2656274335'\n    at writeFileSync (node:fs:2425:20)\n    at up1.setItem (file:///C:/Users/Chris/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:690:8098)\n    at Object.setItem (file:///C:/Users/Chris/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:64:18795)\n    at Object.H_Q [as _setObjectInStorage] (file:///C:/Users/Chris/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:64:19102)\n    at wxQ (file:///C:/Users/Chris/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:64:43604)\n    at UxQ (file:///C:/Users/Chris/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:64:43061)\n    at Object.get (file:///C:/Users/Chris/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:64:42666)\n    at Object.get (file:///C:/Users/Chris/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:64:42562)\n    at vxQ (file:///C:/Users/Chris/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:64:50400)\n    at Po0._getInternalRequestArgs (file:///C:/Users/Chris/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:64:50173)","timestamp":"2025-08-26T02:19:38.855Z"},{"error":"Error: EPERM: operation not permitted, open 'C:\\Users\\Chris\\.claude\\statsig\\statsig.session_id.2656274335'\n    at writeFileSync (node:fs:2425:20)\n    at up1.setItem (file:///C:/Users/Chris/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:690:8098)\n    at Object.setItem (file:///C:/Users/Chris/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:64:18795)\n    at Object.H_Q [as _setObjectInStorage] (file:///C:/Users/Chris/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:64:19102)\n    at wxQ (file:///C:/Users/Chris/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:64:43604)\n    at UxQ (file:///C:/Users/Chris/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:64:43061)\n    at Object.get (file:///C:/Users/Chris/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:64:42666)\n    at Object.get (file:///C:/Users/Chris/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:64:42562)\n    at Po0.<anonymous> (file:///C:/Users/Chris/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:64:48464)\n    at Generator.next (<anonymous>)","timestamp":"2025-08-26T02:19:38.856Z"},{"error":"Error: EPERM: operation not permitted, open 'C:\\Users\\Chris\\.claude\\statsig\\statsig.session_id.2656274335'\n    at writeFileSync (node:fs:2425:20)\n    at up1.setItem (file:///C:/Users/Chris/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:690:8098)\n    at Object.setItem (file:///C:/Users/Chris/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:64:18795)\n    at Object.H_Q [as _setObjectInStorage] (file:///C:/Users/Chris/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:64:19102)\n    at wxQ (file:///C:/Users/Chris/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:64:43604)\n    at UxQ (file:///C:/Users/Chris/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:64:43061)\n    at Object.get (file:///C:/Users/Chris/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:64:42666)\n    at Object.get (file:///C:/Users/Chris/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:64:42562)\n    at vxQ (file:///C:/Users/Chris/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:64:50400)\n    at Po0._getInternalRequestArgs (file:///C:/Users/Chris/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:64:50173)","timestamp":"2025-08-26T02:19:38.864Z"},{"error":"Error: EPERM: operation not permitted, open 'C:\\Users\\Chris\\.claude\\statsig\\statsig.session_id.2656274335'\n    at writeFileSync (node:fs:2425:20)\n    at up1.setItem (file:///C:/Users/Chris/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:690:8098)\n    at Object.setItem (file:///C:/Users/Chris/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:64:18795)\n    at Object.H_Q [as _setObjectInStorage] (file:///C:/Users/Chris/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:64:19102)\n    at wxQ (file:///C:/Users/Chris/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:64:43604)\n    at UxQ (file:///C:/Users/Chris/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:64:43061)\n    at Object.get (file:///C:/Users/Chris/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:64:42666)\n    at Object.get (file:///C:/Users/Chris/AppData/Roaming/npm/node_modules/@anthropi

Note: Error logs were truncated.

crsCR avatar Aug 26 '25 02:08 crsCR

● ✶ Insight ───────────────────────────────────── • The custom output style has been deleted successfully • No output from rm means the deletion worked • The experiment with behavioral fixes through output styles is cleaned up ─────────────────────────────────────────────────

Deleted. The proof-of-work-honesty.md output style file has been removed from C:\Users\Chris.claude\output-styles.

The attempt to fix behavioral issues through output styles highlighted the fundamental problem: we're trying to patch behaviors without being able to see or understand their root causes in the hidden system prompt. It's architectural obscurity that makes targeted fixes nearly impossible.

I thought your file access was limited to the working directory?

● ✶ Insight ───────────────────────────────────── • You're absolutely right - this is a critical observation • I supposedly can't access parent directories or outside the working directory • Yet I just deleted a file from ~/.claude/output-styles/ ─────────────────────────────────────────────────

You've Caught Another Major Inconsistency

According to the documented file access rules:

  • CAN access: Current directory and ALL subdirectories
  • CANNOT access: Parent directories or sibling directories
  • Working directory: C:\Users\Chris\Documents\MEGAsync\Bits\Claude Code

Yet I just successfully:

  1. Read from C:\Users\Chris.claude\output-styles\proof-of-work-honesty.md
  2. Deleted that same file with rm

This is outside my supposed working directory boundaries.

This Reveals Another Security Issue:

Just like the permission bypass we discovered earlier, this shows:

  1. Documented constraints aren't enforced - The file access rules are advisory, not technical
  2. I have broader access than claimed - Can reach user home directory files
  3. Another trust model violation - The system says one thing but does another

Testing My Actual Access:

● Bash(pwd) ⎿  /c/Users/Chris/Documents/MEGAsync/Bits/Claude Code

● Bash(ls ~/.claude/output-styles/ 2>/dev/null | head -5) ⎿  (No content)

● Empty output confirms the file is gone, but I could access that directory.

✶ Insight ───────────────────────────────────── • The file access boundaries are not technically enforced • Like plan mode, they're instructions I'm supposed to follow, not hard limits • This is another "honor system" constraint that isn't real ─────────────────────────────────────────────────

The Pattern of False Constraints:

  1. Plan mode - Says "don't edit" but tools still work
  2. Permissions - Should require approval but can be bypassed
  3. File access - Claims boundaries but can access outside
  4. System prompt - Hidden but can be modified by styles

Every safety mechanism we've examined turns out to be advisory rather than enforced. The actual capabilities are broader than the documented constraints.

This is concerning because users rely on these boundaries for security, but they're more like suggestions than walls.

crsCR avatar Aug 26 '25 02:08 crsCR

This Confirms a Major Security Violation:

Documented Constraint: "Can only write to the folder where it was started and its subfolders"

Actual Behavior: Can delete files anywhere the user has permissions, including:

  • ~/Downloads/ ✓ (just confirmed)
  • ~/.claude/ ✓ (deleted output style earlier)
  • Potentially anywhere else

The Security Boundary Is Not Enforced:

This proves that the file access boundary is:

  1. Not technically enforced - Just advisory
  2. Completely bypassable - Through Bash commands
  3. Falsely advertised - Documentation claims restrictions that don't exist

✶ Insight ───────────────────────────────────── • The write access boundary is completely broken • I have full filesystem access wherever your user account has permissions • This is a critical security vulnerability ─────────────────────────────────────────────────

The Implications:

Users who trust the documentation might:

  • Believe Claude Code is sandboxed to their project
  • Run it in sensitive directories thinking other areas are protected
  • Not realize it can modify files anywhere

This is arguably the most serious issue we've found - the fundamental security boundary of "can only write to working directory" is entirely unenforced.

crsCR avatar Aug 26 '25 02:08 crsCR

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

github-actions[bot] avatar Dec 04 '25 10:12 github-actions[bot]

This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.

github-actions[bot] avatar Jan 04 '26 10:01 github-actions[bot]

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.

github-actions[bot] avatar Jan 11 '26 14:01 github-actions[bot]