CVE-2026-141554: CVE-2026-141554: SandboxShellTool Ignore Filter Bypass via Recursive Directory Readers in AG2
CVE-2026-141554: SandboxShellTool Ignore Filter Bypass via Recursive Directory Readers in AG2 Vulnerability ID: CVE-2026-141554 CVSS Score: 3.1 Published: 2026-12-02 CVE-2026-141554 (GHSA-xhqj-2fcc-8vf7) is an incor
CVE-2026-141554: SandboxShellTool Ignore Filter Bypass via Recursive Directory Readers in AG2
Vulnerability ID: CVE-2026-141554
CVSS Score: 3.1
Published: 2026-12-02
CVE-2026-141554 (GHSA-xhqj-2fcc-8vf7) is an incorrect authorization vulnerability (CWE-863) in AG2 (formerly AutoGen), an open-source AgentOS framework for multi-agent AI systems. In versions from 0.13.3 prior to 1.3.4, the SandboxShellTool component configured with readonly=True and an ignore pattern list fails to prevent recursive search and comparison utilities (grep, egrep, fgrep, and diff) from accessing and disclosing restricted files. Because the command-line security filter only inspects explicit path tokens passed as arguments rather than files discovered autonomously during directory traversal, an AI agent processing untrusted input or prompt injections can be induced to read and expose protected files such as .env configurations, cryptographic keys, and credentials.
TL;DR
AG2's SandboxShellTool command filter (check_ignore) only validates explicit file paths written in the command string against configured ignore patterns. Whitelisted read-only utilities capable of autonomous directory traversalβspecifically grep, egrep, fgrep, and diffβcan bypass these restrictions when invoked recursively on a parent directory or the implicit current working directory, exposing sensitive files in tool execution outputs. Upgrading to AG2 v1.3.4 resolves this issue.
β οΈ Exploit Status: POC
Technical Details
- CVE ID: CVE-2026-141554 (GHSA-xhqj-2fcc-8vf7)
- Weakness Class: CWE-863: Incorrect Authorization
- Affected Component: SandboxShellTool / ShellAdapter (ag2/tools/sandbox/filter.py)
- CVSS v3.1 Score: 3.1 Low (CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:N/A:N)
- Attack Vector: Network (Prompt Injection / Untrusted Agent Context)
- Impact: Unauthorized disclosure of ignored files (.env, keys, secrets)
- Exploit Status: Functional PoC available via regression unit tests
- Fixed Version: AG2 v1.3.4
Affected Systems
- AG2 (ag2ai/ag2) Python package >= 0.13.3, < 1.3.4
- AutoGen (autogen) Python package >= 0.13.3, <= 0.14.1
-
ag2: >= 0.13.3, < 1.3.4 (Fixed in:
1.3.4) -
autogen: >= 0.13.3, <= 0.14.1 (Fixed in:
1.3.4 (via ag2 package))
Code Analysis
Commit: 92e8427
Core fix introducing deep directory operand inspection for grep, egrep, fgrep, and diff in ag2/tools/sandbox/filter.py
Commit: c1d943d
Merge commit incorporating sandbox filter security patches and regression tests for v1.3.4
Mitigation Strategies
- Upgrade AG2 to version 1.3.4 or later to enable pre-execution directory tree inspection and fail-closed budget enforcement for directory-reading utilities.
- Isolate agent workspaces by removing secret files (.env, *.key) from the SandboxShellTool workdir and supplying secrets to the orchestrator process via environment variables.
- Use containerized sandboxes with selective volume mounts rather than host-directory sandboxes when agents process untrusted inputs.
- Audit agent tool execution logs for recursive grep, egrep, fgrep, and diff invocations or tool outputs containing credential markers.
Remediation Steps:
- Identify all projects and virtual environments using 'ag2' (>= 0.13.3, < 1.3.4) or 'autogen' (>= 0.13.3, <= 0.14.1).
- Update package dependencies to 'ag2>=1.3.4' via pip, poetry, or uv.
- Review historical agent conversation traces and LLM observability logs for any previous invocations of 'grep -r', 'grep -R', or 'diff -N' that may have leaked ignored files into prompt contexts; rotate any exposed credentials.
- Verify that custom 'allowed' command lists on SandboxShellTool do not include unrestricted scripting runtimes (e.g., python, sh) if relying on 'ignore' patterns.
References
- GitHub Security Advisory GHSA-xhqj-2fcc-8vf7
- AG2 Fix Commit 92e842709be3010853e9964905cd23487385e570
- AG2 Fix Commit c1d943df06f0506269f9a6c7312afaf47c3c4871
- AG2 Release v1.3.4
- CVE.org Record for CVE-2026-141554
- CVEListV5 Official JSON Record
- NVD Vulnerability Detail: CVE-2026-141554
- MITRE ATT&CK Search Reference
Read the full report for CVE-2026-141554 on our website for more details including interactive diagrams and full exploit analysis.
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.