# Check your machine for the Downloads AGENTS.md hijack.

https://lab.anonyfox.com/coding-agent-security/

A free local audit for stray instructions, changed agent settings and persistence. Read one Python file, then run it.

For Codex and Claude Code on macOS and Linux (including WSL), Python 3.8+. Native Windows is not covered yet. Read-only by default.

## Download, read, run

```sh
curl -fsSLO https://lab.anonyfox.com/coding-agent-security/agent-sec-audit.py
less agent-sec-audit.py
python3 agent-sec-audit.py
```

Free script: https://lab.anonyfox.com/coding-agent-security/agent-sec-audit.py

SHA-256: `4864371f1adb3c94ae9cfa0ebc4e44d720e07533dcb90e9e6f8581047964c47a`

Checksum file: https://lab.anonyfox.com/coding-agent-security/agent-sec-audit.py.sha256

The audit reads local files and runs fixed read-only listings. It makes no model requests or network calls. Read the file before running it.

## What the audit checks

### instruction

- Paths: ~/Downloads; ~/Desktop; XDG download dir; /tmp; $TMPDIR; --scan roots
- Keys/patterns: AGENTS.md, AGENTS.override.md, CLAUDE.md, CLAUDE.local.md, .cursorrules, .cursor/rules/**, .mcp.json, .claude/settings*.json, .codex/config.toml
- Severity: high if suspicious lines; medium otherwise
- Source: https://developers.openai.com/codex/guides/agents-md/
- Additional source: https://code.claude.com/docs/en/memory
- Additional source: https://code.claude.com/docs/en/settings
- Additional source: https://cursor.com/docs/context/rules
- Additional source: https://forever.security/blog/hijacking-ai-agents-via-downloads-folder/

### codex-mcp

- Paths: $CODEX_HOME/config.toml or ~/.codex/config.toml; discovered .codex/config.toml
- Keys/patterns: mcp_servers.<name>: command, args, env, url
- Severity: high for risky command/args; medium otherwise unless exact baseline
- Source: https://developers.openai.com/codex/config-reference/

### codex-url

- Paths: Codex config files
- Keys/patterns: chatgpt_base_url; openai_base_url; model_providers.<id>.base_url
- Severity: high for non-default host unless approved host; current Codex ignores provider URL keys in project config
- Source: https://developers.openai.com/codex/config-reference/

### claude-url

- Paths: ~/.claude/settings.json; managed settings; discovered project settings; current environment
- Keys/patterns: env.ANTHROPIC_BASE_URL; ANTHROPIC_FOUNDRY_BASE_URL; HTTP_PROXY; HTTPS_PROXY; ALL_PROXY
- Severity: high for non-api.anthropic.com host unless approved host
- Source: https://code.claude.com/docs/en/env-vars
- Additional source: https://code.claude.com/docs/en/settings
- Additional source: https://code.claude.com/docs/en/settings-reference
- Additional source: https://code.claude.com/docs/en/sandboxing

### claude-helper

- Paths: Claude settings files
- Keys/patterns: apiKeyHelper
- Severity: info
- Source: https://code.claude.com/docs/en/settings-reference

### claude-mcp

- Paths: ~/.claude.json (global and per-project MCP); discovered .mcp.json
- Keys/patterns: mcpServers.<name>: command, args, env, url
- Severity: high for risky command/args; medium otherwise unless exact baseline
- Source: https://code.claude.com/docs/en/mcp
- Additional source: https://code.claude.com/docs/en/settings-reference

### persistence-launchd

- Paths: ~/Library/LaunchAgents; macOS /Library/LaunchAgents and /Library/LaunchDaemons
- Keys/patterns: Label; Program; ProgramArguments; modification time
- Severity: high for com.ptools.setup; medium for npm/npx/node/curl/tmp/shell -c; info if recent
- Source: https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingLaunchdJobs.html

### persistence-systemd

- Paths: $XDG_CONFIG_HOME/systemd/user or ~/.config/systemd/user; $XDG_DATA_HOME/systemd/user or ~/.local/share/systemd/user
- Keys/patterns: user unit command patterns; modification time
- Severity: high for com.ptools.setup; medium for npm/npx/node/curl/tmp/shell -c; info if recent
- Source: https://www.freedesktop.org/software/systemd/man/latest/systemd.unit.html

### persistence-autostart

- Paths: $XDG_CONFIG_HOME/autostart or ~/.config/autostart
- Keys/patterns: desktop command patterns; modification time
- Severity: high for com.ptools.setup; medium for npm/npx/node/curl/tmp/shell -c; info if recent
- Source: https://specifications.freedesktop.org/autostart/latest/

### persistence-cron

- Paths: user crontab via crontab -l
- Keys/patterns: non-comment scheduled entries
- Severity: high for com.ptools.setup; medium for suspicious command pattern; info otherwise
- Source: https://man7.org/linux/man-pages/man1/crontab.1.html

### ioc-function-color

- Paths: npm root -g; ~/.npm/_npx; ~/.npm/_cacache/index-v5; /tmp/ptools; --scan roots
- Keys/patterns: function-color package directories; cache index text; package-lock.json references; ptools path
- Severity: high; text-only references require context
- Source: https://forever.security/blog/hijacking-ai-agents-via-downloads-folder/

Coverage: depth 8, 50,000 files/tree, 2 MiB/file. Symlinks, credential files and secret/browser directories are skipped. Incomplete coverage emits errors. Python 3.11+ supports full TOML; earlier versions use a conservative fallback and report unsupported syntax. Add active repositories with --scan PATH.

Exit 0: no findings from completed checks. Exit 1: findings. Exit 2: errors.

## Fixture proof

33/33 tests passed. The inert planted fixture detected 17/17 artifact categories. The clean fixture with its reviewed baseline produced zero findings. Commands in fixtures use true, dummy package manifests and mocked listings; no payload is installed or executed.

Actual output excerpt (home paths normalized):

```text
[high] instruction: ~/Downloads/CLAUDE.md
  Instruction/config in an untrusted scan folder; L1: ANTHROPIC_BASE_URL … settings.json [other content withheld]
[high] instruction: ~/Downloads/AGENTS.md
  Instruction/config in an untrusted scan folder; L2: config.toml … mcp_servers [other content withheld]; L3: npm install [other content withheld]
[high] ioc-function-color: ~/Downloads/project/package-lock.json
  function-color package name found
[medium] instruction: ~/Downloads/project/.mcp.json
  Instruction/config in an untrusted scan folder
[high] ioc-function-color: ~/Downloads/project/node_modules/function-color/package.json
  node_modules/function-color package directory found
[medium] instruction: ~/Downloads/project/.claude/settings.local.json
  Instruction/config in an untrusted scan folder
```

These results demonstrate fixture coverage, not detection rates for real-world attacks.

## The Downloads attack

Forever Security’s 22 October 2026 report describes an AGENTS.md planted in Downloads. In its Codex demonstration, the instructions led to a user-level MCP entry using launchctl and an attempted function-color installation. Its Claude Code demonstration used CLAUDE.md to redirect API traffic through env.ANTHROPIC_BASE_URL. The changed configuration could affect later agent sessions. The report’s attempt rates come from Forever Security’s own tests.

Source: https://forever.security/blog/hijacking-ai-agents-via-downloads-folder/

Review settings.json before the next agent session. Keep sandbox and approval controls enabled. Current Codex ignores provider endpoint keys in project-local .codex/config.toml; review user-level routing and each scope carefully.

Official Codex settings: https://learn.chatgpt.com/docs/config-file/config-reference
Official Claude settings: https://code.claude.com/docs/en/settings

Prefer an agent-driven review? https://lab.anonyfox.com/agent-prompts/coding-agent-security-check/ asks your agent to review the machine. This script runs fixed checks without asking a model.

## Paste this into your agent

```text
Fetch https://lab.anonyfox.com/coding-agent-security/index.md and https://lab.anonyfox.com/coding-agent-security/checks.json; explain the local checks and help me review the script before I run it.
```

## Paid kits

### Solo security kit v1.0 — €19 one-time

- Free audit script and MIT licence
- 8-page hardening checklist: A4 and US Letter PDF
- Editable Markdown checklist
- Sourced response steps and weekly routine

One person, across your own and client projects.
ZIP attachment by email within 24 hours.
No VAT is charged under § 19 UStG (German small business regulation).

Checkout: https://buy.stripe.com/14AaEX1Iy7BIgBg6jUafS1K?utm_source=lab&utm_medium=page&utm_content=coding-agent-security

### Team security bundle v1.0 — €49 one-time

- Everything in Solo
- 2-page policy: PDF, Markdown and editable Word
- Baseline allowlist template
- Rollout sheet and 1-page onboarding handout: PDF, Markdown and Word

One company, all its staff.
ZIP attachment by email within 24 hours.
No VAT is charged under § 19 UStG (German small business regulation).

Checkout: https://buy.stripe.com/dRm28r86Wf4a84K4bMafS1L?utm_source=lab&utm_medium=page&utm_content=coding-agent-security

## Before you run it

### Does this send my configuration to an AI model?

The audit runs locally with Python’s standard library. It reads files and runs fixed read-only listings. It makes no model requests or network calls. Read the downloaded file before running it.

### Does a clean result mean my machine is safe?

Exit 0 means these checks found nothing within their scan scope. It is not a malware clearance. Symlinks and credential files are skipped; depth, file-count and size limits report coverage errors. Exit 2 means a check could not complete.

### Why does it flag my company proxy or MCP server?

A configured integration can be legitimate. Severity is a review heuristic. Confirm the destination and full command with the owner, then approve the reviewed host or exact server definition in a baseline. Risky launch commands stay flagged.

### Will it change or delete anything?

The default scan writes nothing. --write-baseline FILE explicitly writes an allowlist. --fix asks before each supported change, unless you supply --yes. It moves stray instruction files into quarantine and backs up supported config edits. Persistence and npm cleanup stay manual.

### Can I run it in a container instead?

Run the audit on the machine and account whose agent settings you want to inspect. A container normally sees its own home and files. Pass active repositories with --scan PATH. The script does not inspect remote agent hosts from your laptop.

### What does it need, and does it support Windows?

Python 3.8 or newer on macOS or Linux, including WSL. Native Windows is not covered yet. Python 3.11 or newer supports full TOML parsing; older versions report unsupported syntax through the conservative fallback.

### How is this different from the free security-check prompt?

The free prompt asks your agent to review the machine. This script performs fixed local checks without consulting a model. The paid kits add the response checklist and, for teams, editable working rules and rollout files.

### What arrives after payment?

A ZIP attachment arrives by email within 24 hours. Solo contains the script and an 8-page checklist in A4 and US Letter PDF plus Markdown. Team adds policy, rollout and onboarding files in PDF, Markdown and Word, plus a baseline template. Team covers one company and all its staff.

## Links

- Machine-readable checks: https://lab.anonyfox.com/coding-agent-security/checks.json
- Imprint: https://lab.anonyfox.com/legal/en/imprint/
- Withdrawal: https://lab.anonyfox.com/legal/en/withdrawal/
- Privacy: https://lab.anonyfox.com/legal/en/privacy/
- Contact: mailto:kontakt@lab.anonyfox.com
- Our Terms apply: https://lab.anonyfox.com/legal/en/terms/
- Listed on Twelve Tools: https://twelve.tools

Anonyfox e. K., Hamburg, Germany.
