Hugging Face patches Jinja2Shell flaw that let malicious models run code on AI servers

RunSybil found that a crafted chat template could exploit a CPython memory flaw; the fix is in Transformers 5.22.2.

2 Dec 2026

Hugging Face has patched a vulnerability called Jinja2Shell that could have let attackers run code on servers that host AI models, security firm RunSybil says. RunSybil found the flaw this summer and made it public in early November.

Cybersecurity AI Weekly covers stories like this, every Monday. Free.

Many models ship with Jinja chat templates that structure conversations between the model and its users, and these run inside a Python sandbox. RunSybil showed that a specially crafted template bundled with a model could exploit a previously unreported memory-safety flaw in CPython, the main Python interpreter, to break out of that sandbox and execute code on the server. It says attackers could have gained a foothold in servers processing millions of requests and in the cloud infrastructure behind them. RunSybil says human effort paired with OpenAI's GPT-5.6 Sol let it build the exploit in less than a day.

Hugging Face shipped protections in Transformers 5.22.2, which restrict the Python features untrusted templates can use. "Users should upgrade to transformers v5.22.2 or later, which includes the fix," the company said. A separate fix for the CPython flaw itself is only available in later versions of the interpreter, so the library patch also protects users who cannot upgrade Python.

In this story

RunSybil Hugging Face

Whitepaper

Tensordyne Napier: What If One Rack Could Do the Work of Nine?

Tensordyne

This Tensordyne whitepaper presents Napier, an inference-focused AI processor and rack-scale system based on the company’s TDN Math logarithmic number system. It examines infrastructure requirements for large mixture-of-experts and agentic models, compares major inference architecture approaches, and details the TDN AIP processor, TDN72 pod, TDN Link fabric, and Napier Ultra configuration. The paper reports simulation-based performance, cost, and accuracy-validation results, including Tensordyne’s projected comparison of one Napier rack with a nine-rack Nvidia Rubin plus Groq deployment; the chip is reported as taped out and in fabrication.

Read more
Free, six days a week

Daily AI Brief: the AI news that matters, in your inbox.