CVE-2026-139989: The languagemodels Python package rendered Hugging Face chat templates in an unsandboxed Jinja2 environment, so a malicious model repo could run commands
languagemodels 1.0.0 contains a template injection in Config.use_hf_model. Someone who controls a Hugging Face model repository can put a crafted chat_template in tokenizer_config.json; because languagemodels renders it with an unsandboxed jinja2 environment, the template can reach the os module and run commands with the victim process's privileges when the user loads that model.
What it is
Hugging Face models ship a Jinja2 chat_template in tokenizer_config.json. Libraries are expected to render it in a sandboxed environment.
languagemodels' Config.use_hf_model loaded the template into a plain jinja2 environment, so template code could reach Python internals and the os module.
Exploitation needs the user to load a model from an attacker-controlled repo. The issue was reported in jncraton/languagemodels issue #43 and fixed in pull request #44; NVD references PyPI release 1.0.1.
How to check
- Run pip show languagemodels; 1.0.0 is affected.
- Check which Hugging Face repos you pass to use_hf_model and whether you trust their owners.
How to fix
- Upgrade languagemodels to the fixed release (NVD references 1.0.1 on PyPI).
- Only load models from repositories you trust, and pin model revisions.
pip show languagemodels | grep -i '^version'
pip install -U languagemodels Sources
- criticalMalicious PyPI packages qwen-tts-cpu and qwen-tts-runtime pose as Qwen text-to-speech add-ons and download and run remote code
- criticalCVE-2023-6730: transformers has a Deserialization of Untrusted Data vulnerability
- highCVE-2026-57845: Loading a dataset with Hugging Face Datasets' pandas builder can run attacker code
- highCVE-2026-114053 and four more: vLLM before 0.31.0 lets a request pick which processor code runs and lets anonymous clients crash or hang the server, upgrade to 0.31.0