CVE-2026-31236 — llm
CRITICALCVE-2026-31236 is a critical-severity (CVSS 9.8) Code Injection vulnerability in llm. The records list no fixed version yet; check the vendor advisory below and apply the mitigations in the meantime.
llm CLI tool contains a code injection vulnerability via `--functions` command-line argument
Exploitation Status
No confirmed exploitation observed yet
- CISA assesses this as automatable — exploitation doesn’t require manual, per-target effort, which raises the odds of mass scanning and opportunistic attacks.
- A successful exploit gives an attacker total control of the affected component, not partial access.
- CISA’s own triage has not observed active exploitation or public proof-of-concept code for this CVE as of its last assessment.
Exploitation and automatability from CISA’s SSVC triage for CVE-2026-31236.
EPSS Exploitation Probability
Probability of exploitation in the next 30 days, from FIRST.org EPSS.
How urgent is this, really
Where this sits among everything scored
Real-World Exposure
llmReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects PyPI packages — download data is not available via public APIs for these ecosystems.
Description
The llm CLI tool thru 0.27.1 contains a critical code injection vulnerability via its --functions command-line argument. This argument is intended to allow users to provide custom Python function definitions. However, the tool directly executes the provided code using the unsafe exec() function without any sanitization, sandboxing, or security restrictions. An attacker can exploit this by crafting a malicious llm command with arbitrary Python code in the --functions argument and using social engineering to trick a victim into running it. This leads to arbitrary code execution on the victim's system, potentially granting the attacker full control.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🐍PyPI | llm | all versions | No fix |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for llm, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Remediation status
The records we use list no patched version of llm for CVE-2026-31236. Check the maintainer's advisory, and where your build allows, override or pin the dependency away from the vulnerable range.
Mitigate without a patch
Stop passing untrusted input into the interpreter or shell: call the affected binary with an argument array rather than a composed command string, reject anything outside a strict allowlist of expected values, and run the component under an account that cannot reach beyond the work it legitimately does.
Fixing This On Your OS
If you run this on a Linux distribution, patch through your package manager against the distro's own security advisory below — it tracks the exact backported fix for your release, which can ship on a different timeline (and sometimes a different severity) than the upstream project.
This flaw is rated as Important (CVSS 7.3) because the llm tool is a local command-line application, not a network-facing service (AV:L), and exploitation requires a local user with the tool installed (PR:L) to be socially engineered into executing a specially crafted command containing malicious Python code in the…
The `--functions` argument in the llm CLI tool executes arbitrary Python code by design, similar to `python -c`. There is no built-in sandboxing or restriction on the code that can be run. To reduce the risk of exploitation, run the llm process inside a sandbox such as a container or a VM.Source: Red Hat security advisory for CVE-2026-31236 (CC BY 4.0)
Frequently Asked Questions
Is CVE-2026-31236 in your dependencies?
Find it across PyPI, including transitive dependencies.