Vulnerabilities in pkg:pypi/ag2

PACKAGE
Advisory Identifier: GHSA-xhqj-2fcc-8vf7
Advisory Summary

CVE-2026-141554 is a LOW (CVSS 3.1) files hidden with `ignore` are vulnerability (CWE-863: Incorrect Authorization) affecting AG2 SandboxShellTool libraries in the PyPI ecosystem. The issue involves files hidden with `ignore` are still readable through recursive `grep` / `diff` in readonly mode. Remediation is available by upgrading affected packages to version 1.3.4.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:pypi/ag2

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:pypi/ag2. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-xhqj-2fcc-8vf7 CVE-2026-141554 LOW AG2 SandboxShellTool: files hidden with `ignore` are still readable through recursive `grep` / `diff` in readonly mode

CVE-2026-141554 at a Glance

CVE Identifier CVE-2026-141554
GHSA Identifier GHSA-xhqj-2fcc-8vf7
Severity LOW
CVSS v3.1 Base Score 3.1
CWE Classification CWE-863: Incorrect Authorization
Affected Product AG2 SandboxShellTool
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 3.1

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:N/A:N).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality Low (C:L)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2026-141554

To remediate this vulnerability, upgrade all affected AG2 SandboxShellTool dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

ag2 fixed: 1.3.4
pip install ag2>=1.3.4
autogen fixed: Latest secure release
pip install autogen>=Latest secure release
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show ag2

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2026-141554, inspect your installed packages using pip:

pip show ag2

Analyze the terminal output to locate any version of AG2 SandboxShellTool in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.3.4), your application is affected.

Note: The pip show ag2 command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-863: Incorrect Authorization, where the product performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. In AG2 SandboxShellTool, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### 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. ```python 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 PRIVATE KEY----- ``` `grep -R`, `--recursive`, `-d recurse`, `--directories=recurse`, `egrep -r`, `fgrep -r` and `diff -rN empty .` (with an existing empty directory `empty`) also printed the ignored files. `sh._adapter.run()` is the coroutine the registered `run_shell_command` tool awaits (`ag2/tools/shell/tool.py:100-105`). Calling the tool through an `Agent` with a scripted `ag2.testing.TestConfig` turn gave the same tool result. ### Root cause `ShellAdapter._filter()` (`ag2/tools/sandbox/adapter/shell.py:116-122`) calls `check_ignore()` (`ag2/tools/sandbox/filter.py:108-149`). It resolves each word of the command, the parts after `=` and after a short option, and any glob matches, then compares those paths with the patterns. A directory word such as `.` or `secrets` matches none of `**/.env`, `*.key`, `secrets/**`, and `grep -r PATTERN` with no path has no path word at all. ### Suggested fix Either of these would do: - When `ignore` is set, refuse `grep`/`egrep`/`fgrep`/`diff` with a recursion option (`-r`, `-R`, `--recursive`, `-d recurse`, `--directories=recurse`, bundled forms such as `-rn`) if a directory operand, or the implicit `.`, contains an ignored path. - Say in the `ignore` and `readonly` docs that recursive `grep`/`diff` read ignored files, and change the "Hide sensitive files from the agent" example.

CVE-2026-141554 Affected AG2 SandboxShellTool Versions

2 component(s)
Fixed Versions:
1.3.4
Product / Package Ecosystem Affected Versions Fixed Version
ag2
PyPI
≥ 0.13.3
< 1.3.4
1.3.4
autogen
PyPI
≥ 0.13.3
≤ 0.14.1

References

Frequently Asked Questions

