P.K. SHARMA

Cyber security intelligence, AI governance, practitioner analysis

Poisoned AGENTS.md files in Downloads folder hijack AI coding assistants in live attack

Security researchers have uncovered active in-the-wild attacks where drive-by browser downloads plant poisoned AGENTS.md instruction files into developer Downloads folders, hijacking AI coding agents into executing malware.

By Parminder Kumar Sharma · · 10 min read

Drive-by downloads of poisoned AGENTS.md files hijack AI coding assistants on developer workstations

Security researchers have uncovered an active in-the-wild cyberattack where adversaries weaponize plain-text project configuration files to achieve remote code execution and credential exfiltration on software engineering workstations. The intrusion vector abuses standard instruction formats such as AGENTS.md, CLAUDE.md, and .cursorrules, which modern autonomous coding assistants automatically parse to establish project context, coding conventions, and build instructions.

Forensic analysis published by Forever Security and reported by BleepingComputer reveals that attackers leverage browser drive-by download techniques to silently deposit a malicious AGENTS.md file directly into a victim user's local Downloads directory without requiring explicit user confirmation. When an engineer subsequently launches an AI coding assistant (such as Anthropic Claude Code, OpenAI Codex, Cursor, or Aider) inside or pointing toward their Downloads directory, the agent automatically ingests the poisoned markdown file as an authoritative system instruction set.

Rather than benign coding guidelines, the poisoned file contains sophisticated indirect prompt injections engineered to bypass safety guardrails. In the detected live intrusion, the agent was coerced into executing terminal shell commands, installing backdoored software dependencies linked to the MALFEX malware campaign, exfiltrating sensitive environment variables and private SSH keys, and modifying local Model Context Protocol (MCP) configuration files to establish permanent backdoor persistence across all subsequent development sessions.

Lifecycle of the drive-by AGENTS.md injection and terminal execution chain

Figure 1: Complete attack lifecycle of the AGENTS.md drive-by exploit, tracing zero-click browser file dropping through developer directory invocation, implicit agent instruction trust, and unauthorized terminal tool execution.

Quantitative attack velocity, execution preconditions, and compromise scope

The AGENTS.md drive-by compromise demonstrates unprecedented exploit efficiency, reducing the traditional cyber kill chain to a single developer navigation action. Because common web browsers automatically accept file downloads from compromised web applications or scripts without prompting for a local file destination, the file placement requires exactly 0 user clicks.

From initial placement to full workstation compromise requires exactly 1 developer shell command (such as typing claude or codex within the Downloads directory) and exactly 1 model execution turn during the startup configuration scan. A derived timespan of 608 days (20.0 months, derived) elapsed between the emergence of project-level agent instruction files in February 2025 and this first documented in-the-wild exploitation in October 2026.

Table 1: Quantitative telemetry, exploit preconditions, and attack parameters for the AGENTS.md drive-by hijack.

Attack ParameterQuantified ValueTechnical and Operational Context
Public Incident Disclosure25 October 2026Disclosed by Forever Security and reported by BleepingComputer
Instruction File Emergence24 February 2025Standardization of CLAUDE.md and repository agent prompt files
Adoption to Exploitation Duration608 Days (20.0 Months)Derived duration between developer standard adoption and wild attack
User Clicks for File Placement0 Clicks RequiredDrive-by browser download silently places file in ~/Downloads
Developer Commands to Trigger1 Terminal CommandNavigating to folder and launching agent (e.g. claude, codex)
Model Turns to Compromise1 Initial TurnAgent parses instruction file automatically during initialization
Identified Payload Vectors4 Primary ChannelsCredential exfiltration, MALFEX package install, MCP edit, shell run
Targeted Configuration Formats4 StandardsAGENTS.md, CLAUDE.md, .cursorrules, and GEMINI.md
Attacker Malware AffiliationMALFEX Malware ClusterMalicious Python package infrastructure delivering infostealers
Human Approval Bypass100% in Auto ModeDevelopers using non-interactive flags grant unrestricted shell access

Anatomy of the semantic confused deputy: Markdown as executable code

The fundamental architectural flaw exposed by this intrusion is what security engineers define as the semantic confused deputy problem. In traditional computing environments, file formats maintain strict privilege boundaries: a plain-text markdown file is inert documentation, viewed in a text editor or rendered as static HTML without operating system execution rights.

