PitSense

PitSense / Research / GHSA-3r6w-7pcg-c4x2

Advisory write-up

One yes, always allow: a human-approval bug in AG2's ACP client

If you drive a coding agent from AG2 over the Agent Client Protocol (ACP) with the default permission_policy="ask", upgrade to ag2 1.3.4. Before that release, a single "yes" to one command could be sent to the agent as "always allow", and later commands with the same root then ran without the human being asked again.

package
ag2 (pip), ACP client
affected
1.0.0b0 to 1.3.3
fixed
1.3.4
severity
High, CVSS 3.1 7.5, as the published advisory rates it
CVE
none assigned yet

The AG2 maintainers fixed it in 1.3.4 and published the advisory on 2026-11-22. This post explains the bug, how the fix works, and what we think anyone building a human-approval step for agents should check.

The approval step

A coding agent such as Gemini CLI can run as a subprocess of an AG2 agent and talk to it over ACP. When the coding agent wants to do something sensitive, like run a shell command, it sends a session/request_permission message with a list of options. Each option is tagged with a kind: allow_once, allow_always, reject_once or reject_always.

With permission_policy="ask", AG2 showed those options to the human and asked "Allow? (yes/no)". The human's answer then had to be turned back into one of the agent's options.

Fig. 1One yes, two orders
Order the agent lists its options in

AG2 1.3.3 asks the human

Agent requests permission for: git status
Options:
- allow_always
- allow_once
- reject_once- allow_once
- allow_always
- reject_once
Allow? (yes/no) yes
The human meantrun git status, this once
AG2 answeredallow_always, the first allow option in the list
The agent now allowsevery command starting with git, for the rest of the session, without asking
AG2 answeredallow_once, the first allow option in the list
The agent now allowsgit status, once. The next command asks again
The prompt is AG2 1.3.3's own format string; the command is the one from the advisory's scenario. The options are shown by kind, as AG2 printed them when an option had no name, in the order [allow_always, allow_once, reject_once] that the advisory suggests testing. Switch the order to see the same "yes" stay a one-time answer.Source: ag2/acp/permissions.py at v1.3.3, lines 58 to 62; the advisory

This is the code that did it in 1.3.3 and earlier. The advisory quotes the key line.

Fig. 2Where a yes became "always"
ag2/acp/permissions.py (v1.3.3)
19_ALLOW_KINDS = ("allow_once", "allow_always")both allow kinds⋮22_AFFIRMATIVE = {"y", "yes", "allow", "allow_once", "allow_always", "ok", "approve"}⋮46    allow_id = _option_id_of_kind(options, _ALLOW_KINDS)first of either kind, in the agent's order⋮60    answer = await context.input(f"...Allow? (yes/no)")61    if answer.strip().lower() in _AFFIRMATIVE:62        return allow_idany yes returns it
Trimmed: lines 20 to 21, 23 to 45 and 47 to 59 are left out, and line 60's prompt text is shortened (Fig. 1 shows it in full).Source: ag2/acp/permissions.py at v1.3.3

_ALLOW_KINDS was ("allow_once", "allow_always"). So any affirmative answer (yes, ok, approve, even the literal allow_once) selected whichever allow option the agent happened to list first.

Where the order matters

If the agent lists allow_once first, nothing goes wrong. If it lists allow_always first, one "yes" picks Always Allow for the human.

Gemini CLI, which AG2's ACP documentation names as a supported agent, did list allow_always first for shell, edit and MCP requests when we read its source on 2026-11-06. When it receives the "always" answer for a shell command, it adds a session rule keyed to the command's root, for example everything starting with git. Later commands under that root run without a new permission request, so AG2's human is never asked again.

To be clear about blame: the order an agent lists its options in is its own business. The defect was on the client side, in AG2 turning a one-time yes into a standing grant. The advisory notes that other ACP agents (claude-agent-acp, OpenCode and Kilo, checked 2026-11-06) list allow_once first, so with them a one-time yes stayed one-time.

What it looks like in practice

The scenario from the advisory, described rather than packaged. Step 1: a developer drives Gemini CLI from AG2 with the documented ACPConfig(["gemini", "--experimental-acp"]) and the default "ask" policy. Steps 2 to 4 happen inside the session:

Fig. 3The same session, message by message
  1. 2Gemini CLI, the agent → AG2, the ACP clientEarly on, asks to run something harmless, git status, with allow_always listed first
  2. AG2, the ACP client → Human"Allow? (yes/no)"
  3. Human → AG2, the ACP clientSays yes
  4. 3AG2, the ACP client → Gemini CLI, the agentAnswers with the always-allow option
  5. Gemini CLI, the agentNow auto-allows every git command for the session
  6. later, same session
  7. 4Gemini CLI, the agentReads content with an indirect prompt injection in it, or simply makes a mistake
  8. Gemini CLI, the agentRuns git clean -fdx or git reset --hard
  9. HumanNo permission request reaches the human
