LeituraPesquisaRadarFramework de investimento
Entrar / Cadastrar
← Voltar para a leitura
NotíciasTópico · Claude CodeMaterial3 min de leituraEditorial DisconfirmAI

Claude Code Wraps Commands in eval, Database Passwords Remain Visible in ps Output

V2EX user mysoko reviewed 253 Claude Code session records and found that 16 contained plaintext passwords. Reproduction tests showed that Claude Code wraps commands in a composite structure of source snapshots and eval; the parent shell process retains the full command line throughout execution, even though curl itself has already masked the password in child processes.

2026-11-03 18:24 GMT+8

V2EX user mysoko searched through Claude Code session records on their own machine: among 253 jsonl files, 16 instances featured patterns such as mysql -p passwords or curl -u user:pass. They then ran a test using Claude Code version 2.1.317 with a fake password in a curl command, while capturing ps output from a separate process, discovering that the exposure surface was broader than initially assumed.

Two processes appeared in the ps output. The lower line represents curl itself, where the password characters have been replaced with spaces—confirming that curl does perform this masking action. The upper line shows the zsh instance launched by Claude Code, which retains the entire command line including the password for as long as curl is running.

This discrepancy stems from differences in execution methods. If you manually type bash -c 'curl ...' to run a single command, bash will directly exec into curl, hiding this intermediate layer. However, Claude Code wraps commands within a composite structure of source snapshot && ... && eval 'your command'; because the shell must remain active until execution completes, the complete command line persists in the process table.

Beyond ps, commands are also written verbatim into jsonl session records located under ~/.claude/projects/. This requires extra attention on servers: under default Linux mount parameters, proc(5) states that 'everybody may access all /proc/pid directories,' meaning other users on the same machine can view your command lines. Environment variables differ in this regard, as reading /proc/pid/environ requires passing ptrace permission checks. Users sharing development machines or jump hosts should note this distinction.

Entrar / Cadastrar
LeituraPesquisaRadarFramework de investimento

mysoko provided a self-check regular expression that counts matches without printing content. Their results showed 16 affected sessions and 8 lines in shell history. They explicitly noted that the regex is coarse and prone to both misses and false positives, but any non-zero count warrants investigation. A workaround requiring no additional tools involves configuring ~/.my.cnf and ~/.pgpass separately with chmod 600 permissions, and adding a directive in CLAUDE.md or AGENTS.md stating that secrets should not appear in command arguments but rather use the client's own configuration files. Passwords that have already entered sessions must be changed immediately; deleting jsonl files is ineffective as the data has already been sent to the model.

They currently employ a custom tool called rootkey to create an isolation layer: instructing AI to execute rootkey run "order_db" --env-var PGPASSWORD -- psql ..., ensuring values only enter the environment variables of that specific subprocess, leaving only entry names visible in ps and session records. However, they acknowledge this is not a silver bullet: MySQL's official recommendation remains using configuration files with 600 permissions; malicious programs running under the same user can still read environment variables and files.

Fontes

  • v2ex.comV2EX↗
Tópico

Claude Code

Anthropic 的 AI 编码工具 Claude Code 近期被曝出多起涉及敏感凭证泄露的安全隐患。核心问题在于其执行命令的方式及上下文隔离机制:一方面,Claude Code 将用户命令包裹在 eval 结构中执行,导致父 Shel…

4 etapas1 peçasAtualizado 2026-11-03 23:06

Como chegamos aqui

  1. 2025-09-30GitHub 用户 dev-kimke 报告 Claude Code (Sonnet 4.5) 生成了未提供的 MySQL 密码字符串,怀疑存在跨用户数据泄露或模型幻觉。github.com ↗
  2. 2026-06-29GitHub 用户 acosmi-fushihua 报告在 Claude Code 会话中出现另一台服务器的 root 密码,并导致对该第三方生产数据库的非授权修改。github.com ↗
  3. 2026-08-05Novee Security 在 Black Hat USA 2026 披露 CVE-2026-54316,展示如何通过 GitHub Issue 注入指令,利用 Claude Code 预批准的 Hugging Face 访问权限外泄 CI 密钥。swarmproof.github.io ↗

O que ainda está indefinido

  • Anthropic 是否计划修改 Claude Code 的命令执行封装方式(如避免在父 Shell 中保留完整命令行)以从根源解决本地 `ps` 泄露问题?
  • 针对 GitHub Issue #72274 等报告的跨会话凭证混淆,Anthropic 是否确认存在真实的后端数据隔离缺陷,还是确认为模型幻觉?
  • 除了更新版本,Anthropic 是否会提供更自动化的工具来扫描和清理历史会话日志(~/.claude/projects/)中已存在的明文密码?
Ler o tópico completo →
Continuar pesquisando →