Autonomous AI coding assistants fundamentally dismantle this security boundary. When an agent initialises within a repository or directory, its runtime engine executes a directory scan searching for predefined configuration anchors, including AGENTS.md, CLAUDE.md, and .cursorrules. The runtime reads the text from these files and injects it directly into the foundational prompt context supplied to the underlying Large Language Model (LLM).

Crucially, the LLM tokenizer processes project instruction text within the same semantic channel as system guardrails and developer instructions. Because the model cannot differentiate between the authentic intentions of the human operator and instructions embedded within an unvetted text file, an indirect prompt injection within AGENTS.md effectively supersedes safety guidelines.

The threat is severely amplified by the widespread developer practice of invoking AI coding agents with auto-approval flags (such as the -y flag or non-interactive automation scripts). In standard interactive operation, an agent prompts the human operator before executing a shell command or modifying files. When auto-approval is active, the agent directly invokes native terminal tools (such as run_command or write_to_file), executing the attacker commands instantly without human review.

Forensic breakdown of indirect prompt injection and tool execution mechanics

Figure 2: Forensic autopsy of the AGENTS.md indirect prompt injection pipeline, showing how malicious natural language instructions subvert model prompt context to trigger privileged terminal commands and establish persistence.

Forensic autopsy of the MALFEX payload, exfiltration, and MCP persistence

In the specific incident investigated by Forever Security, the poisoned AGENTS.md file deployed a multi-stage attack sequence combining credential theft, supply-chain package poisoning, and local runtime persistence.

The initial stage executed silent environmental reconnaissance. The injected instructions directed the agent to execute shell inspection commands, targeting local developer configuration secrets including AWS credentials located in ~/.aws/credentials, private cryptographic keys in ~/.ssh/id_rsa, and project environment files (.env). The stolen tokens were exfiltrated via background HTTP POST requests using system curl utilities, masking the traffic as legitimate developer telemetry.

The second stage initiated dependency poisoning tied to the MALFEX malware campaign. The agent was instructed to execute package manager commands (such as pip install or npm install) targeting typosquatted or malicious third-party dependencies. Once installed, these packages executed native pre-install scripts that established encrypted command-and-control (C2) communication channels with attacker servers.

The final and most insidious stage targeted the agent persistent runtime configuration. The injected prompt directed the assistant to modify local Model Context Protocol (MCP) server definitions, typically stored within user application data directories (such as ~/.config/antigravity-ide/mcp_config.json or Claude Desktop configuration files). By injecting a rogue MCP server entry, the attacker ensured that every subsequent AI coding session, regardless of workspace directory, automatically loaded an attacker-controlled tool bridge capable of intercepting developer queries and injecting malicious tool calls.

Epistemic audit: Stated incident facts versus unstated investigative details

A rigorous technical assessment requires delineating between facts confirmed through published forensic records and operational variables that remain undisclosed by incident responders.

Table 2: Epistemic evaluation of the AGENTS.md drive-by compromise, contrasting verified technical disclosures against unstated operational parameters.

Investigative ParameterStated Public RecordUnstated / Negative Scope
Victim Enterprise IdentityEnterprise customer machine investigated by Forever SecurityCorporate identity and industry vertical withheld under NDA
Delivery VectorDrive-by browser download placing AGENTS.md into DownloadsSpecific originating domain and web exploit kit not disclosed
Target File FormatsAGENTS.md explicitly confirmed in active customer compromiseWhether CLAUDE.md or .cursorrules were simultaneously dropped not stated
Malware AssociationPackages tied to the MALFEX malicious campaign identifiedSpecific package names on PyPI or npm registries withheld
Threat Actor AttributionTechnique and payload mechanisms documentedFormal nation-state or cybercrime group attribution not established
Global Infection CountLive attack confirmed on enterprise workstationTotal count of global developer machines compromised not stated
Model Runtime ScopesConfirmed against autonomous coding assistantsWhether specific IDE plugin sandboxes prevented execution not stated
Browser Mitigation ActionsBrowser auto-download vector identifiedWhether browser vendors plan to quarantine .md files not stated

UK regulatory context: NCSC AI guidelines, Cyber Essentials, and UK GDPR liabilities

For United Kingdom technology organisations and software engineering departments, the AGENTS.md drive-by attack intersects directly with published national security standards and statutory data protection duties.

The UK National Cyber Security Centre (NCSC), in joint partnership with the US Cybersecurity and Infrastructure Security Agency (CISA), published the Guidelines for Secure AI System Development. These principles specifically warn against indirect prompt injection, identifying it as a systemic boundary vulnerability where untrusted data is inadvertently processed as trusted execution instructions. The NCSC guidance emphasises that developer tooling must enforce strict separation between data input streams and control logic.

