Summary
The llm command-line tool, in versions up to and including 0.27.1, executes Python code supplied through the --functions argument without restrictions. The vulnerability is rated critical with a CVSS score of 9.8.
What happened
According to the description, the --functions argument lets users provide custom Python function definitions, but the tool runs that code directly with exec(), without sanitization, sandboxing or security restrictions (CWE-94, code injection). An attacker could craft an llm command containing arbitrary Python code in that argument and use social engineering to get a victim to run it. The result would be arbitrary code execution on the victim's system, potentially giving the attacker full control.
Why it matters
The CVSS 3.1 score is 9.8 (critical severity), with vector CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H, as reported by GHSA. The described impact is arbitrary code execution on the machine of whoever runs the command. CISA's KEV catalog does not list this vulnerability as exploited; the source gives no indication of active exploitation.
Affected products and versions
Package llm (PyPI ecosystem), versions <= 0.27.1.
| Product | Versions | Fixed in |
|---|---|---|
| llm | <= 0.27.1 | — |
Action recommended by the source
The source does not state a fixed version or a vendor mitigation. See the references for advisory GHSA-g76p-4vg5-f4qh and the CVE-2026-31236 entry for updates.
Sources and references
- https://github.com/advisories/GHSA-g76p-4vg5-f4qh — GHSA
- https://nvd.nist.gov/vuln/detail/CVE-2026-31236 — GHSA
- https://www.notion.so/CVE-2026-31236-35d1e139318881a4a0f1fffcf671f7e3 — GHSA
- https://access.redhat.com/security/cve/CVE-2026-31236 — GHSA
- https://bugzilla.redhat.com/show_bug.cgi?id=2476636 — GHSA
- https://github.com/pypa/advisory-database/tree/main/vulns/llm/PYSEC-2026-400.yaml — GHSA
- https://pypi.org/project/llm — GHSA
- https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-31236.json — GHSA
Weaknesses (CWE): CWE-94
Relevant change history
Published
Advisory published.