Skip to content
RCE Write-up Intermediate

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.

Edoardo Ottavianelli Follow

Published on hacktivesecurity.com

AI Application Security

Edoardo Ottavianelli, on hacktivesecurity.com

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

  1. Install the datapizza-ai package
  2. Create a Python file containing the exploit code
  3. 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.

More by Edoardo Ottavianelli

View all

2 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.