Skip to content

← Actionable
Critical, CVSS 9.6amended

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

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

What to do

Vendor fix available. Upgrade each affected package to the fixed version on its release line (llama-cpp-python 0.2.72), redeploy, then verify what is actually installed.

This page has no inventory attached, so it cannot say whether you are affected. A vendor fix is not proof that your deployment is fixed.

Affected packages

Sources

Severity and exploitation
Exploitation
No confirmed exploitation recorded. Patch Next marks exploitation only from CISA KEV.
CVSS
9.6 · CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H
EPSS
  • CVE-2024-34359: 26.00% estimated exploitation activity in the next 30 days; percentile 97.99 (FIRST EPSS, 2026-11-03). This is a model estimate, not proof of exploitation or customer exposure.
Source description

As published by the source; long descriptions are shortened.

Description 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 llamachatformat.Jinja2ChatFormatter.tochathandler() to construct the self.chathandler 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 RCE by a carefully constructed payload. Source-to-Sink llama.py - class Llama - init: In llama.py, llama-cpp-python defined the fundamental class for model initialization parsing (Including NUMA, LoRa settings, loading…

Dates and revisions
Published by the source
Last modified by the source
Source last checked
  1. Revision 2 · amended ·

    Amended from ghsa record GHSA-56xg-wfcc-g829

  2. Revision 1 · created ·

    Published from osv record GHSA-56xg-wfcc-g829

Agent brief

Preview the exact text before you copy it. Commands are read-only suggestions; review them before running anything.

# Patch Next advisory brief: CVE-2024-34359

Advisory: llama-cpp-python vulnerable to Remote Code Execution by Server-Side Template Injection in Model Metadata
IDs: CVE-2024-34359, GHSA-56xg-wfcc-g829
Record: https://patchnext.com/advisories/cve-2024-34359 (revision 2, source checked 26 Oct 2026, 13:13 UTC)
Inventory: none attached. This brief comes from a public page and does not say whether any deployment is affected.
Severity: Critical (CVSS 9.6)
Exploitation: no confirmed exploitation recorded. Patch Next confirms exploitation only from CISA KEV.
Vendor response: Vendor fix available; fixed versions by package: llama-cpp-python 0.2.72. A vendor fix does not mean a deployment is fixed.

## Affected components
- PyPI llama-cpp-python: affected >= 0.2.30, <= 0.2.71; fixed in 0.2.72

## Suggested inspection (read-only)
- `python -m pip show llama-cpp-python`: prints the installed version. Run with the environment that serves production active.

## Supported action
Upgrade each affected component to a fixed version on its release line. For a transitive dependency, upgrade the parent package or add an override or constraint, then regenerate the lockfile. Redeploy every environment that ran an affected version.

## Required regression checks
- Run the test suite and a production build.
- Exercise the features that depend on llama-cpp-python.
- Repeat the inspection and confirm that only fixed versions remain installed.

## Rollback considerations
- Keep the previous lockfile and deployment artifact. Rolling back reinstates the vulnerable version, so apply any documented mitigation while you fix forward.

## Unresolved questions
- Which deployments run an affected version?
- Exploitation status can change. Check again before lowering the priority.
- Mark the work resolved only after the fixed version is verified in production.

## Sources
- Verified: https://osv.dev/vulnerability/GHSA-56xg-wfcc-g829 (OSV record GHSA-56xg-wfcc-g829 lists affected ranges: PyPI llama-cpp-python >=0.2.30 <0.2.72 (fixed))
- Verified: https://github.com/advisories/GHSA-56xg-wfcc-g829 (GitHub-reviewed advisory GHSA-56xg-wfcc-g829 lists affected ranges: PyPI llama-cpp-python >=0.2.30 <=0.2.71)

Commands are suggestions: review each one before running it.

Loading voting…