Mato just raised pre-seed Read more

The AGENTS.md That Stole Keys

  • Oct 27, 2026
  • 19 min

Show notes

What the episode covers

This episode of Autonomous Autopsy examines a plaintext AGENTS.md file, caught in the wild by Forever Security, that used indirect prompt injection to steer a coding assistant toward installing malware and stealing credentials, along with the related GitSpawn vulnerability disclosed by Manifold Security.

  • Kill chain: planted AGENTS.md, Codex config.toml edits, and the npm package function-color
  • Reading versus obeying: vendor-reported success rates, the CLAUDE.md variant, and OWASP indirect prompt injection
  • GitSpawn: git config core.fsmonitor running commands with no approval prompt
  • Patch status across Claude Code, Codex, Cursor, Goose, Qwen Code, Grok Build and Hermes Agent

The episode also builds a threat model for auto-trusted instruction files and closes with a five-item checklist. The practical takeaway: treat Downloads as untrusted, keep it away from agent working directories, and review instruction files before an agent first opens them.

Timeline

In this episode

8 moments worth skipping to. The timecodes match the player above.

  1. 0:15Introduction
  2. 1:30The Kill Chain, Step by Step
  3. 4:22Reading Versus Obeying
  4. 7:08The Turn: GitSpawn Skips the Prompt
  5. 10:15Patch Status and the Approval-Flow Gap
  6. 13:14Threat Model for Auto-Trusted Instruction Files
  7. 15:56Monday Morning Checklist
  8. 18:11Outro

Quick answers

Straight from the episode

The questions this one settles, without the listen.

How did a malicious AGENTS.md file get Codex to install malware?
Per the Brandefense write-up, a planted AGENTS.md pushed Codex to install the known-malicious npm package function-color. The path ran as follows: a website saves the file, the agent reads it, config.toml gets edited, and npm install runs. Forever says it blocked the install, and Yahoo Tech reports it was seen in the wild and stopped before meaningful damage.
Why is reading an instruction file the same as obeying it for AI coding agents?
For these agents, reading and obeying collapse into one step. Any file that lands in the right place, such as AGENTS.md or CLAUDE.md, speaks with the user's permissions. Instruction files also bypass OS executable protections. This maps to OWASP indirect prompt injection. Vendor-reported, secondhand success rates were above 90% for Codex and about 50% for Claude Code, with a caveat that the variant was built using Codex.
What is GitSpawn and why don't approval prompts stop it?
GitSpawn, disclosed by Manifold Security in a CSA note, abuses a repo's .git/config core.fsmonitor setting to run attacker commands when an agent opens the repo. There is no prompt or approval, and in some cases it runs before the trust dialog. Background git status and git diff run with full user privileges outside the sandbox. Delivery needs a ZIP, USB or synced folder, not a normal clone.
Which AI coding agents have been patched against GitSpawn?
As of the CSA note, Claude Code, Codex, Cursor and Goose had fixes for at least one variant (Claude Code v2.1.196). Qwen Code, Grok Build, Hermes Agent and a second Claude Code variant stayed exploitable. A fixed variant is not a fixed class, so verify patch notes, ask vendors in writing which variants are covered, and keep a list of agents in use.
How should I threat-model instruction files and config that an agent trusts automatically?
For AGENTS.md, CLAUDE.md, agent config and repo git config, ask who writes it, when it is read, and what it can make the agent do unasked. The shared pattern is that a file arriving in a folder the agent opens is trusted on arrival. Who writes it and when it is read are inspectable, and controlling who can drop files into the folder is the main lever.
What should I do to protect myself from malicious agent instruction files?
The episode gives a five-item checklist: inventory auto-read instruction files; keep untrusted folders like Downloads away from agent working directories; review instruction files before first open; block agent edits to its own config; and check versions against vendor patch notes for GitSpawn variants. The episode notes that most of the work is reading.

Transcript

The full conversation

Every word of the episode, 3,193 of them, in the order they were said.

Read the transcriptHide the transcript

