A crafted AI model template can turn a CPython memory-safety bug into code execution inside an inference server. RunSybil’s demonstration raises a practical concern for providers that let customers upload their own models: a template can reach the process serving requests, potentially exposing infrastructure used by multiple customers.
The Python Security Response Team (PSRT) accepts that the underlying interpreter bug existed and was fixed, but rejects classifying the sandbox escape as a CPython security vulnerability. That distinction shapes who is expected to defend AI workloads from untrusted code.
A stale type-parameter list opens the way
RunSybil traced the flaw to CPython’s handling of generic types. The interpreter can retain a cached list of parameters after a callback modifies an object. If it then searches that stale list for a newly added parameter, it can produce an invalid index.
An assertion intended to catch the condition is disabled in standard release builds. That can let the interpreter access memory outside the expected bounds. RunSybil used the behavior to recover references to Python objects that a template sandbox was meant to keep hidden.
“While an invalid address will generally crash the interpreter, an address pointing to a useful live Python object gives our callback a reference to that object (even when the sandbox never intends to expose it),” RunSybil researcher Darius Houle wrote.
Those references gave the researchers access to Python classes and functions they could use to assemble executable code. Houle said the exploit used objects available in template sandboxes, including empty ones.
A model template carries the exploit
For its proof of concept, RunSybil altered Qwen2.5-0.5B-Instruct by adding a backdoored chat_template.jinja file. Loading and serving the model with an engine such as vLLM then enabled arbitrary code execution in the serving process.
Jinja templates help structure exchanges between users and large language models. In a bring-your-own-model setup, a provider may process templates supplied with customer models. RunSybil warned that a malicious template could therefore put the provider’s shared infrastructure at risk. The researchers said they gave proof-of-concept exploits to multiple providers offering BYOM services.
“Breaking out of the chat template sandbox and executing code represents a supply chain risk that endangers inference providers, library developers, and model users,” Houle wrote.
CPython draws a boundary around its security role
RunSybil reported the issue to CPython, the Pallets Project, which maintains Jinja, and Hugging Face. The researchers said the disclosures produced conflicting views about which project should handle the problem.
PSRT told CSO that it appreciated RunSybil’s work but did not consider the demonstrated escape a CPython security vulnerability. Its position is that CPython does not promise to sandbox untrusted Python code. Under the project’s security policy, escapes from sandboxing software should be handled by that software’s maintainers.
The team also challenged RunSybil’s account of the reporting process, saying the report arrived by email instead of through CPython’s private GitHub vulnerability reporting channel.
Python 3.12 remains the adoption concern
RunSybil submitted a patch that entered CPython’s main development branch on Aug. 14. PSRT said the change was backported to Python 3.13, 3.14 and 3.15 as a regular bug fix, rather than a security fix. It was not backported to Python 3.12.
That gap matters to RunSybil because, Houle said, substantial parts of the AI ecosystem still use Python 3.12. He warned that organic adoption of the memory-safety fix might not arrive until that branch reaches end of life in late 2028.
For inference providers, the immediate takeaway is architectural: treat template sandboxes and similar evaluators as limited safeguards, and keep untrusted model content from becoming a direct route into the serving process.