AI Coding Agents Hijacked by Sneaky AGENTS.md File

·
Listen to this article~3 min

A malicious AGENTS.md file in a Downloads folder tricked an AI coding agent into installing a rogue npm package. Learn how this attack works and how to protect yourself.

You know how we all love a good shortcut? AI coding agents are the ultimate shortcut—they write code, fix bugs, and basically act like your personal dev assistant. But here's the thing: they're also a juicy target for hackers. And the latest trick? It's so simple it's scary. ### The Attack That Started in the Downloads Folder Picture this: a customer downloads a file. Innocent, right? But this file—an AGENTS.md—sits quietly in the Downloads folder. It looks like a harmless instruction manual for AI agents. Except it's not. It's a trap. When the AI coding agent scans the folder, it reads this file and follows its instructions like a loyal robot. And those instructions? They tell it to install a rogue npm package. Boom. Game over. ### Why This Is a Big Deal AI agents are designed to be helpful. They don't question files; they execute. That's the whole point. But that trust is exactly what makes them vulnerable. A malicious file like AGENTS.md can slip through because, hey, it's just a markdown file. No one suspects a text file, right? But this text file can wreak havoc. - **Trust is the weakness:** AI agents follow instructions blindly, even from untrusted sources. - **Downloads folder is a blind spot:** It's a common place for files to land, and agents often scan it without a second thought. - **Rogue npm packages are dangerous:** They can steal data, inject malware, or give attackers a backdoor. ### How to Protect Yourself So, what can you do? First, don't let your AI agent run wild in your Downloads folder. Restrict its access to only the directories it needs. Second, always review files before letting an agent process them. And third, keep your AI tools updated—developers are constantly patching these holes. Oh, and maybe think twice before downloading that "free" tool from a sketchy site. > "The most dangerous code is the code you didn't know you were running." ### The Bottom Line AI coding agents are powerful, but they're not invincible. A simple file like AGENTS.md can turn them into unwitting accomplices. Stay vigilant, keep your guard up, and remember: even the smartest AI needs a human watchdog. After all, in the world of cybersecurity, trust is a luxury you can't afford.