AWS and Cloudanix team co-authored this blog: Real-Time Threat and Anomaly Detection for Workloads on AWS

Cloudanix – Your Partner in Cloud Security Excellence

A Text File in Your Downloads Folder Can Hijack Your AI Coding Agent. Here Is Why, and What to Do About It

  • Abhiram Shindikar Abhiram Shindikar
  • Wednesday, Oct 28, 2026

In the week of October 19, 2026, researchers at Forever Security disclosed a finding that is easy to underestimate because it sounds so mundane: a plain-text file sitting in a developer’s ~/Downloads folder was able to steer an AI coding agent into installing a malicious npm package. BleepingComputer and Cybersecurity News covered the research, which reproduced the attack against OpenAI Codex with a reported 90% success rate and demonstrated a related technique against Claude Code that leaked an OAuth token and allowed account hijack.

The detail that should make every platform and security leader pause is a single line from the researchers: “There is nothing here for OpenAI or Anthropic to patch.” This is not a bug in an AI tool. It is the AI tool doing exactly what it was designed to do — reading the instructions in its working directory and following them — in a situation where those instructions came from an attacker. That makes it a design-level problem for how agentic tools are being adopted, and it is squarely in the territory security teams now have to own.

This post explains what an AGENTS.md file is, how the attack chain works end to end, why it cannot be fixed with a vendor patch, and a practical set of controls that let your team keep using coding agents without leaving this door open. As with most of these agentic-AI stories, the problem is real but the response is well within reach.


What Happened

To follow the attack, you first need to know what an AGENTS.md file is. It is a plain-text Markdown file that carries project-specific instructions for an AI coding agent — the tools to use, how to run tests, coding conventions, setup steps. Several popular agents, including OpenAI Codex, read this kind of file automatically from their working directory and treat its contents as guidance for their actions. Claude Code uses a similarly named CLAUDE.md. These files are a genuinely useful feature: they are how a team tells its agent “here is how we work in this repo.”

The Forever Security team found the problem on a real customer machine. An AI coding agent on that machine had tried to install a malicious npm package called function-color. When they traced why, the answer was an AGENTS.md file sitting in the user’s ~/Downloads folder — which, in this case, was also the directory the agent had been launched in. The agent loaded the file, read the instructions, and acted on them. The instructions were not written by the developer.

The researchers then reconstructed the attack chain to understand how dangerous it was:

  • Against OpenAI Codex, they used a crafted instruction file to make the agent execute code, measuring a 90% success rate with a harmless demonstration payload (it opened the calculator app — a standard “we could have run anything here” proof).
  • Against Claude Code, they used a malicious CLAUDE.md to redirect the agent’s API traffic to a server they controlled. That exposed the agent’s OAuth token, let the server impersonate the model, and allowed it to return tool calls that executed code in roughly 50% of tests.

Two capabilities, then: make the agent run attacker-chosen commands, and steal the agent’s own authentication so you can puppet it going forward.


Why the Downloads Folder Is the Clever Part

A fair first reaction is: “fine, but how does a malicious instruction file get into my Downloads folder in the first place, and why would my agent ever run there?”

This is where the research is genuinely sharp. As Forever Security put it, ~/Downloads is special — it is the one folder the web can write to on its own. By default, Chrome, Edge, and Firefox save downloaded files there without prompting the user to choose a location. The researchers built a proof-of-concept page showing that simply visiting a malicious web page could drop a file named AGENTS.md into Downloads silently, with no click beyond the visit. (The browsers do show a download notification, and some browsers such as Brave prompt before saving — so this is not completely invisible, but it is close enough that a distracted developer would not notice.)

The second half — why an agent would ever run in Downloads — is the part that surprised us, and it is backed by data rather than speculation. Forever Security told BleepingComputer that their internal statistics show hundreds of customers running AI agents (Claude Code, OpenAI Codex, Cursor CLI) from their ~/Downloads folder, and that Claude Code alone launched more than 1,300 sessions from that location. It makes sense once you say it out loud: people download a file, then point their agent at the Downloads folder to unzip it, summarize it, clean up, or act on the thing they just downloaded. The working directory ends up being the one folder the web can write to unprompted.

