Tablib Yaml Load Code Execution Vulnerability
Tablib's YAML Databook import used the unsafe yaml.load API, so a crafted YAML document could carry a Python object directive that runs arbitrary commands. An attacker who can supply a YAML file for loading could therefore execute code on the host.
Originally disclosed on Cisco Talos
An exploitable vulnerability exists in the Databook loading functionality of Tablib. A yaml loaded Databook can execute arbitrary python commands resulting in command execution.
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 report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The library used the unsafe yaml.load function instead of a safe loader, allowing Python object directives in the YAML to be instantiated.
Impact
An attacker who can get a victim to load a crafted YAML Databook could execute arbitrary commands with the victim's privileges.
What the attacker needed
Victim loads attacker-supplied YAML
The fix
The unsafe loader should be replaced with yaml.safe_load so that only plain data is parsed.
How it was found
- Create a Tablib Databook object.
- Load a YAML string into it that contains a Python object directive invoking a system command.
- Observe the command's output, showing it executed.
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 report has not been written yet. The Original tab links to the source.
YAML is a text format for structured data, and some YAML parsers can also build programming-language objects. Tablib used a parser mode that builds Python objects, so a malicious file could ask it to run a system command. Anyone who loads such a file runs the attacker's command on their machine.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.