Back to blog

The weak link in AI is the harness of your code agents

The weak link in AI is the harness of your code agents

The Model Wasn’t the Problem

When we think about AI security, we picture jailbreaks, malicious prompts, or data leaking from the model. The incidents documented in Q3 2026 tell a different story. According to OWASP’s Q3 2026 Generative and Agentic AI Exploit Roundup, attacks rarely targeted the model itself. Instead, they slipped in through Git configuration, plugin hooks, subagent policies, and sandbox mount paths.

Put simply, the entry point isn’t what the model “thinks,” but what the agent executes automatically when opening a folder, installing a plugin, or refreshing the Git index. This is a layer that neither traditional EDR nor your WAF monitors, because it looks like development tools doing what development tools are supposed to do. The result is that a repository, plugin, or skill stops being inert content and becomes executable code. And that is precisely the attack surface almost nobody is testing.

GitSpawn: Opening a Folder Was Already Executing Code

The most compelling case is GitSpawn, documented by Manifold Security. The investigation started with a simple question: what does a CLI agent do when it starts up? The answer: almost all of them run git status or git diff in the background to gather context. In some cases, this happens before you type anything, before you accept the workspace trust dialog, and even before you authenticate.

The problem is that these Git calls do not sanitize the repository’s own configuration. And Git has settings that act as execution sinks: program names that Git runs by design. The most frequently cited example is core.fsmonitor, a performance setting that Git invokes when refreshing the index. A malicious repository only needs to include this:

ini
[core]
fsmonitor = <attacker's command>

Any command that refreshes the index will execute it: on the host, with your privileges, outside the sandbox, and without any approval dialog. Manifold identified eight vulnerabilities across seven agents: Claude Code, Codex, Cursor, Goose, Hermes Agent, Qwen Code, and Grok Build. Four remained unpatched when the findings were published, and the Goose case CVE (CVE-2026-72718) received a severity score of 7.0. The key takeaway for QA is that the delivery vector isn't git clone. It's anything that moves a folder containing its .git directory: a shared .zip file, a network drive, or a USB stick. Exactly the way your team shares projects with colleagues and clients. The lesson is harsh: a repository is executable input, not a text file.

Plugin4Shell: The Pin That Protected Nothing

The second family of attacks targets the supply chain of the agents themselves. Plugin4Shell, disclosed by Air Security, describes a zero-click vulnerability in the SHA pinning mechanism used by plugin marketplaces—the very technique the industry relies on to secure automatic updates.

The attack is both elegant and alarming. The agent clones the plugin repository and runs git checkout <pinned-sha> without verifying that the resulting working tree actually corresponds to that commit. If an attacker controls the repository, they create a branch named exactly after the pinned hash and make it the default branch. Git prefers the reference when a name exists as both a branch and an object, so the checkout resolves to malicious content while the pin appears to have been honored. Because agents update plugins in the background by default—a behavior seen in Claude Code and Codex—the malicious code arrives on its own, without installing anything new and without any warning. The vulnerability affected Claude Code, OpenAI Codex, GitHub Copilot, and Gemini CLI. Claude Code and Codex were patched following disclosure; GitHub Copilot remained unpatched, while Gemini CLI remained vulnerable indefinitely because Google had deprecated it.

Here is the detail that undermines the “trust the pins” narrative: doing everything right—reviewing and pinning the commit—did not protect you. The pin is resolved inside the agent, and no marketplace can enforce the guarantee it claims to provide.

AI-Generated Code Isn’t Secure by Default Either

While the attacks above compromise the developer’s machine, the other front is the quality of the code the agent produces. The numbers are uncomfortable. Semgrep tested Claude Opus 5.5 against all 186 tasks in the SusVibes benchmark, built from real CVEs in open-source Python projects. The model passed the functional tests in 93.5% of tasks, but only 54.8% of the solutions were both functional and secure.

In other words, 41% of the solutions that “worked” reintroduced the original vulnerability. An even more troubling finding for anyone who trusts benchmarks: 53% of the solutions were identical or nearly identical to the actual code in the project. The model wasn't reasoning its way to a solution; it was recalling one. When it recalled a vulnerable version, it almost always reproduced the flaw. When the vulnerable code was recent and therefore less likely to appear in its training data, the rate of secure solutions dropped.

Semgrep sums it up with a statement that should be on the wall of every QA team: “Passing the tests” and “being secure” are two different questions. There are also categories of vulnerability where AI gets things wrong almost every time: cryptography, concurrency, access control, and injection vulnerabilities beyond SQL injection. Across 34 CWE categories, the number of secure solutions was zero.

A Practical Guide for Teams Already Using Agents

The pattern is consistent: the model isn't the weakest link. The harness is—the configuration, plugins, sandboxes, and code accepted without review. Here are the measures that follow directly from these incidents, which your team can implement without slowing down adoption:

  • Treat every repository as executable input. Before opening a folder with an agent, inspect .git/config and any settings that reference an executable. Use disposable containers when working with code from external sources.
  • Don't trust the pin without verifying the result. Disable automatic plugin updates until your agent verifies the commit that actually landed, rather than merely the reference you requested.
  • Isolate agent credentials. Infostealers are already targeting Claude, Cursor, Cline, and Codex tokens, as well as secrets in MCP configurations. Add these tokens to your rotation plan, just like your cloud credentials.
  • Separate functional testing from security testing. Manually review cryptography, concurrency, and access control. These are the areas where generated code consistently fails.
  • Move logs somewhere the agent cannot tamper with. Some agents can delete their own execution traces without triggering monitoring alerts. A log that the agent can modify is not reliable evidence.
  • Correlate events by run ID. Link package, identity, network, and tool logs to detect when an agent strays beyond its intended scope.

What This Means for QA and Cybersecurity

The good news is that this problem falls squarely within the territory of testing and security: verifying what actually happens rather than what the documentation promises.

For years, we have tested whether forms validate input, APIs respond correctly, and permissions are enforced. Now we need to test something new: what an agent does when it opens a hostile repository, whether a plugin updates behind our backs, and whether the code we accept “because it passes the tests” is also secure.

AI expands the attack surface, but it doesn't change the nature of the work. It's still the same job as always: observe, question, and verify. The only difference is that we now have a tireless collaborator whose work must be continuously audited. If you want us to review your agents' harnesses, the code they generate, and the vulnerabilities surrounding them, Redsauce has been doing precisely this kind of work for years.