Setting up ZoneMinder
ZoneMinder's web interface had a stored XSS in the home URL and login log, and a second-order SQL injection because the username from the login form was stored in the session before authentication and later used unescaped in a SQL query. An attacker could execute arbitrary JavaScript in an admin's browser or inject SQL to manipulate the database.
sjoerdlangkemper.nl
Published on sjoerdlangkemper.nl
While searching for vulnerable projects I encountered ZoneMinder, a video surveillance software system. I found several vulnerabilities in its web interface, including second order SQL injection.
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 application stored user-supplied input in the session before authentication and later concatenated it into a SQL query without escaping, and also failed to encode output in log and link fields.
Impact
An attacker could execute JavaScript in an administrator's browser via stored XSS, and perform unauthenticated SQL injection to read or modify the database.
What the attacker needed
Authentication disabled for XSS; admin views log for XSS; no login required for SQLi
The fix
The vulnerabilities were fixed according to the linked issues.
How it was found
- Set the home URL to a value containing a quote and an event handler to trigger stored XSS.
- Enable authentication and log in with a username containing HTML to inject script into the log.
- Log in with a username containing a SQL time-delay payload to store it in the session.
- Call an API endpoint with an auth parameter to trigger the stored SQL injection.
- Use sqlmap with the login request and second URL to confirm and exploit the SQL injection.
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.
The login page saved whatever username you typed into your session before checking if the password was correct. Later, another part of the site used that saved username directly in a database query without cleaning it, so an attacker could sneak in database commands. Separately, some input fields were shown on pages without proper escaping, letting attackers run JavaScript in other users' browsers.
What is SQL injection?
Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.