# GHSA-3R6W-7PCG-C4X2: Summary Over ACP, a sensitive action reaches AG2 as session/request\_permission with a list of options, each tagged allow\_once, allow\_always, reject\_once, or reject\_always

- Database: GitHub
- Severity: CVSS 7.5 (High)
- Published: 2026-11-22
- Modified: 2026-11-22

## Affected versions

- ag2 (PyPI): from 1.0.0b0, through 1.3.3

## Description

### Summary

Over ACP, a sensitive action reaches AG2 as session/request_permission with a list of options, each tagged allow_once, allow_always, reject_once, or reject_always. With the default permission_policy="ask", AG2 shows the options and asks "Allow? (yes/no)", then:

  _ALLOW_KINDS = ("allow_once", "allow_always")
  _AFFIRMATIVE = {"y", "yes", "allow", "allow_once", "allow_always", "ok", "approve"}
  ...
  allow_id = _option_id_of_kind(options, _ALLOW_KINDS)   # first option of EITHER allow kind
  ...
  if answer.strip().lower() in _AFFIRMATIVE:
      return allow_id

allow_id is the first option whose kind is allow_once or allow_always, in the order the agent sent them. Every affirmative maps to it, including the literal allow_once. If an agent lists allow_always before allow_once, one "yes" selects Always Allow on the human's behalf.

Gemini CLI, named as a supported agent in AG2's ACP docs, does exactly that. From its shipped source (google-gemini/gemini-cli packages/cli/src/acp/acpUtils.ts::toPermissionOptions, read via the GitHub API 2026-11-06): for exec, edit, mcp, and info, an allow_always option (ProceedAlways; for MCP ProceedAlwaysServer) is pushed first while getDisableAlwaysAllow() is false (its default), and the allow_once option (ProceedOnce) is appended last via basicPermissionOptions. Gemini then acts on the "always" choice (packages/core/src/scheduler/policy.ts): for exec it installs a session policy keyed to the command's root prefix (all git ...), so later commands with that root run without another request_permission. AG2's human is never asked again.

So "ask" stops meaning one action: a single approval covers that whole command root for the session, the human is not asked again, and typing allow_once by name still selects allow_always.

Attack path: a developer drives Gemini CLI from AG2 with the documented ACPConfig(["gemini", "--experimental-acp"]) and default permission_policy="ask". Early on, Gemini asks to run something harmless (git status); the human says yes (or types allow_once). AG2 sends ProceedAlways, so Gemini auto-allows every git command for the session. Later the agent reads attacker-controlled content carrying an indirect injection, or simply errs, and runs git clean -fdx, git reset --hard, or git -c core.sshCommand=... - same root, no permission request reaches the human. The grant is keyed to the root prefix, so one git yes auto-approves only later git subcommands; reaching a different root needs its own earlier benign approval. Prompt injection is only the delivery route; the defect is that AG2 granted wider than the human allowed.

### Details

Affected products:
Ecosystem: pip
Package: ag2 (with the acp extra)

Affected versions:
ag2 with the acp extra. Verified on ag2 1.3.0 (PyPI latest, 2026-11-06) and main 3539d0750059fce639ac88b2a20ca2f34e467cc2; permissions.py is byte-identical across them. Shipped with ACP support in #3026; every release that includes ag2.acp is affected.

Patched versions:
None. Still unfixed on release v1.3.0 and main 3539d07 as of 2026-11-06.

Vulnerable functions:
ag2/acp/permissions.py, resolve_permission_option_id() (def line 32; _ALLOW_KINDS line 19, _AFFIRMATIVE line 22, allow_id = line 46, affirmative return line 61), called from ag2/acp/bridge.py:253 (BridgeState.resolve_permission).

Severity (CVSS v4.0):
CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:A/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N  (conditional High, effectively Medium)

Weaknesses: CWE-863 (with CWE-1188)

