datapizza-ai, Yet Another Vulnerable AI Framework
Two remote code execution flaws were found in the datapizza-ai framework. The first stems from unsafe use of the Jinja2 template engine, letting an attacker run code through crafted template input.
Published on hacktivesecurity.com
AI Application Security
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the prompt module passes user-controlled text into Jinja2's rendering functions without sandboxing or escaping, so template syntax is evaluated as code.
Impact
An attacker could achieve remote code execution on the host running the framework, though the text gives no further detail on constraints.
What the attacker needed
Ability to supply input to a prompt template
How it was found
- Install the datapizza-ai package
- Create a Python file containing the exploit code
- Execute the file to trigger the vulnerability
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
A template engine is a tool that fills in placeholders in text to produce output, and Jinja2 is a popular one for Python. If a program lets untrusted input be treated as a template, that input can contain instructions the engine will execute as code. Here that means someone could run their own commands on the server.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.