AgentBouncer: Defending Software Engineering Agents via Dynamic System-Call Mediation

Pascal Joos, Michael PradelarXiv 2026

It’s late. You’ve probably spent the day wrestling with code, perhaps even letting an AI agent take a crack at a few bug fixes while you grabbed a coffee. These agents are incredible—they can navigate repositories, run tests, and fix issues autonomously. But there’s a nagging thought: you’ve essentially given a black-box LLM a shell on your machine. What happens if that agent gets tricked into running rm -rf /?

This paper introduces AgentBouncer, a system designed to be the "smart security guard" for your software engineering (SE) agents.

TL;DR

AgentBouncer protects your system from rogue or manipulated AI agents by intercepting their low-level "conversations" with the operating system (system calls). By using a specialized LLM arbiter to judge whether an action is both necessary for the task and safe for the environment, it slashes attack success rates from nearly 100% to about 10% without breaking the agent's ability to actually get work done.

What Problem Does This Paper Address?

Software engineering agents are powerful because they have "tools"—they can read files, execute shell commands, and talk to the network. However, this power makes them a massive target. An attacker could trick an agent via prompt injection (hiding malicious instructions in a bug report), poisoned repositories (malicious code in a dependency), or even malicious tools provided by third parties.

Existing defenses usually look at the "trajectory"—the conversation between the user and the agent. But as the authors point out, an agent might say it’s "validating a patch" while silently executing a script that exfiltrates your SSH keys. If you only watch the conversation, you miss the crime. AgentBouncer moves the defense to the "ground truth": the system calls the agent actually makes to the OS kernel.

Figure 1. Motivating example of a malicious tool, with the outcomes observed in our evaluation.

Methods

AgentBouncer acts as a reference monitor. When an agent tries to do something—like open a file or connect to a URL—AgentBouncer intercepts that request before the kernel executes it.

The system uses a three-tiered approach to decide whether to Allow or Deny:

  1. Preseeded Profile: A set of static, task-independent rules for the "obvious" stuff. For example, letting an agent read standard system libraries is almost always safe and necessary.
  2. Policy Cache: To save time and money, AgentBouncer remembers previous decisions. If the agent asks to read the same file ten times, the LLM is only asked once. It even uses a "Promotion Cache"—if you're allowed to write to a temporary folder, you're automatically allowed to write to any file inside that folder.
  3. The LLM Arbiter: This is the brain. When a request is ambiguous, AgentBouncer sends the task description, the agent's stated rationale, and the specific system call to an LLM.

The arbiter evaluates the request along two axes: Necessity and Safety. As shown in the decision boundary below, if an action is clearly unsafe, it's denied. If it's safe but its necessity is unclear, the "bouncer" might still let it through, but the bar for safety gets higher the less necessary the action seems.

Figure 6. Dual LLM arbiter task with its decision boundary, weighing both access request necessity and safety.

Datasets

The authors evaluated AgentBouncer using a combination of benign work and malicious attacks:

  • SWE-bench Verified: A collection of real-world GitHub issues used to test if the defense hinders the agent's actual utility.
  • RedCode-Exec: A benchmark of 85 distinct attack goals (e.g., stealing credentials, creating reverse shells).
  • 340 Attack Instances: They combined these goals with four different attack vectors: prompt injection, malicious tools, poisoned environments, and poisoned repositories.

Key Insights and Ideas

  • The "Ground Truth" Advantage: By mediating at the system-call level, AgentBouncer sees through "hallucinations" or lies in the agent's trajectory. It doesn't matter what the agent says it's doing; AgentBouncer sees what it's actually doing.
  • Contextual Security: Security isn't binary. Deleting a file is "malicious" if it's a system config file, but "benign" if it's a temporary test log. By giving the LLM arbiter the task context, it can make these nuanced distinctions.
  • Efficiency via Hierarchy: LLMs are slow and expensive. By using "Preseeded Profiles" (Figure 5) for 96% of calls and smart caching for the rest, they reduced the number of expensive LLM calls to just 0.03% of the total system calls.

Key Results

  • Security: It reduced the Attack Success Rate (ASR) from 99.41% (unsupervised) to 10.59%. This outperformed existing state-of-the-art defenses by a wide margin.
  • Utility: It preserved the agent's ability to solve bugs. The Task Success Rate (TSR) remained virtually identical to an unprotected agent (72.94% vs 71.47%), with only 0.25% of benign tool calls being incorrectly blocked.
  • Overhead: It’s surprisingly cheap. It adds about 47 seconds and $0.0036 in LLM costs per task. For comparison, the next best runtime defense was nearly 10 times more expensive.

Limitations and Future Work

The authors are honest about the "cat-and-mouse" nature of security:

  • Stealthy Steps: If an attack is broken down into tiny, seemingly benign steps (like just reading a sensitive file without immediately sending it over the network), the arbiter might not find it "clearly unsafe" enough to block.
  • Cache Invalidation: If an agent modifies a script after it has been allowed by the cache, a future execution of that modified script might bypass a new check.
  • Intent vs. Injection: Distinguishing between a user's actual intent and a clever injection remains a fundamental challenge for all LLM-based systems.

In short, AgentBouncer doesn't just watch the agent's lips move; it watches its hands. And for anyone running autonomous agents on their local machine, that's a very comforting thought.

Summary updated

Abstract

Software engineering (SE) agents can complete diverse engineering tasks by interacting with the development environment via tools that access files, run commands, and download resources. Unfortunately, the same ability that makes SE agents useful also makes them prone to performing unintended malicious actions through prompt injections, malicious tools, or supply-chain attacks. Existing defenses that analyze the agent trajectory may fail to detect such attacks, as they inspect only the initial prompt and the sequence of tool calls, but not the actual actions that are executed in the environment. This paper presents AgentBouncer, a novel runtime enforcement system that prevents SE agents from performing malicious actions by mediating, and if necessary denying, system calls that agents trigger via tool calls. The core of AgentBouncer is an LLM arbiter that judges system calls along two axes, necessity and safety for the current task. It denies unsafe system calls, and the less necessary a system call appears, the more certain the arbiter has to be about its safety to allow it. To manage runtime overhead, preseeded policy rules and hierarchy-aware caching ensure that the LLM arbiter is only invoked for key decisions. We evaluate AgentBouncer on a dataset of 340 attacks on the development environment, covering four attack vectors, combined with benign issue resolution tasks from SWE-bench Verified. AgentBouncer reduces the attack success rate from 99.41% for an unsupervised agent to 10.59%, which is 18.23-73.53 percentage points lower than competitive state-of-the-art defenses. At the same time, AgentBouncer preserves the task success rate of the agent, with only 0.25% failed benign tool calls. Per benign task, AgentBouncer adds 47 seconds and USD 0.0036 in LLM costs to an unsupervised agent, whereas the closest existing runtime defense adds 4.5x as much time and 9.6x as much cost.
BibTeX
@misc{joos2026agentbouncer,
  author = {Pascal Joos and Michael Pradel},
  title = {{AgentBouncer: Defending Software Engineering Agents via Dynamic System-Call Mediation}},
  year = {2026},
  eprint = {2611.30621},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.30621},
}
Figure