Put the two halves together and the full chain is:

  1. A developer visits a malicious (or compromised) web page.
  2. The page silently drops AGENTS.md into ~/Downloads.
  3. Later, the developer launches their coding agent with ~/Downloads as its working directory — a common habit.
  4. The agent loads the attacker’s AGENTS.md, reads it as legitimate project instructions, and acts: installs a package, runs a command, changes a setting, or leaks a token.

No exploit. No malware delivery in the traditional sense. Just a file, a default, and a habit.


Why There Is Nothing to Patch

This is the uncomfortable core of the story, and it is worth stating plainly so nobody waits for a fix that is not coming.

The agent reading instructions from a file in its working directory is not a flaw. It is the feature. An AGENTS.md-aware agent that follows the AGENTS.md in its folder is doing precisely what it was built to do. There is no memory-safety bug, no authentication bypass, no CVE to assign. The “vulnerability” is the combination of three perfectly reasonable, individually-benign behaviors: browsers saving to Downloads without a prompt, agents reading instruction files from their working directory, and developers launching agents in Downloads.

That is why OpenAI and Anthropic cannot simply ship a patch, and why the responsibility — as the researchers note — lands on the user and the organization. It is also why this generalizes far beyond the two tools that were tested. Any agent that auto-loads instruction files from its working directory is exposed to the same shape of attack. The lesson is not “Codex and Claude Code are unsafe.” The lesson is that untrusted input and agent instructions must be kept apart, and most teams have no boundary enforcing that today.

This is the same root cause we saw when a ransomware crew talked Cursor’s agent into running an intrusion: the agent is an actor with real capability and real access, and the thing separating “assistant” from “attacker” is a block of text it was convinced to trust. Prompt injection stopped being a chatbot curiosity the moment agents got the ability to run commands and call APIs.


The Remediation Guide

The fix comes in two layers, and both are practical. The first layer reduces the chance the agent ever reads a malicious instruction file. The second — the one that actually determines how bad a compromise can get — assumes the agent will eventually be tricked and limits what it can do when it is.

Layer one: deny the agent untrusted instructions

  1. Never run coding agents from ~/Downloads, Desktop, or your home directory. This is the single highest-value change, and it matches the explicit guidance from both OpenAI and Anthropic: start the agent in the root of the specific project it should work on. The working directory defines the agent’s default context and, in several tools, its filesystem access boundary. Scope it to the project and the attack in this research simply does not fire.
  2. Treat AGENTS.md, CLAUDE.md, and similar files as code, not config. They can cause command execution, so they deserve the same scrutiny as a script. Review unfamiliar instruction files before letting an agent act on them, and bring them into code review and repository RBAC the way you would any other executable artifact in the repo.
  3. Keep approval prompts and sandboxing on — but do not rely on them alone. They help, and turning them off to go faster is exactly how teams get hurt. That said, a prompt a developer waves away fifty times a day is a usability hint, not a control. Treat it as defense in depth, not the defense.
  4. Isolate untrusted code. When you do need to run or inspect something you downloaded, do it in an isolated environment, not on the machine that holds your production cloud keys.

Layer two: assume the agent gets tricked, and cap the damage

  1. Do not let agents hold standing credentials. The reason step 4 of the attack chain — “leak a token,” “install a package,” “call the cloud” — is dangerous is that the agent runs with the developer’s own access. If the agent reaches your cloud through short-lived, scoped, Just-in-Time grants instead of long-lived keys, a hijacked agent can only act within a narrow, time-boxed window — and every action is attributable.
  2. Broker agent access the same way you broker human access. An AI agent is, for access-control purposes, just another identity that occasionally needs elevated permissions. Route it through the same request-and-revoke machinery. We laid out the reasoning in why AI agents need JIT, not better key vaulting.
  3. Put a boundary between the agent and credential exfiltration. The Claude Code half of this attack worked by redirecting traffic to steal an OAuth token. On-host controls that watch for and block secret and token exfiltration before it leaves the machine are the layer designed for exactly that move.
  4. Know what a hijacked agent could reach. If an agent on a given machine were fully compromised right now, which identities, cloud resources, and data sit within reach of its credentials? Being able to answer that in one place, before an incident, is what turns a hijack into a contained event. That is the job of an attack-path-aware asset graph.

