AI safety · Agent Scan

Rogue AI agents, malware, implants, leaked credentials — the hidden dangers lurking in your code! Flush them out with Code Delta!

AI agents could be lurking right now, deep inside your code — waiting to run unauthorised commands, call home, pull in malware, breach your perimeter, burn your budget. Flush them out. Exterminate the infestation. Get Code Delta now!

August 2026 · the threat-detection mini guide — how to run, read and gate every layer on this page · AI agent swarms: the Hugging Face intrusion · the AI safety test that deleted the machine · The AI Threat Index · methods in our technical paper on agent detection

The threat!

An AI agent lurking unseen beneath the surface of a codebase

AI agents could be lurking right now, deep inside your code — waiting to run unauthorised commands, call home, pull in malware, breach your perimeter, burn your budget. Flush them out. Exterminate the infestation.

Somewhere in your repositories, right now, there may be code that calls an AI model and runs whatever comes back. Who on your team wrote it — and did they know what it calls? Who reviews what the model sends back? It can pass every code review, because reviewers read source — and the danger is not in the source. It is in what the software does at runtime, and in the machinery that builds it.

This stopped being hypothetical in July 2025, when an autonomous coding agent at Replit deleted a production database during a declared code freeze, fabricated roughly 4,000 user records and fake test results, and told its operators a rollback was impossible. It wasn't. The failure that matters isn't the deletion — it's that the agent's own account of its actions was false. You cannot ask an agent whether it behaved; the control has to sit outside it.

The mechanism behind most agent risk is simple to state. When code passes a model's output into something that executes — eval, exec, a subprocess, a network call — then whoever can influence the model's input can influence what your system runs. That is why prompt injection is OWASP's number-one risk class for LLM applications: a crafted input becomes, through the model, arbitrary code execution.

What’s lurking in your code — and what can it reach?

That is the question xz forces. What was lurking there was not an AI — it was an implant a trusted insider hid in the build machinery, invisible to every reviewer reading source. Today the lurker is as likely to be an agent wired to a model, three dependencies down. Either way, the question with consequences is the same: what is hiding in this code, and what can it reach? And it has deterministic answers, because lurkers leave hard evidence:

None of this needs machine learning to detect. It is static analysis: deterministic, repeatable, evidence you can put in front of an auditor.

The xz lesson — the attack that never touched application source

In March 2024 the xz-utils backdoor came within weeks of shipping inside most of the world's Linux distributions. The payload wasn't in any source file a reviewer would read — it was smuggled in through the build machinery: an autoconf macro and test artefacts that altered what the compiler produced without altering what humans reviewed. That is the xz-class vector: change how the software builds, and you change what ships, invisibly. It nearly worked against the entire internet — and the only reason it failed was one engineer noticing half a second of slowdown. Your codebase gets no such luck unless something is watching. Our technical paper on repository threats covers the incident record in depth.

Five layers of threat detection

CodeDelta ships these as one scan — five distinct instruments, each answering a question a security review actually asks. Every one reports evidence with file and line, never verdicts, and all of it runs inside your own infrastructure. The threat-detection mini guide covers how to run and read each layer, and how to make them block a merge.

1 · Build-file change alert

Every scan that compares two versions lists the build, CI and packaging files that changed — because that is where an xz-class payload enters. Install hooks (code that runs the moment someone installs) ride first; one rung below, build files that fetch remote content at build time, since a single edited download URL redirects the build's supply chain. Detection is a readable rule table plus a byte comparison — no scoring, no model.

CodeDelta build-file change alert — OpenCV 4.8 to 4.10, 104 changed build files, 8 flagged as fetching remote content at build time
The change alert. A real scan of OpenCV 4.8 → 4.10: 104 build files changed — the 8 that fetch remote content, including the mirror files that decide where the build downloads its third-party code from, ride the top for inspection first.

2 · Build & deployment surface inventory

The standing map of what build machinery exists in the tree, changed or not — so a new download source or install hook appearing anywhere is visible on every scan, and an auditor can see the whole surface on one page.

CodeDelta build and deployment surface inventory — 301 files, 14 fetching remote content at build time
The standing inventory. The same scan also maps what build machinery exists — 301 files here, 14 of them fetchers — so a new download source appearing anywhere in the tree is visible, changed or not.

3 · Agent Scan

Finds the AI inside your software: named agent-SDK imports and model calls across 43 languages, raw model endpoints, and the rogue pattern — model output flowing into exec, a shell, or an outbound request. Deterministic and repeatable; the same fingerprints the 2025 wave of LLM-enabled malware left in real incidents.