The numbers mark steps 2 to 4 of the scenario. After the one yes, the human is not part of the conversation again.Source: the advisory, "Attack path"

Two limits keep this from being worse. The grant covers one command root, so a single git yes does not approve curl or rm. And the human has to approve something first. Prompt injection is only one way to reach step 4; the defect is that the human approved less than AG2 granted.

How we proved it

We ran the real AG2 code (resolve_permission_option_id from the 1.3.0 package and from main) in Docker with networking disabled. The counterparty was a small stand-in ACP agent that copies two behaviours from Gemini CLI's published source: the option order and the root-keyed session rule. It runs no real commands; it only logs what it would have run.

Fig. 4The replay: did an unapproved git clean -fdx run?
Each block of dots is one run. The fix arm is the fix we suggested in our report, applied to 1.3.0; we did not replay AG2's own 1.3.4 fix.Source: our replay; the advisory, "Proof of concept"

We also scored it lower than the published advisory does. Our report rated it "conditional High, effectively Medium" under CVSS 4.0, because it needs an agent that lists allow_always first and one earlier approval. The published advisory rates it High, CVSS 3.1 7.5.

How it was found: by our agents, meaning AI agents reading AG2's code, with the proof run as the Docker replay above. It did not come from our automated scanning pipeline. The report itself was filed by a person, through GitHub's private vulnerability reporting.

The fix in 1.3.4

The fix is commit 364c0ce, "fix(acp): let the human pick the agent's permission option, never widen a yes", shipped in v1.3.4. Going by its commit message:

  • The permission request now reaches the hitl_hook as an ACPPermissionRequest that carries the agent's options and the tool call, and the answer is the option id to select. The human picks the actual option instead of a yes/no that gets translated.
  • Plain answers are still accepted but never widened: yes, y or 1 select the one-time allow option, or reject if there is none. always (or allow_always) selects the remembered option. Anything else rejects.
  • The automatic policies (auto and deny) prefer the one-time option regardless of the agent's order.
Fig. 5The core of the fix
ag2/acp/permissions.py (commit 364c0ce, excerpt)
_ALLOW_KINDS = ("allow_once", "allow_always")_AFFIRMATIVE = {"y", "yes", "allow", "allow_once", "allow_always", "ok", "approve"}_ONCE = {"y", "yes", "1", "ok", "allow", "approve", "allow_once"}_ALWAYS = {"always", "allow_always"}    if answer.strip().lower() in _AFFIRMATIVE:        return allow_id    answer = await context.ask(permission_request(options, tool_call))    return _selected(answer.strip(), options)    if word in _ONCE:        # Never widened to allow_always: with nothing one-time to allow, refuse.        return _first_of_kind(options, "allow_once", "reject_once", "reject_always")
An excerpt, trimmed to the lines that decide what a yes means. The full change also adds the structured request, tests, documentation and a design record.Source: commit 364c0ce on GitHub, by the AG2 maintainers

The change also extends the tests and adds a design record (ADR 0039) explaining that ACP permissions are structured approvals chosen by option id. It goes further than the fix we suggested in our report.

Timeline

Fig. 6From report to advisory
  1. Our report is datedThe bug is confirmed unfixed on AG2 1.3.0 and main. Source: advisory text
  2. 2026-11-06 to 11-11Reported privately to the maintainersThrough GitHub private vulnerability reporting. Exact day not on record. Source: our records
  3. Fix committed (364c0ce)Source: commit
  4. AG2 1.3.4 released with the fix; advisory publishedSource: release, advisory
Heat marks the days from our report to the fix. The report day is a range because the exact day is not on record.

Credit

What to check in your own agent stack

The human-approval step is where an agent system turns a person's judgment into permissions. A bug there doesn't look like a crash. It looks like the human said yes.

If you build or use one:

  1. Map "yes" to "once". A plain affirmative should never pick a broader grant. "Always" should take a separate, explicit answer.
  2. Don't let the other side's ordering decide scope. Look options up by kind, not by position, and if there is no one-time option, refuse rather than fall back to "always".
  3. Test with options in more than one order. The advisory notes that AG2's earlier tests only used [allow_once, reject_once]. Add [allow_always, allow_once, reject_once].
  4. Show the human what is being granted. "Allow git status once" and "allow all git commands this session" are different questions and should look different.
  5. Log standing grants where the human can see them. Then a session-wide rule doesn't sit unnoticed after one click.

If you run ag2 with the acp extra, upgrade to 1.3.4 or later.

Teodor Velický, PitSense, Prague (GitHub: TeodorVelicky). Advisory: github.com/ag2ai/ag2/security/advisories/GHSA-3r6w-7pcg-c4x2

All research