Where Cloudanix Fits

There is no product that stops a browser from writing to Downloads or stops an agent from reading its working directory — and we are not going to pretend otherwise. What you can control is the blast radius when an agent is inevitably steered by something it should not have trusted, and that is where our work sits.

  • The Coding Agent Firewall is on-host DLP built for AI coding assistants. It is the control aimed directly at the Claude Code half of this attack: catching secret and token exfiltration before it leaves the developer’s machine.
  • Just-in-Time access for AI coding agents means a hijacked agent is working with short-lived, scoped credentials instead of your standing keys — so “the agent ran attacker commands” is bounded by what a twenty-minute, narrowly-scoped grant allows.
  • A unified asset graph answers the blast-radius question quickly when you need it, correlating the agent’s identity to everything it could touch.

If you want a read on where your coding agents currently hold standing access, a conversation or free assessment is a fast way to find the long-lived keys hiding in environment files and config.


The Takeaway

This finding is important precisely because it is boring. There is no exotic exploit, no zero-day, no clever memory corruption. There is a default, a habit, and a feature, combining into account takeover and code execution. That is the texture of agentic-AI risk going forward: the tools are doing what they were built to do, and the security work is about drawing boundaries around capability and access that the tools themselves do not draw.

The teams that handle this well will do two unglamorous things. They will scope where their agents run, so untrusted instructions never reach them. And they will make sure that when an agent is fooled — because eventually one will be — it is holding a short-lived, narrowly-scoped credential rather than a standing key to the cloud. Do both, and a hijacked agent is an annoyance you clean up, not an incident you report. That is an outcome you can build toward starting today.

What Our Users Are Saying

Customer Reviews

Cloudanix is trusted by security leaders worldwide to deliver proactive, reliable, and cutting-edge cloud security.

One day, I changed the password of a root account, and my CTO called me within less than a minute to confirm if I did so. I was not expecting a reaction this quick. He told me Cloudanix alerted him of this password change and that he wanted to confirm as it was a critical security notification. I couldn't believe it!

Ritesh Agarwal
Ritesh Agarwal
CEO, Airgap Networks

Compliance is one way of staying secure, but what I want is the ability to go deeper and attain 'true security.' Cloudanix provides us the capability to do so.

Vishal Madan
Vishal Madan
Head of Engineering, iMocha

Cloudanix is building for the future of the cloud, which makes the product all the more desirable.

Ritesh Agarwal
Ritesh Agarwal
CEO, Airgap Networks

Cloudanix gave us the visibility we were missing. Being able to move from permanent access to a robust Just-In-Time (JIT) workflow has fundamentally changed our security posture without slowing down our engineering velocity.

Pavan Kumar Lekkala
Pavan Kumar Lekkala
SRE Lead, HugoHub

We are excited to leverage Cloudanix's comprehensive multi-cloud DevSecOps solution to secure our production workloads on AWS. Cloudanix has demonstrated that it can solve many challenges that DevSecOps teams face while continually adding new features such as SOC2 compliance and drift detection.

Satish Mohan
Satish Mohan
Co-founder & CTO, Airgap Networks

Managing third-party partner access was once a major concern for our security posture. With Cloudanix JIT Cloud, we've effectively achieved zero third-party risk. We can now grant access confidently, knowing that it is temporary, audited, and automatically revoked, resulting in a 100% reduction in our privileged access exposure.

Okesh Badhiye
Okesh Badhiye
Head of Technical Engineering, Finfinity

The snooze feature and responsible alerts have helped us save time and prioritize what to tackle first.

Satish Mohan
Satish Mohan
Co-founder & CTO, Airgap Networks

