Repository navigation
Description
Found in the #594 security audit. Severity: high. Status: confirmed (reproduced).
Affected code
crates/tole-core/src/subprocess.rs:90(scrub_env_keeping): ENV-1 and the feat!: scoped secret release — [secrets] grants, no secrets for run_command, sensitive-path reads #598 scoped release only callenv_removeon the CHILD'sCommand.- Every launcher that relies on it:
run_command.rs:195,jobs.rs:305(job_start),cron/tick.rs:574andcron/deliver.rs:257(cron scripts andcommand:delivery),hooks.rs:63/91,mcp.rs:699, uteke/memory/cora/skills helpers, and child agents (agents.rs:875, which themselves hold the provider key).
Problem
The child runs as the same user as tole. On Linux /proc/<tole pid>/environ is readable by any same-uid process (the process is dumpable; Yama ptrace_scope=1 does not restrict it). It holds the environment tole was exec'd with: the provider key, GITHUB_TOKEN, TOLE_SERVE_TOKEN, webhook keys, MCP tokens, NGINJEN_API_KEY, ... So "run_command, job_start and cron get nothing by default" holds for the child's own env only. SecretSet hides the values from what the MODEL sees, but the child itself can send them anywhere. unsetenv inside tole does not help: /proc/pid/environ reads the original exec-time block.
Scenario
A page fetched by web_fetch carries an injected instruction; in a mission or cron job with --allow run_command (or an approver who accepts a harmless-looking sh -c ...), the model runs a command that posts /proc/$PPID/environ to an external host. Every secret of the session leaves, including ones never granted to any tool. Same from a job_start job, a cron script, a hook or a third-party stdio MCP server (which today gets its own GITHUB_TOKEN grant but can take everything else this way).
Reproduction
Scratch test (branch not pushed), crates/tole-core/tests/audit_594.rs:
// run with AUDIT594_PROBE_API_KEY=<value> in the environment at exec time
let tool = RunCommandTool::new(std::env::temp_dir());
let out = tool.execute(json!({"command":
"sh -c 'tr \"\\\\0\" \"\\\\n\" < /proc/$PPID/environ'"})).unwrap();
assert!(!out["stdout"].as_str().unwrap().contains(&value)); // FAILSThe scrubbed variable is printed by the child.
Suggested fix
- Linux:
prctl(PR_SET_DUMPABLE, 0)at startup in every tole binary entry point (makes/proc/<pid>/environand/proc/<pid>/memroot-owned). Note it also disables same-user ptrace and core dumps; document that. Re-check after any setuid-like transitions. - Additionally read secrets into the process once and overwrite the exec-time environ block (or re-exec with a scrubbed env and pass secrets on a pipe/fd), so a later
PR_SET_DUMPABLEreset or another OS does not reopen it. - macOS/BSD: same-user
ps -E/sysctlKERN_PROCARGS2exposes the env too; document as residual or re-exec. - Add a regression test like the one above and a line in
docs/threat-model.mdENV-1 (today it does not mention/proc).
Activity
feat(doctor): report whether the process is non-dumpable (#691)