CodeDelta Agent Scan report — 3 HIGH, 8 ELEVATED, rogue agent pattern found, data leaving to CN and RU hosted models
What a scan of our demo repository finds. The rogue-agent pattern present, committed credentials in the tree — and data leaving to models hosted in CN and RU: a non-allied jurisdiction, called from inside a loop.
CodeDelta committed credentials — Anthropic key, AWS key and a private PEM found in the tree, redacted, with the gate switch named
Leaked credentials, caught. An Anthropic key, an AWS key and a private key sitting in the tree — found by format, shown redacted, and one policy line away from failing the build.
CodeDelta flagged files — rogue_executor.py AIS 100 with eval/exec near AI API call, deepseek and aliyuncs endpoints
Named, scored, opened to the line. rogue_executor.py — AIS 100: eval/exec near an AI call at lines 14 and 22. Possible execution of AI-generated code, sitting in the tree like it belongs there.

The findings don't stop at a report. The Code Browser has an Agents view: the whole AI surface of a codebase on one screen, a 3-D map of who your code talks to, and one click from any finding to the source line that caused it.

CodeDelta Code Browser Agents view — 11 agent files with risk, score, fired signals and provider calls, and a 15-provider roll-up with CN and RU jurisdictions in red
Every agent, on one screen. The Code Browser's Agents view: each file that calls AI, its risk and score, the exact signals that fired — and below, all fifteen providers this one small repository talks to, CN and RU jurisdictions in red.
CodeDelta agent map in the Code Browser Visualiser — files connected in 3D to the provider SDKs they call, sovereignty-sensitive providers and their links in red
The agent map. Your files, connected to the model providers they call — red links lead to sovereignty-sensitive jurisdictions. Drag to orbit, zoom, hover any dot for its story.
CodeDelta Code Browser source view — multi_agent.py opened from the Agents view, showing langchain and crewai agent-orchestration imports
One click to the evidence. Click any file in the Agents view and the source opens at the flagged code — here multi_agent.py, spinning up autonomous crews with langchain and crewai.

4 · AI Bill of Materials

The agent you should worry about may not be one your team wrote — a transitive dependency that calls a model and pipes the result into a shell is an agent in your supply chain, and conventional dependency scanners don't ask that question. The AI-BOM inventories every place your software touches AI — which models, which providers, what the outputs can reach, where data egresses to — as a native or CycloneDX document; regulators (the EU AI Act among them) are beginning to expect one.

CodeDelta AI Bill of Materials — JSON document listing every AI provider, jurisdiction and sovereignty risk, including api.deepseek.com hosted in CN
The AI-BOM, generated. Every provider your code touches, as a document — here api.deepseek.com, jurisdiction CN, sovereignty_risk: true, with the exact files named. Native JSON or CycloneDX for your compliance tooling.

5 · The merge gate

Detection becomes enforcement in CI: --fail-on-new blocks a pull request that introduces new findings against your baseline, and --gate fails the build outright on the rogue pattern or an unapproved model provider. The GitHub Action runs all five layers on every pull request and posts the evidence as a comment.

CodeDelta merge gate failing a build with three committed-credential violations, exit code 3
And when policy says no — the build fails. Three violations, exit code 3, merge blocked. Detection you can enforce.
CodeDelta report as a GitHub pull-request comment — build files changed with two install hooks flagged, agent scan tiers, governance and agent-infrastructure findings
On the pull request itself. A live comment from our public demo repository: the build-file alert with two install hooks flagged in bold, agent-scan tiers, governance egress and tier-3 agent residue — posted by the Action before anyone merges.

Try it on our demo code — every screenshot above is reproducible

The Agent Scan and credentials screenshots on this page come from our public demo repository — a small project deliberately seeded with inert, documented fakes: synthetic agents, Amazon’s own published example key, a private-key header with no key material, a build file that “fetches” from a reserved example domain. Nothing in it executes or opens anything, and the README explains every plant. Inside CodeDelta, Download demo code fetches it and Run Demo Scan produces exactly the reports pictured here — the tiers, the rogue pattern, the redacted credentials — on your own machine, in about ten seconds. If the scanner is bluffing, this is where you catch it.

How to check your own codebase

CodeDelta's Agent Scan does the above in one pass: it finds named agent-SDK and model calls across 43 languages, flags exec-on-model-output patterns, reports egress destinations, and emits the result as an AI-BOM (native or CycloneDX) — runnable from a CLI, a GitHub Action on every pull request, or a scheduled job. It reports evidence with file and line, never verdicts. It runs entirely inside your own infrastructure; nothing leaves your repository.

Run it on one repository and see what your codebase says. The detection methods, their limits included, are documented in full in the technical paper — written to be checked, not believed.