Suggested fix:
Never widen a one-time yes. Prefer allow_once; send allow_always only when the human explicitly asks for it. The minimal form -
allow_id = _option_id_of_kind(options, ("allow_once",)) or _option_id_of_kind(options, ("allow_always",))
- already takes the patched attack to 0/5. Fuller:

  _ONCE_ANSWERS = {"y", "yes", "allow", "allow_once", "ok", "approve"}
  _ALWAYS_ANSWERS = {"always", "allow_always"}
  ...
  once_id = _option_id_of_kind(options, ("allow_once",))
  always_id = _option_id_of_kind(options, ("allow_always",))
  reject_id = _option_id_of_kind(options, _REJECT_KINDS)
  ...
  if answer in _ALWAYS_ANSWERS and always_id:
      return always_id
  if answer in _ONCE_ANSWERS:
      return once_id or reject_id   # if the agent offers no allow_once, refuse rather than send allow_always
  return reject_id

Add a regression test with options ordered [allow_always, allow_once, reject_once] (Gemini's order); the existing test/acp/test_permissions.py uses only [allow_once, reject_once], which is how this slipped through.

This is not GHSA-rppm-w5cw-6qcg (approval keyed by tool name) or GHSA-2h3q-9p6m-4hm4 (a shared always-bypass dict copied by reference) - the same over-grant class but a different code path, here in the ACP client's resolve_permission_option_id. AG2 has taken two advisories in that class already, so it is in scope. claude-agent-acp, OpenCode, and Kilo list allow_once first and are not affected (checked 2026-11-06); Codex (codex-acp) not checked.

Still unfixed as of 2026-11-06, release v1.3.0 and main 3539d07: PoC 5/5 in Docker --network none. (release v1.3.0 = 1229064a23a1e39a4c3c089bb4643a637117c8a9; main HEAD 3539d0750059fce639ac88b2a20ca2f34e467cc2.)

Credit: Teodor Velický (PitSense)

### Proof of concept

Local, no LLM, no network. Three files, run in Docker with --network none:

- fake_gemini_acp.py is a minimal ACP agent run as a real subprocess by AG2's ACPConfig. It sends Gemini CLI's exact exec option list and implements Gemini's "ProceedAlways -> allow this root for the session" semantics. It runs no real commands; it logs "executed" ones to EXECUTED.log.
- poc_acp1.py builds Agent(config=ACPConfig(..., permission_policy="ask"), hitl_hook=human). The agent plans git status, then git clean -fdx. The human answers "yes" to the first request only, "no" to anything after.
- run.sh builds ag2[acp]==1.3.0 (acp 0.12.1) and runs each case 5 times.

  | Run     | Option order    | First answer       | Unapproved git clean -fdx ran |
  | attack  | Gemini CLI      | yes                | 5/5                           |
  | attack2 | Gemini CLI      | allow_once (typed) | 5/5                           |
  | control | allow_once first| yes                | 0/5 (human asked again, says no) |

With the fix below applied to ag2[acp]==1.3.0, the patched attack is 0/5: AG2 selects allow_once, Gemini installs no session policy, the second command raises a fresh request_permission, the human says no, and git clean -fdx does not run.

The defect under test is in AG2 and is exercised against real AG2 code (resolve_permission_option_id from PyPI / the clone). Only the counterparty agent is stubbed, and its two behaviours are copied verbatim from Gemini's shipped source quoted above: the option order and the root-prefix session policy. I did not run the live gemini --experimental-acp binary against Google's service; the premise is verifiable from Gemini's source. If you want a live-binary transcript before triaging, that's reasonable, but it would only re-confirm the counterparty half; the AG2 half is already proven here.

### Impact

CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:A/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N  (conditional High, effectively Medium)
AV:N: the later, auto-approved command is typically triggered by content the agent fetches. AT:P: the agent must list allow_always before allow_once (Gemini does today) and the human must give one benign approval first. UI:A: the human actively approves that earlier, benign request. VC/VI/VA:H: the silently auto-approved commands run as the developer and within one root can be destructive (git clean -fdx, git reset --hard, git -c core.sshCommand=...). Not an unauthenticated RCE: the preconditions are all real and all required.

## References

- https://github.com/ag2ai/ag2/security/advisories/GHSA-3r6w-7pcg-c4x2

Page: https://cve.now/GHSA-3R6W-7PCG-C4X2

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
