Ubuntu’s Crash Report Tool Allows Remote Code Execution
Ubuntu's Apport crash handler evaluated the CrashDB field from a crash file as Python code, and also allowed path traversal when loading hook scripts. An attacker could achieve code execution by convincing a user to open a malicious crash file.
donncha.is
Published on donncha.is
In this post I’ll describe how I found a remote code execution bug in Ubuntu Desktop which affects all default installations >= 12.10 (Quantal). The bug allows for reliable code injection when a user simply opens a malicious file.
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 CrashDB field from an untrusted crash file was passed directly to Python's eval() without validation, and the Package field was used unsanitised to build a file path for hook scripts.
Impact
An attacker could execute arbitrary code with the user's privileges when the user opens a malicious file; if a crash file is placed in /var/crash by a low-privileged user and the user accepts a PolicyKit prompt, code execution as root is possible.
What the attacker needed
Victim opens a malicious file; Apport installed (default on Ubuntu >= 12.10)
The fix
The issues were fixed in Apport packages released on 2016-12-14.
How it was found
- Create a crash file with a CrashDB field containing Python code and ProblemType set to Bug.
- Save the file with a .crash extension or any unregistered extension.
- Open the file; the desktop environment launches apport-gtk.
- Apport-GTK switches to the Bug GUI and evaluates the CrashDB field, executing the code.
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.
Apport is a program that handles crash reports on Ubuntu. It reads a file that describes a crash, and it mistakenly runs part of that file as computer code. So if someone sends you a fake crash file and you open it, their code can run on your computer.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.