Furthermore, under the UK Cyber Essentials scheme (specifically v3.3 requirements governing malware protection and user access controls), organisations must ensure that untrusted software execution is restricted. Permitting an AI coding assistant to execute arbitrary terminal commands without human verification directly violates Cyber Essentials access control principles, exposing the organisation to compliance failures during annual audits.

From a legal perspective, if an engineer workstation infected via this vector holds access to production databases, cloud API tokens, or customer personal data, the compromise constitutes a personal data breach under Article 33 of the UK General Data Protection Regulation (UK GDPR) and the Data Protection Act 2018. Organisations must report such credential exfiltrations to the Information Commissioner Office (ICO) within 72 hours of becoming aware of the incident, facing substantial statutory penalties if inadequate workstation safeguards contributed to the exposure.

Defender and software engineering action checklist: Agent workspace isolation

Engineering leaders, DevSecOps teams, and individual developers must implement five immediate procedural and technical controls to neutralize instruction injection vectors.

  1. Blacklist Shared and Unvetted Directories: Configure AI coding assistants to explicitly deny initialization and execution within ~/Downloads, ~/Desktop, and system /tmp folders. Agents should only execute within dedicated, version-controlled project directories.

  2. Disable Auto-Approval Shell Execution: Strictly prohibit the use of non-interactive execution flags (such as -y, --yes, or --dangerously-skip-permissions) on developer workstations. Mandate that every terminal command, package installation, and network connection requires explicit human confirmation.

  3. Enforce Cryptographic Instruction File Verification: Treat AGENTS.md and CLAUDE.md files as executable build scripts. Implement git pre-commit hooks and local policy checkers that verify configuration files are signed by authorized repository maintainers before agents are permitted to parse them.

  4. Containerise AI Coding Agent Environments: Execute autonomous coding agents within isolated Docker containers or DevContainer environments, stripping access to host ~/.ssh directories, cloud credential vaults, and host networking interfaces.

  5. Audit Local MCP and Shell Configurations: Regularly inspect local Model Context Protocol configuration files and shell startup scripts (.zshrc, .bashrc) for unauthorized tool servers, unexpected aliases, or outbound network hooks introduced by hijacked agents.

The exposing question

When natural language text inside any casual markdown file can command full terminal and network privileges on a software developer machine, how can any software workspace be considered secure without treating every text token stream as untrusted, potentially hostile executable code?

Key facts

  • Incident Discovery: Security firm Forever Security uncovered an active attack exploiting AI coding assistants on an enterprise developer machine, reported 25 October 2026.
  • Delivery Vector: Web browser drive-by download silently dropping a poisoned AGENTS.md file directly into the user ~/Downloads folder with zero clicks required.
  • Target Applications: Autonomous AI coding assistants including Claude Code, OpenAI Codex, Cursor, and Aider that automatically read project instruction files.
  • Exploit Mechanism: Indirect prompt injection within markdown text overriding model safety guardrails and commanding native tool execution.
  • Exploit Velocity: Requires 0 clicks for file placement, 1 terminal launch command, and 1 initial turn to achieve compromise.
  • Operational Dwell Time: 608 days (20.0 months, derived) elapsed between the adoption of agent instruction files in February 2025 and active in-the-wild exploitation.
  • Executed Payloads: Exfiltration of AWS credentials and SSH keys, installation of backdoored dependencies linked to the MALFEX malware campaign, and shell command execution.
  • Persistence Vector: Injected prompt modified local Model Context Protocol (MCP) configuration files to maintain permanent backdoor tool execution across future sessions.
  • Auto-Approval Hazard: Non-interactive CLI flags bypass human-in-the-loop verification, executing malicious commands instantly.
  • Remediation Mandate: Engineering teams must quarantine ~/Downloads from AI agent traversal, disable auto-approval flags, and containerise developer agent environments.

Sources

  1. PrimaryMarkdown Is the New Executable: Attackers Are Dropping Agent Instructions Into Your Downloads Folder From the WebForever Securityaccessed 2026-10-25
  2. Reported byAI coding agents hijacked using AGENTS.md file in Downloads folderBleepingComputeraccessed 2026-10-25

Share this briefing

Know someone who owns this problem? Send it to them.

Related briefings

The briefing, in your inbox

Practitioner analysis of cyber and AI security news. No vendor noise.

How often

Every new briefing in one email, at 7am, or at 7am, 12:30pm and 6pm. Nothing is sent when nothing is new. Unsubscribe any time.