---
id: "CVE-2026-31236"
page: "https://infrastack.ai/live/CVE-2026-31236"
kind: "vulnerability"
aliases: ["CVE-2026-31236", "GHSA-g76p-4vg5-f4qh"]
title: "llm CLI tool contains a code injection vulnerability via `--functions` command-line argument"
severity: "critical"
cvss: 9.8
epss: 0.00327
exploited: false
status: "open"
category: "ai-tooling"
products: [{"name": "llm", "fixed": [], "affected": "<= 0.27.1", "ecosystem": "pypi"}]
ecosystems: ["pypi"]
tags: ["ai-cli", "ai-tooling", "cwe-94", "developer-machines", "llm", "python"]
not_affected_if: ["no-untrusted-command-input", "version-above-0.27.1"]
published_at: "2026-05-12T18:16:51+00:00"
first_seen_at: "2026-11-16T15:12:10+00:00"
updated_at: "2026-11-16T15:37:59+00:00"
sources: [{"source": "ghsa", "url": "https://github.com/advisories/GHSA-g76p-4vg5-f4qh", "first_seen_at": "2026-11-16T15:12:10+00:00"}, {"source": "nvd", "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-31236", "first_seen_at": "2026-11-16T15:37:59+00:00"}]
exploit_sources: [{"type": "epss", "score": 0.00327, "url": "https://api.first.org/data/v1/epss?cve=CVE-2026-31236"}]
---

# llm CLI tool contains a code injection vulnerability via `--functions` command-line argument

Link for people: https://infrastack.ai/live/CVE-2026-31236 (this .md is for agents)

The llm command-line tool passes its --functions argument straight into Python's exec() with no checks, so any Python code given there runs on the machine. An attacker who gets a user to run a crafted llm command gets arbitrary code execution with that user's full control.

_Summary, check and fix written by a model from the sources; labelled as such._

## Affected

- pypi:llm affected <= 0.27.1 fixed no fixed version listed

## How to check

- Run `llm --version` and compare against the affected range `<= 0.27.1`.
- Check whether any scripts, shell aliases or CI jobs pass `--functions` with content from outside your team.

## Fix

- `llm` fixed version: unknown; the sources list the affected range as thru 0.27.1 with no fixed version stated.

## Timeline

- 2026-11-16T15:12:10+00:00 ghsa https://github.com/advisories/GHSA-g76p-4vg5-f4qh
- 2026-11-16T15:37:59+00:00 nvd https://nvd.nist.gov/vuln/detail/CVE-2026-31236

## From the sources

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.

---

_Free to read, with fair use of about 60 pages a minute. For higher limits or API access: sales@infrastack.ai_
