v0.12.1
v0.12.1 — Security Patch
This is a patch release that addresses a Jinja2 template injection vulnerability. All users of PyRIT 0.12.0 and earlier are encouraged to upgrade.
pip install --upgrade pyrit
What's changed
Security fix: Jinja2 Template Injection (SSTI)
PyRIT's template rendering used an unsandboxed Jinja2 Environment. Remote dataset loaders passed fetched data directly into SeedPrompt(value=...), which rendered it as a Jinja2 template in __post_init__. A poisoned dataset could exploit this for Python object traversal.
Mitigations in this release:
- Sandboxed rendering: All Jinja2 rendering now uses
SandboxedEnvironment, blocking unsafe attribute access (__class__,__mro__,__subclasses__()) - Safe-by-default
SeedPrompt: Newis_jinja_templatefield (defaultFalse) auto-escapes values. Only trusted sources (YAML files loaded viafrom_yaml_file) opt in to template rendering. - Vendored many-shot dataset: The many-shot jailbreaking dataset is now bundled locally, eliminating a runtime
requests.get()to an external GitHub URL.fetch_many_shot_jailbreaking_datasetis
deprecated in favor ofload_many_shot_jailbreaking_dataset(removal in 0.14.0).
Action required
- Upgrade:
pip install --upgrade pyrit - If you construct
SeedPromptwith Jinja2 template syntax in your own code, addis_jinja_template=Trueto preserve rendering behavior. Without it, template syntax is now auto-escaped by default. - If you call
fetch_many_shot_jailbreaking_dataset(), switch toload_many_shot_jailbreaking_dataset().
Full list of changes
- FIX Mitigate Jinja2 Template Injection (SSTI) vulnerability (#1577) @romanlutz @adrian-gavrila
Full Changelog: v0.12.0...v0.12.1