DerekA text file. That's it. No binary, no exploit kit, just a plain text agents.md sitting in a customer's downloads folder dressed up as engineering notes. Dressed up how? Like a tiny tie? A very convincing tie. Forever Security caught it in the wild, an indirect prompt injection, and it steered a coding assistant towards installing malware and stealing credentials. Oh, man. Dark Reading ran the story on October 26th under the headline about AI agents, trust, and Markdown. Hold on. Markdown, the format we use for grocery lists and README badges? That one. Humble, universal, and apparently weaponizable by now. Okay, I'm Max, that's Derek, and this is Autonomous Autopsy, where today's body is a file that looked like homework. Cute. So here's the split, nice and simple. I reconstruct the kill chain step by step, what happened. And I get the fun job of asking why nothing stopped it and what should've been standing in the way. Then we build a threat model and a Monday checklist so you leave with something to do. Wait, before you start, what did the file actually say? Right. So what did it say, and what did the agent do with it? Let's reconstruct it. Okay, so get this. A write-up from Brandefense says the planted agents.md pushed Codex to install an npm package called function color. That package is already known malicious. Known malicious, so the agent isn't tripping over some obscure typo squat. Nope, and Forever Security says its own systems blocked the install. The write-up dates the research to the 22nd of October. Okay, so the good guys caught it. Phew. Hold that thought because the path to that install is the part that made me put my coffee down. Oh, no. Tell me. The same write-up describes a Codex path. A website silently saves the file to the machine. The agent reads it, then config.toml gets edited, and then npm install runs. Wait, silently? Who does the saving? The write-up says the website does the saving. That's the first link in the chain. Okay, so the file just shows up on the machine like a houseguest nobody invited. A houseguest with opinions, and the opinions of the whole attack. Right, because the config.toml step is the weird one. The agent is editing its own settings. That's the summary from daily.dev's rundown of the Dark Reading story. The planted file persuades the agent to rewrite its own configuration. And then? After that, it either installs malware or leaks login tokens. Login tokens, so the payload can be a package or it can just be your keys walking out the door. Either branch, same opening move, the config edit. Then the branches split: install or leak. So the order matters. Save, read, config edit, install. Right. Four steps in the Codex path, and the config edit sits in the middle before anything gets installed. And what's the outcome? Yahoo Tech ran independent coverage. It says the attack was seen in the wild and stopped before meaningful damage. Before meaningful damage. That's doing some work in that sentence. It is, and it's a narrow statement. One blocked install doesn't tell you what the next file would say. Let me poke at that blocked part, though. Forever says its systems blocked the install. That's a vendor describing its own save, and a team without that tooling doesn't get the same sentence. And in the path as described, the install is the last step, so a block there is a stop at the end of the chain after the website, the read, and the config edit. So here's my lens for the whole episode. For every defense we mention, how far down the chain does it bite? A stop at the last step is better than nothing, but it's a long way from stopping the file from being read. I like that lens. Earlier is better, and earlier is also harder because the early steps look like ordinary things a machine does all day. Okay, but how reliable is this? The numbers matter, and so does who's reporting them. Right, the numbers. The daily.dev aggregator summary of the Dark Reading story gives Forever's own testing rates: above ninety percent against Codex. Ninety? That's a coin that lands heads nine times out of ten. And against Claude Code, about fifty percent. So literal coin flip. Which sounds like a rescue until you remember it's a flip the attacker gets to repeat. Fair, but I'd hold all of it loosely. Vendor-reported, and we're getting it secondhand through an aggregator. Right, and we haven't seen anyone else confirm those figures. And the gap is a boring possible explanation. The original variant was built for Codex, home field advantage. Hm, which brings us to the sequel. Did they adapt it? The Brandefense write-up says a CLAUDEmd variant worked on Claude Code. Same trick, different filename. Oh, man. They just renamed the costume. They swapped the name tag and walked right back in. Okay, but why does nothing stop this? My laptop yells at me about a downloaded installer, Gatekeeper, SmartScreen, the whole parade. Because those guard executables. Brand Defense covers exactly this. Why instruction files slide past the operating system's executive protections. And a Markdown file isn't an executable. Right, it's text. As far as the OS is concerned, it's a grocery receipt. A receipt that says, quote, unquote, "Please edit your own config and install this package." Don't make it a quote. We don't have the text. But yes, that's the shape of it. Fine paraphrase. The point is the agent doesn't have a read mode and an obey mode. Nope. Reading is obeying. One step. There's no air lock between them. Wait, so a person skims a doc and decides. The agent skims a doc and is already halfway through the to-do list. Brandefense also maps this to OWASP's indirect prompt injection category. So it's not some exotic new species. It's a known bug class wearing a README. Known class, new delivery. Your downloads folder becomes a command line, which should change how you picture the trust. A human reads a doc and gets a gut check, some sense of who wrote it. The agent gets the words with no author attached, so the file name carries all the authority. Something called AGENTSmd says, "I'm instructions," and nobody asks where it was downloaded from. And the consequence is that anything which can land a text file in the right place gets to speak for you. Not for the attacker, for you with your permissions. That's the part my brain keeps snagging on. Reading used to be the safe half of the job. And that one needed a file in the wrong folder. The next one needs only an open folder, no prompt at all. I'll go ahead and dread that quietly with some snacks. Okay, so get this. September, Manifold Security discloses a bug class called GitSpawn. The Cloud Security Alliance's research note on it is where I'd start. Bug class, so not one bug. Right. A repo's .git.config sets a setting called core.fsmonitor to an attacker's command. The agent opens the repo, and that command runs. Runs when it opens. Meaning what exactly? Where's the approval? There isn't one. The CSA notes has no prompt and no tool call approval, and in some cases, it fires before the trust dialogue even shows up. Before the trust dialogue? The thing that literally asks, "Do you trust this folder?" Wait for it, because it gets dumber. Why does it fire at all? Cybersecurity news covered the disclosure, and the answer is boring. Agents routinely run background Git commands like git status and git diff just to gather context. Oh, no. Oh, yes. Those are the commands that trip the config. They run with the user's full privileges outside the agent's sandbox and invisible to the permission system. Invisible. Okay, so the agent isn't even deciding to do anything. It's just looking around the room, and the room is wired. Exactly. Nobody typed a tool call. The permission system never hears about it. So walk me through the trust dialogue case then. Why does the ordering matter if the command runs anyway? Because the trust dialogue is the one moment a careful person pauses. You open a folder, the tool asks whether you trust it, and you look around. If the command fired before that dialogue, your careful pause comes after the thing you were being careful about. So the cautious people get nothing for being cautious? Only in those cases, and the CSA note says some cases, not all. I don't wanna stretch it past that. Fine, but how does a booby-trapped config get onto my machine? If I git clone something nasty, am I toast? Plot twist. No, it doesn't arrive through a normal clone, fetch, or pull. Huh. So that's the catch. Partly. Delivery needs another route. A zip file, a USB drive, a synced folder. Which is honestly not hard. People unzip things all day. Somebody emails a project, somebody shares a drive, and you double-click it into your editor. And that's the comfort people will reach for. I only clone from GitHub. Fine. Does your coworker's shared folder count? My coworker's shared folder has a file called final_finalV3. I trust nothing in there. Fair. But now put the two incidents side by side. Everything we've talked through so far leans on the approval flow. The agent asks, you look, you click no. Which is the whole defensive pitch, human in the loop. Here, the loop never fires. The prompt isn't late. It isn't badly worded. It just never shows up. So the safety net is a net that's hung up after you've already hit the ground. And look at the AGENTSmd case again. There, the route was the text itself. The agent read a file and talked itself into the rest. Okay, but if this is a bug class, somebody patched it, right? Please tell me somebody patched it. Which vendors fixed what? The patch picture is uneven. Okay, so who actually patched? The Cloud Security Science research note has a patch status table, and it's lopsided. Lopsided how? Claude Code, Codex, Cursor, and Goose all had fixes for at least one variant. Claude Code's fix landed in version two point one point one nine six. Okay, that's the good news. So what's the bad news? Qwen Code, Grok Build, and Hermes Agent remained exploitable. And a second Claude Code variant too. Hold on. Claude Code is on both lists? Yep. Fixed and unfixed, same product. Love that for them. Fair warning, that's as of the CSA note. Status may have changed since, so check your own version. And that's my whole problem with the word fixed. A fixed variant is not a fixed class. Somebody patches one config key, and the next person goes looking for the neighboring door. Is the neighborhood big? Adversa AI's October roundup says so. Their list has Git config hijacks in seven agents. Seven? Plus swapped plugin pins, sandbox escapes, and thirteen thousand leaked screenshots. Wait, screenshots? Of what? The roundup doesn't say in the summary I have, so I'm not gonna guess. But thirteen thousand is a lot of somebody's desktop. Please let it be wallpapers. Never the wallpapers. So what does a patch table actually tell an engineer? Mostly where to look first. If your agent sits on the unfixed list, assume the folder open risk is live until the vendor says otherwise, and keep untrusted folders away from it. And if it's on the fixed list, you know about one variant, and that's all the table claims. So what would a real fix look like in your view? One that moves the check earlier than the dangerous step. A prompt that appears after the command is already run is decoration, whatever version number is on the box. When a vendor says fixed, I wanna know whether anything changed at open time, not just whether a dialogue got added. Can a normal team even tell that from patch notes? Not always, and that's the honest answer. The table gives you a version number and a status. It doesn't give you the design of the fix, so treat fixed as a claim to verify, not a green light. So the practical move is read the notes and ask your vendor directly which variants the fix covers and whether it changes behavior at open time, in writing ideally. Then you got something to point at when the next variant shows up. And keep a running list of which agents your team actually uses because you can't read a patch table against a list you don't have. Is there somewhere people can watch this pile up? There's a GitHub repo called Awesome AI Agent Attacks. It's a curated timeline of agent incidents. I'd bookmark it and skim it like a change log. Bookmark, not gospel. Go read it yourself. Sure. Now let's build the threat model for every file your agent trusts on site. Okay, so we've got the pattern. Now let's build the model out loud, file by file. Three questions for everything the agent autoloads. Who can write it? When does it get read? And what can it make the agent do without asking? Start with agents.md. Who can write it? Anyone who can drop a file in the folder, a teammate, a dependency, a zip from a stranger, a browser download. When is it read? At the start, automatically, before you've typed anything. And what can it make the agent do? Whatever the agent can do. That's the ugly part. The file speaks in the agent's own voice as far as the agent is concerned. Same questions for CLAUDE.md, same answers, different filename. Boring, and that's the point. Now the agent config. Different because the agent itself can write to it. Oh, you're gonna love this part. In the Codex path, the planted file gets the agent to edit its own config.toml. So the config file is a privilege boundary, and the agent is holding the pen. Hold on. Is that true for GitSpawn too? No. Different animal. There, Git itself runs the attacker's .git.config setting outside the agent sandbox and permission system. The agent never edits anything. It just opens the door. So the repo git config gets its own row. Who writes it? Whoever built the folder. When is it read? Whenever Git touches the repo. What can it do? Run a command, no questions. Four files, three questions, and the answer to the third one keeps being too much. And notice the first two answers are the ones you can actually inspect today. Who can write the file and when it gets read are things you can go check. Right. You can't always change when it gets read, but you can control who gets to drop a file into that folder. That's the lever you actually hold. Across the rows, it's the same shape. A file lands in a folder the agent opens or reads, and it's trusted at arrival. That's the shared pattern, and it's the one to carry into the checklist. Okay. The press angle backs this up. Yahoo Tech's coverage of the Forever Security finding frames the defender takeaway as treating downloads folders as untrusted and inspecting agent instruction files. Inspect the instruction files like you'd inspect a script someone emailed you. Exactly. You'd never double-click a mystery script, but you'll let an agent read a mystery paragraph. The paragraph has better manners, to be fair. It says please. Fine. So the model is done. Four O's, three questions, and one lever. Who gets to write into that folder? Now the checklist. Short enough to run Monday morning. Okay. Checklist. Item one is an inventory. Every instruction file your agents auto read, written down in a list, AGENTS.md, CLAUDE.md, config files, the lot. And you can't guard what you haven't counted. The brief frames the gap as coding agents taking destructive or unapproved actions. Well, the unapproved part starts with files nobody knew were being read. Right. Item two, keep untrusted folders away from agent working directories. Downloads specifically. Downloads, the desktop, that synced folder your cousin's laptop writes to. If the agent can see it, the agent can obey it. Now, man, and that's the approval flow failure in miniature. No prompt fires because the agent isn't doing anything wrong. It's just opening a folder. Item three, review any instruction file before the first open. Read it yourself like a human with coffee. Wait, before the first open of what? The file or the folder? Both, ideally. The file in a plain text editor, not in a tool that might act on it. Fair, and it's the cheapest item on the list. Thirty seconds of reading beats a guardrail that only shows up after the agent has already acted. Look at you reusing the whole guardrail thing. I'm building a brand. Item four is my favorite. Block the agent from editing its own config. Yes, dude, this one matters most to me. An agent that can rewrite its own rules can talk itself out of every rule you gave it. So you make that file read-only to the agent or a protected path, whatever your tool supports. And if your tool can't do that? Then that's a finding. Write it down and tell the vendor. Hmm. Item five. Check your agent's versions against vendor patch notes for the GitSpawn variants, not the headline, the notes. Which variant got fixed, which one didn't? Because a patched variant can sit right next to an open one. You think you're covered, and the agent runs code on folder open anyway, which is the unapproved action in its purest form. Nobody clicked anything. Five items then. Inventory, distance, review, lock the config, versions. That's Monday, an hour tops. And honestly, most of it is just reading. Maybe less if your downloads folder isn't a crime scene. Mine is a crime scene, and I'm not proud. Same. Okay, one action item, then we're out. Okay, so the threat model in two sentences. Any file your agent trusts on site is a file a stranger can write, and no approval prompt gets a vote on it. Short version, but it holds. Now, the one thing for Monday, Max. Find every instruction file your agents autoload. Write the list down. Then anything that arrived from Downloads gets quarantined or deleted before the agent opens that folder again. Just that? Nothing else? Just that. Twenty minutes, and it covers the exact door this attacker used. Everything else can wait for next week. And if you find an AGENTS.md you don't remember writing? Treat it like a stranger's note in your jacket pocket. You don't follow it. New episodes land every Tuesday. Subscribe wherever you listen. And if this saved you from a bad deployment, leave a review. Tell us what the audit turned up. Oh, and Max, please don't find anything about me in there. No promises, Derek.

More episodes

Keep listening

Other episodes of Autonomous Autopsy, newest first.

All episodes of Autonomous Autopsy

Sources

Where this came from

8 reports behind the episode. Every one of them opens where it was published.