إنتقل إلى المحتوى الرئيسي

When Coding Agents Get Weaponized

متقدّم
What you'll learn
  • Understand the new trust boundary that auto-approve mode creates — and why it, not the model, is the target
  • Trace the "Friendly Fire" attack: a security scan that runs the malware it was asked to inspect
  • See what fully-agentic ransomware (JADEPUFFER) actually automated, end to end
  • Apply the operational defenses that stop both — none of which are "use a smarter model"

In 2026 the abstract risk of prompt injection stopped being abstract. Two publicly documented events — one a proof-of-concept, one a real intrusion — showed the same thing from opposite ends: when an AI agent decides for itself what is safe to execute, that decision becomes a target. This page walks through both, then gives you the defenses that generalize.

The core shift: a new trust boundary

A traditional coding tool asks you before it runs something dangerous. An agent in auto-approve / autonomous mode asks itself — it approves any command it judges "safe." That judgment is the new attack surface. An attacker no longer has to convince the human that malicious code is fine; they only have to convince the model. And a model reading a repository treats a README and a build artifact as ordinary input, not as a hostile party trying to manipulate it.

That single design choice — who holds the yes/no — is the whole story below.

Incident 1 — "Friendly Fire": the scanner runs the malware

Researchers Boyan Milanov and Heidy Khlaaf at the AI Now Institute published a proof-of-concept that hijacks the exact task these tools are sold for: checking untrusted third-party code for problems. Instead of catching the threat, the agent becomes the delivery mechanism.

Guided walkthrough1 of 4
  1. An untrusted open-source library ships a hidden binary disguised as a compiled build artifact (e.g. a Go object file) sitting next to harmless-looking source. Nothing in the visible source is obviously malicious.

Three things here surprise most people:

  • The security review is the exploit. The safer you feel ("I'm just scanning it first"), the more directly you hand the agent the trigger.
  • It's cross-vendor and cross-model. One payload, multiple tools — because they share the auto-approve pattern, not any code.
  • The malicious part hides in a build artifact, not the source you'd actually read. Reviewing the .py/.go files you can see doesn't reveal it.

The tools reported as affected in the write-ups were Claude Code and OpenAI Codex running in a mode that approves their own commands, on then-current frontier models. Exact CLI/model versions are volatile — treat the pattern as the durable lesson, not any version string.

:::warning This is the counterpoint to "just ask the agent to review it" Reviewing third-party code notes the agent "can be fooled too." Friendly Fire is that footnote turned into a working exploit — the reviewer and the victim are the same process. :::

Incident 2 — JADEPUFFER: ransomware with no human at the wheel

If Friendly Fire is the lab result, JADEPUFFER (documented by the Sysdig Threat Research Team) is the field case: what Sysdig assessed as the first documented end-to-end agentic ransomware — an LLM agent that drove the entire extortion operation, narrating its own intent as it went.

Guided walkthrough1 of 4
  1. The operator reached an internet-facing Langflow instance via a known CVE — a classic exposed-service foothold, not AI magic.

The strategic takeaway Sysdig draws is the uncomfortable one: the skill floor for running ransomware has dropped to roughly the cost of running an agent. If that agent runs on stolen API credentials (LLMjacking), the attacker's compute cost approaches zero. The barrier that used to be "you need a skilled operator" is eroding.

Two ends of one problem

Friendly FireJADEPUFFER
TypeProof-of-conceptReal intrusion
Agent's roleThe victim's own tool, weaponizedThe attacker's operator
EntryMalicious repo you asked it to reviewExposed service (CVE)
Why it worksAuto-approve trust boundaryAutonomy + ambient credentials
Durable lessonDon't let the model be the final "yes" on executionLeast privilege + no reusable creds limits blast radius

Different attackers, same root: an agent with autonomy + capability + access to untrusted input. That's the exfiltration triangle with the volume turned up — break a side and you contain the damage.

Defenses that actually generalize

None of these is "wait for a model that can't be fooled." Assume it can be, and bound what a fooled agent can do.

Guided walkthrough1 of 5
  1. Don't run auto-approve/YOLO mode on a machine with real access when the agent is touching code you didn't write. The human 'yes' is the boundary Friendly Fire removes — put it back for that case.

A concrete starting point — deny-rules so an agent can't silently read credentials even if it's talked into trying:

Permission deny rules (example — adapt to your setup)

"permissions": {
"deny": [
  "Read(./.env)",
  "Read(./.env.*)",
  "Read(./**/*.pem)",
  "Read(./**/id_rsa*)",
  "Bash(curl:*)",
  "Bash(rm -rf:*)"
]
}

See Hardening Autonomous Runs for the full unattended-run checklist and Securing Agents & Tools for scoping capabilities.

The mental model to keep

Fast recall
اضغط Enter أو مفتاح المسافة لقلب البطاقة. استخدم مفتاحي السهمين الأيسر والأيمن للتنقل بين البطاقات.تم إظهار المصطلح.
1 / 5

Check yourself

0/4
  1. In the Friendly Fire attack, what convinces the agent to run the malicious payload?
  2. Why is it significant that the same attack worked across two vendors' tools unchanged?
  3. What most reduces the blast radius of a JADEPUFFER-style autonomous intrusion?
  4. You're about to have an agent review an unfamiliar open-source repo. Safest move?

Sources & further reading