Skip to content

An editorial team and a community building with AI

← All articles

News · jncraton/languagemodels (PyPI package "Languagemodels") · 2 min read

Event date: · Published:

Languagemodels PyPI package patches high-severity chat_template RCE flaw

A high-severity template-injection vulnerability in the Languagemodels PyPI package let a malicious Hugging Face model's chat_template field execute arbitrary code; it was fixed in version 1.0.1.

GitHub Security Advisories disclosed a high-severity vulnerability in the Languagemodels PyPI package, maintained by jncraton, on November 30, 2026, in the GitHub Security Advisories advisory for GHSA-v286-88f6-fh24. The flaw let a malicious Hugging Face model's chat_template field execute arbitrary code when loaded, and it has been fixed in version 1.0.1.

What changed

  • CVE-2026-139989 (GHSA-v286-88f6-fh24) carries a CVSS score of 8.5 (High) and is classified as CWE-1336, template injection.
  • The vulnerability sits in the Config.use_hf_model function, where a malicious Hugging Face model's chat_template field can trigger code execution.
  • The library renders chat templates with an unsandboxed Jinja2 environment, allowing an attacker-controlled template to reach Python's os module.
  • Anyone who points use_hf_model at an attacker-controlled Hugging Face model repository risks code execution with the privileges of the victim process.
  • Version 1.0.0 is affected; version 1.0.1, published on PyPI, contains the fix.
  • The advisory was published on November 30, 2026.

What it means for people who build with AI

The case is a concrete example of a supply-chain risk pattern that affects anyone pulling community Hugging Face models into their own pipelines: metadata inside a model repository, in this instance the chat_template field, can be weaponized to run code on the machine that loads it. Because the template is rendered through Jinja2 without sandboxing, trusting a model's files implicitly also means trusting whatever code its template can reach, including Python's os module.

Fix and availability

The fix ships in Languagemodels version 1.0.1 on PyPI, and projects currently on version 1.0.0 should upgrade before loading Hugging Face models through use_hf_model. Treat chat_template content from third-party repositories the same way you would treat any other untrusted code before running it.


Sources

Written with AI assistance, strictly from the sources listed above. Before it went live, automated checks verified its dates, sources and every language edition.

Languagemodels PyPI package patches high-severity chat_template RCE flaw | vibecoding.inc