nday
CVE-2024-34359 GHSA-56xg-wfcc-g829

llama-cpp-python vulnerable to Remote Code Execution by Server-Side Template Injection in Model Metadata

abetlen / llama-cpp-python

Patch on record 920 days after disclosure. Patched: fixed in llama-cpp-python 0.2.72. None of the four PoC sources lists it. Not in CISA KEV.

why these tags

nday derives these tags by fixed rules from the facts below; NVD, the CNA and other sources do not assign them. Vocabulary and rules: ~/tags.

network
AV:N in CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H (CVSS 3.1) from the CNA GitHub_M
no authentication required
PR:N in CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H (CVSS 3.1) from the CNA GitHub_M
PyPI
GHSA-56xg-wfcc-g829: pip packages llama-cpp-python
stage
PAT
disclosed
disclosure → patch
T+920d
cvss
9.7 CRITICAL v3.1

Lifecycle

x axis UTC; dot = exact minute, wide bar = date only, hollow = unknown or inferred.
time unknown
DISdisclosed
2024-05-10T17:07Z
PATpatch
2026-11-16T16:00Z
ANAanalysis
no record yet
POCPoC
no record yet
ITWexploited
no record yet
KEVKEV
no record yet

Summary

llama-cpp-python is the Python bindings for llama.cpp. llama-cpp-python depends on class Llama in llama.py to load .gguf llama.cpp or Latency Machine Learning Models. The __init__ constructor built in the Llama takes several parameters to configure the loading and running of the model. Other than NUMA, LoRa settings, loading tokenizers, and hardware settings, __init__ also loads the chat template from targeted .gguf 's Metadata and furtherly parses it to llama_chat_format.Jinja2ChatFormatter.to_chat_handler() to construct the self.chat_handler for this model. Nevertheless, Jinja2ChatFormatter parse the chat template within the Metadate with sandbox-less jinja2.Environment, which is furthermore rendered in __call__ to construct the prompt of interaction. This allows jinja2 Server Side Template Injection which leads to remote code execution by a carefully constructed payload.

Original text of the CVE record (cvelist), shown as published.

Exploit conditions

What an attack needs, read from the CVSS vector.
Attack vector AV:N
Network: the attacker only needs to reach it over the network
Attack complexity AC:L
Low: no special conditions; the attacker can expect repeatable success
Privileges required PR:N
None: no account or authorization needed
User interaction UI:R
Required: a user must do something, such as open a file or click a link

CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H

CVSS 3.1 vector from the CVE record, scored by the CNA GitHub_M.

Event log

+DISdisclosed

CVE record published by GitHub_M. CVSS 9.7, critical. CISA's SSVC assessment rates exploitation as poc.

src cvelist · nday , bulk import · raw
{
  "id": 333071,
  "type": "disclosed",
  "source": "cvelist",
  "url": "https://www.cve.org/CVERecord?id=CVE-2024-34359",
  "occurred_at": "2024-05-10T17:07:18.85Z",
  "observed_at": "2026-11-13T05:38:34.075966Z",
  "is_backfill": true,
  "dedupe_key": "",
  "detail": {
    "cvss": {
      "source": "cna",
      "vector": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H",
      "version": "3.1",
      "base_score": 9.7,
      "base_severity": "CRITICAL"
    },
    "ssvc": {
      "timestamp": "2024-05-15T19:35:24.408358Z",
      "automatable": "no",
      "exploitation": "poc",
      "technical_impact": "total"
    },
    "state": "PUBLISHED",
    "date_published": "2024-05-10T17:07:18.850Z",
    "assigner_short_name": "GitHub_M"
  }
}
no source time; observed live by nday
+PATpatch released

The advisory gives fixed version llama-cpp-python 0.2.72. Fix commits are linked. Advisory published ; the patch's own release time is not recorded.

src ghsa GHSA-56xg-wfcc-g829 · nday , observed live · raw
{
  "id": 472942,
  "type": "patch_released",
  "source": "ghsa",
  "url": "https://github.com/advisories/GHSA-56xg-wfcc-g829",
  "occurred_at": null,
  "observed_at": "2026-11-16T16:00:12.562502Z",
  "is_backfill": false,
  "dedupe_key": "GHSA-56xg-wfcc-g829",
  "detail": {
    "cvss": {
      "cvss_v3": {
        "score": 9.6,
        "vector_string": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H"
      },
      "cvss_v4": {
        "score": 0.0,
        "vector_string": null
      }
    },
    "cwes": [
      {
        "name": "Improper Neutralization of Equivalent Special Elements",
        "cwe_id": "CWE-76"
      }
    ],
    "ghsa_id": "GHSA-56xg-wfcc-g829",
    "packages": [
      {
        "name": "llama-cpp-python",
        "ecosystem": "pip",
        "first_patched_version": "0.2.72",
        "vulnerable_version_range": ">= 0.2.30, <= 0.2.71"
      }
    ],
    "severity": "critical",
    "references": [
      "https://github.com/abetlen/llama-cpp-python/security/advisories/GHSA-56xg-wfcc-g829",
      "https://nvd.nist.gov/vuln/detail/CVE-2024-34359",
      "https://github.com/abetlen/llama-cpp-python/commit/b454f40a9a1787b2b5659cd2cb00819d983185df",
      "https://github.com/pypa/advisory-database/tree/main/vulns/llama-cpp-python/PYSEC-2026-392.yaml",
      "https://pypi.org/project/llama-cpp-python",
      "https://github.com/advisories/GHSA-56xg-wfcc-g829"
    ],
    "fix_commit_urls": [
      "https://github.com/abetlen/llama-cpp-python/commit/b454f40a9a1787b2b5659cd2cb00819d983185df"
    ],
    "github_reviewed_at": "2024-05-13T14:10:18Z",
    "advisory_updated_at": "2026-11-16T15:19:29Z",
    "source_code_location": "https://github.com/abetlen/llama-cpp-python",
    "advisory_published_at": "2024-05-13T14:10:18Z"
  }
}

Report an error

report an error or omission

Something on this page wrong or missing? Tell the editors; if they accept it, this page's revision log says so publicly. Upstream data is not changed.

Researcher discussion

0 researchers mentioned this in the last 7 days

Posts on X by researchers on nday's list that mention this CVE, shown as posted. nday does not check them.

nday has not collected any post on X by listed researchers that mentions this CVE.

Discussion

0 comments

No comments yet.