What is CVE-2026-141554?
CVE-2026-141554 is a security vulnerability in AG2 SandboxShellTool involving files hidden with `ignore` are still readable through recursive `grep` / `diff` in readonly mode under CWE-863: Incorrect Authorization.
Which AG2 SandboxShellTool versions are affected?
Affected versions include releases prior to 1.3.4 across affected packages: ag2, autogen.
What version fixes CVE-2026-141554?
Upgrading to 1.3.4 (or the latest patched release for your respective branch) resolves the vulnerability.
Is ag2 affected?
Yes, ag2 is affected in releases prior to 1.3.4. Upgrade your dependency to 1.3.4 or later.
Is autogen affected?
Yes, autogen is affected in releases prior to Latest secure release. Upgrade your dependency to Latest secure release or later.
What is the CVSS score of CVE-2026-141554?
CVE-2026-141554 has a CVSS v3.1 base score of 3.1 (LOW) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:N/A:N.
What CWE is associated with CVE-2026-141554?
CVE-2026-141554 is classified under CWE-863: Incorrect Authorization (The product performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check.).
How can I check PyPI dependencies for CVE-2026-141554?
Run the dependency tree command: 'pip show ag2'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-xhqj-2fcc-8vf7",
  "modified" : "2026-12-02T23:55:12Z",
  "published" : "2026-12-02T23:55:12Z",
  "aliases" : [ "CVE-2026-141554" ],
  "summary" : "AG2 SandboxShellTool: files hidden with `ignore` are still readable through recursive `grep` / `diff` in readonly mode",
  "details" : "### Summary\n\n`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.\n\nThe 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.\n\n### Affected versions\n\nPyPI `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.\n\n### Impact\n\nThe 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.\n\nEvery 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.\n\nThis 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.\n\n### Reproduction\n\n`ag2==1.3.2` from PyPI, Python 3.12.16, GNU grep 3.11, `python:3.12-slim` container without network.\n\n```python\nimport asyncio, tempfile\nfrom pathlib import Path\nfrom ag2.tools import LocalEnvironment, SandboxShellTool\n\nwork = Path(tempfile.mkdtemp(prefix=\"proj_\"))\n(work / \".env\").write_text(\"OPENAI_API_KEY=sk-MARKER-ENV\\n\")\n(work / \"deploy.key\").write_text(\"-----BEGIN MARKER PRIVATE KEY-----\\n\")\n(work / \"secrets\").mkdir()\n(work / \"secrets\" / \"db.txt\").write_text(\"DB_PASSWORD=MARKER-DB\\n\")\n(work / \"app.py\").write_text(\"print('hello')\\n\")\n\nsh = SandboxShellTool(LocalEnvironment(str(work)), readonly=True,\n                      ignore=[\"**/.env\", \"*.key\", \"secrets/**\"])\n\nasync def main():\n    for cmd in [\"cat .env\", \"cat .en*\", \"grep KEY .env\", \"cat secrets/db.txt\",\n                \"grep -r KEY .\", \"grep -r . secrets\", \"grep -r MARKER\"]:\n        print(f\"\\n$ {cmd}\\n{(await sh._adapter.run(cmd)).strip()}\")\n\nasyncio.run(main())\n```\n\nOutput:\n\n```\n$ cat .env\nAccess denied: /tmp/proj__1j68o_r/.env\n\n$ cat .en*\nAccess denied: /tmp/proj__1j68o_r/.env\n\n$ grep KEY .env\nAccess denied: /tmp/proj__1j68o_r/.env\n\n$ cat secrets/db.txt\nAccess denied: /tmp/proj__1j68o_r/secrets/db.txt\n\n$ grep -r KEY .\n./.env:OPENAI_API_KEY=sk-MARKER-ENV\n./deploy.key:-----BEGIN MARKER PRIVATE KEY-----\n\n$ grep -r . secrets\nsecrets/db.txt:DB_PASSWORD=MARKER-DB\n\n$ grep -r MARKER\n.env:OPENAI_API_KEY=sk-MARKER-ENV\nsecrets/db.txt:DB_PASSWORD=MARKER-DB\ndeploy.key:-----BEGIN MARKER PRIVATE KEY-----\n```\n\n`grep -R`, `--recursive`, `-d recurse`, `--directories=recurse`, `egrep -r`, `fgrep -r` and `diff -rN empty .` (with an existing empty directory `empty`) also printed the ignored files. `sh._adapter.run()` is the coroutine the registered `run_shell_command` tool awaits (`ag2/tools/shell/tool.py:100-105`). Calling the tool through an `Agent` with a scripted `ag2.testing.TestConfig` turn gave the same tool result.\n\n### Root cause\n\n`ShellAdapter._filter()` (`ag2/tools/sandbox/adapter/shell.py:116-122`) calls `check_ignore()` (`ag2/tools/sandbox/filter.py:108-149`). It resolves each word of the command, the parts after `=` and after a short option, and any glob matches, then compares those paths with the patterns. A directory word such as `.` or `secrets` matches none of `**/.env`, `*.key`, `secrets/**`, and `grep -r PATTERN` with no path has no path word at all.\n\n### Suggested fix\n\nEither of these would do:\n\n- When `ignore` is set, refuse `grep`/`egrep`/`fgrep`/`diff` with a recursion option (`-r`, `-R`, `--recursive`, `-d recurse`, `--directories=recurse`, bundled forms such as `-rn`) if a directory operand, or the implicit `.`, contains an ignored path.\n- Say in the `ignore` and `readonly` docs that recursive `grep`/`diff` read ignored files, and change the \"Hide sensitive files from the agent\" example.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "ag2"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.13.3"
      }, {
        "fixed" : "1.3.4"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 1.3.3"
    }
  }, {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "autogen"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.13.3"
      }, {
        "last_affected" : "0.14.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/ag2ai/ag2/security/advisories/GHSA-xhqj-2fcc-8vf7"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-141554"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ag2ai/ag2/commit/92e842709be3010853e9964905cd23487385e570"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ag2ai/ag2/commit/c1d943df06f0506269f9a6c7312afaf47c3c4871"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/ag2ai/ag2"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ag2ai/ag2/releases/tag/v1.3.4"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-863" ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-12-02T23:55:12Z",
    "nvd_published_at" : "2026-12-02T20:20:40Z"
  }
}