Playing with GZIP: RCE in GLPI (CVE-2020-11060)
GLPI's backup feature wrote a gzip-compressed SQL dump to an attacker-chosen path in the web root, and the dump content could be shaped so the resulting file was also a valid PHP script. An authenticated technician could therefore place a webshell and run commands on the server.
offsec.almond.consulting
Published on offsec.almond.consulting
This article is a deep dive on a vulnerability found in GLPI, others have been identified during the course of this research, you can check them out here: Multiple vulnerabilities in GLPI
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 backup endpoint accepted an attacker-controlled output filename and wrote partially user-controlled data into the web root without restricting the path or the file type.
Impact
An authenticated technician could achieve remote code execution; the text says unauthenticated exploitation is only theoretical because the anti-XSS filter encodes the angle brackets needed to open a PHP tag.
What the attacker needed
A Technician account (default tech/tech); maintenance privilege for backups; known web root path (hash can be cracked)
How it was found
- Log in with a Technician account, which has maintenance privileges by default.
- Create a WiFi network entry whose comment holds the crafted gzip/PHP content.
- Request the SQL backup with the offsettable parameter set so only the WiFi networks table is dumped.
- Set the fichier parameter to a .php path inside the web root.
- Request the written file to trigger the webshell.
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.
GLPI is a helpdesk and IT asset tool written in PHP. Its backup page let a logged-in technician choose where the backup file was saved, and the backup contained text the technician had typed. By carefully choosing that text, the saved backup could double as a small PHP program, so visiting it made the server run the attacker's code.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.