CyberWatch

Python LLM Package Vulnerable to Arbitrary Code Execution

By

Matthew Fagan and Alexander Marshall, Access Point Consulting

By

Access Point Consulting

Summary

CVE-2024-34359 (CVSSv3: 9.7) is a critical vulnerability in the Jinja2 template engine within the llama_cpp_python package, used in AI applications. The inadequate security measures in Jinja2 allow attackers to inject malicious templates that can execute arbitrary code on the host system. The vulnerability was discovered by retr0reg, who also provided a proof-of-concept exploit.

Impact Assessment

This vulnerability affects individual privacy and organizational operational integrity. The llama_cpp_python package is widely used in trusted LLM sites, with millions of downloads. The risk associated with this vulnerability is substantial, potentially impacting numerous language models and AI applications.

Affected Versions

  • Vulnerable versions: >=v0.2.30, <=v0.2.71

Remediation

The issue has been resolved in version 0.2.72 of the llama_cpp_python package, which includes enhanced sandboxing and input validation measures.

What It Means for You

If you or your organization uses AI technology with Large Language Models, verify whether your models include the llama_cpp_python package. If they do, update to the latest version (0.2.72) immediately.

Business Implications

Exploitation of this vulnerability can lead to significant consequences, including:

  • Compromise of sensitive data used for AI training
  • Remote code execution, allowing attackers to install malware, perform data exfiltration, or conduct lateral movements within the network
  • Financial losses due to disaster recovery efforts and potential public relations crises
  • Reputational damage from being compromised

Recommendations

  • Patch Immediately: Upgrade to a non-vulnerable version of the llama_cpp_python package if you are using a vulnerable version.
  • Secure Modern Technologies: Treat AI technologies with the same security rigor as any other software. Ensure that proper security measures are in place to mitigate vulnerabilities and protect sensitive data.

Associated Bulletins

  • Llama Drama: Vulnerability Threatening Your Software Supply Chain
  • NVD Vulnerability Details for CVE-2024-34359
  • GitHub Security Advisory for llama-cpp-python


For further assistance, contact:

 

Resources

Latest Resources

Resources

CyberWatch

April 2, 2025

Scott "Monty" Montgomery (Island) | Navigating CMMC compliance for organizations of every size

Scott Montgomery, known as Monty, joined the CyberWatch Expert Series podcast to discuss his extensive background in cybersecurity, particularly in building and designing network security tools for high-assurance environments like the Department of Defense (DoD) and the intelligence community. His experience includes significant tenure at McAfee (now Trellix), which led him to his current role at Island, where he focuses on innovative approaches to cybersecurity compliance.

Find out more
March 19, 2025

Michael Sviben (DomainGuard) | Defending against phishing and building proactive security awareness

Cybersecurity threats evolve rapidly, and one tactic consistently rises above the rest: phishing. In this episode of CyberWatch, Michael Sviben, co-founder of DomainGuard, discusses why phishing remains so effective, how businesses and individuals become targets, and what you can do to stay vigilant.

Find out more
March 5, 2025

David Habib (Brightspot) | Building a culture of cybersecurity awareness

Cybersecurity awareness is often reduced to check-the-box training, but David Habib, CIO at Brightspot, argues that real security awareness isn’t about formal programs—it’s about making security part of a company’s culture. In this episode, he shares practical insights on how organizations can move beyond stale training sessions to create an engaged and security-conscious workforce.

Find out more