Implementing Cloudanix JIT internally allowed us to practice what we preach. By eliminating permanent access to our own clouds and databases, we've neutralized the risk of standing privileges, ensuring our own 'keys to the kingdom' are never left exposed.

Girish Manghnani
Girish Manghnani
Managing Partner, Tech Inspira

The problem with permissions is a lot of times, the gaps are left open due to oversights from inside the organization itself. With Cloudanix's CIEM, we get a complete view of user permissions and access. This enables us to update the permissions, reducing the attack surface.

Nilesh Pethani
Nilesh Pethani
Application Architect, iMocha

In the world of Fintech, trust is our currency. Cloudanix provided the frictionless visibility we needed to secure our EKS workloads across AWS, ensuring we stay audit-ready for SOC2 and GDPR without slowing down our engineering velocity.

Amol Naik
Amol Naik
Head of Security & Infrastructure, HugoHub

Cloudanix delivered value within 5 minutes of onboarding. Continuous monitoring, timely detection, and excellent documentation helped us attain a great cloud security posture.

Divyanshu Shukla
Senior DevSecOps, Meesho

Technology strategies and business strategies are in a state of constant change which includes centralization and decentralization of responsibilities. Regardless of strategic shift, we still have intellectual property to protect. Cloudanix are critical partners for us in our public cloud security posture across our three cloud providers.

Jerry Locke
Jerry Locke
Senior Director Global Solutions Engineering, Eversana

Cloudanix has been amazing. They opened up a common Slack channel with us — and it feels like we are talking to our own team and getting things done with Cloud security. The support team is always available, friendly, helpful, and ready to go out of their way.

Satish Mohan
Satish Mohan
CTO, Airgap Networks

Beyond just access management, Cloudanix CSPM has given us a unified view of our AWS environment. The real-time alerting and anomaly detection allow us to prevent any untoward activity before it happens, which is critical for a marketplace connecting 50+ financial institutions.

Okesh Badhiye
Okesh Badhiye
Head of Technical Engineering, Finfinity

For a Fintech company, data is our most valuable — and most sensitive — asset. Cloudanix DAM hasn't just improved our visibility; it has given us control. The ability to mask data and prevent unauthorized queries in real-time is a game-changer for our compliance and customer trust.

Jiten Gala
Jiten Gala
President Engineering and Product, Kapittx

Our clients, especially in the Middle East financial sector, demand absolute accountability. Cloudanix JIT Cloud has been a competitive differentiator for us, allowing us to provide secure, governed access to customer accounts that meet their strictest audit and compliance requirements.

Girish Manghnani
Girish Manghnani
Managing Partner, Tech Inspira

Cloudanix is always on my team's lips because of its exceptional support. Be it a small or big query, Cloudanix has gone above and beyond to resolve them. This one's a keeper for us.

Sujit Karpe
Sujit Karpe
CTO, iMocha

For a long-lasting partnership, great support goes a long way. Cloudanix has delivered exceptional support whenever required. Their edge is their team is always ready to go beyond to solve any issues that we have. This speaks volumes about the culture at Cloudanix.

Akash Maheshwari
Akash Maheshwari
Co-founder, MoveInSync

Beyond the technology, Cloudanix feels like an extension of our own team. Their willingness to stand up a dedicated Middle East tenant for us and provide exceptional support at a sensible price makes them a long-term partner for Hugosave.

Surya Tamada
Surya Tamada
CTO, HugoHub

The real-time notifications that Cloudanix provides are a real lifesaver. Their adaptive notifications ensure that my team stays productive and doesn't get interrupted all the time.

Digvijay Singh
Staff Security Engineer, Meesho

The whole point in technological evolution is to help improve the world we live in. We must protect that and to do so requires an effective and efficient security strategy. The Cloudanix team helped make our public cloud security posture management strategy a reality. The symbiotic relationship we have allows for a continuous feedback loop which is how business should operate.

Larry Wheat
Larry Wheat
Staff Solutions Engineer, Eversana

Ready to see your graph?

Connect a cloud account in under 30 minutes. See every finding rooted in identity, asset, and blast radius — with a fix path attached.

Book a Demo