CVE-2019-15715: MantisBT Post-Authentication Command Injection
A couple of days ago (depending on when this is actually published), I discovered a post-authentication (administrator required) vulnerability in MantisBT that allows command execution through command injection.
The interesting part is the way it works. I'm not sure most vulnerability scanners would've picked up on this: it doesn't quite look like user input, and the way I actually discovered it was via a hybrid black-box/white-box approach.
Basically, keeping things short: MantisBT's administration interface allows reconfiguring any option you'd normally configure through the config.inc.php file.
Using this, it's possible to change the path for specific tools typically used to generate graph files, then visit one of the URLs that's normally supposed to call that tool with proc_open. Between the point where the configuration variable is checked and where proc_open happens, there's no sanitization in place.
A lot of this is mitigated by the fact that configuring those options requires administrator access. However, a fresh MantisBT install comes with default credentials of "Administrator:root" and doesn't force the administrator to change them on first login; it simply warns the user to change them… and that warning actually works in an attacker's favor too, because it tells them the default password is still in use.
This also means it's easy to find these default installations with some slight dorks on Google or other search engines.
On another note, those same configuration options also let an administrator change file storage from the database to disk. While that's not exploitable, since it creates random MD5 hashes for file names, I still found it interesting nonetheless, because you'd assume these kinds of things could only be changed from the configuration file.
This was fixed in the following commit: mantisbt@fc7668c
Additional details: CVE-2019-15715 on NVD
I'll update the blog in the next few days with a detailed technical analysis of how the bug was discovered and how to actually exploit it, and possibly a PoC.

Comments