Summary
MajorDoMo's commands module suffers from an unauthenticated SQL injection vulnerability where the parent HTTP parameter is directly interpolated into database queries without sanitization or parameterization.
An attacker can exploit this via a time-based blind SQL injection on the /objects/?module=commands endpoint to extract data such as admin credential hashes and then leverage them for administrative access.
Affected context
This vulnerability appears in the MajorDoMo home automation platform within the commands module, specifically in commands_search.inc.php.
The issue is present when:
- The
/objects/?module=commandsendpoint is reachable over the network - Module loading does not enforce authentication for the
commandsmodule - SQL queries are constructed by concatenating the
$_GET['parent']parameter into query strings
In this configuration, the application exposes a database-backed search capability that can be manipulated through crafted URL parameters.
Exploit preconditions
- Attack surface: HTTP(S) endpoint
/objects/?module=commands - Required access: No prior authentication; attacker only needs network access to the MajorDoMo web interface
- Input vector:
parentquery parameter in requests tocommands_search.inc.php - Trigger point: SQL query construction in the commands search logic, where
$_GET['parent']is interpolated directly into SQL statements - Why exploitation is possible: User-controlled data is concatenated into SQL queries without escaping or prepared statements, enabling time-based blind injection via patterns such as
UNION SELECT SLEEP(...)
Why this happens
The root cause maps to CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
The commands_search.inc.php script uses string concatenation to build SQL queries, inserting the $_GET['parent'] parameter directly into the WHERE clause and other parts of the query.
Because this value is not validated, escaped, or bound as a parameter, an attacker can alter the logic of the underlying SQL query.
The unauthenticated module loading behavior of /objects/?module=commands further broadens exposure by making the vulnerable code executable without any login barrier.
Potential impact
- Extraction of arbitrary data from the database, including entries from the
userstable - Exposure of admin account credentials stored as unsalted MD5 hashes
- Offline cracking of MD5 password hashes and subsequent admin panel login
- Tampering with configuration or automation rules stored in the database
- Potential pivoting to underlying host or network if administrative functions are abused
General mitigation guidance
Effective mitigation focuses on securing both query construction and module exposure:
- Replace string-concatenated SQL with parameterized queries or prepared statements for all user-supplied fields, including
parent - Apply strict input validation and normalization on query parameters, especially those used for filtering or identification
- Enforce authentication and authorization checks for the
commandsmodule and similar system-level modules - Avoid storing passwords as unsalted MD5 hashes; instead, use modern password hashing functions with salt and work factor
- Implement a defense-in-depth model where database accounts used by the application have only the minimal privileges required
How teams detect issues like this
Organizations can identify and monitor this class of vulnerability through:
- Static application security testing (SAST) rules that flag raw
$_GETusage in SQL string concatenations - Manual code reviews that look for dynamic SQL patterns and module entry points exposed without authentication
- Web application firewall (WAF) rules tuned to detect common SQL injection patterns, including time-based payloads
- Database monitoring and anomaly detection for unusual query patterns, such as repeated SLEEP calls or UNION-based probes
- CI/CD pipeline checks that prevent merging code where HTTP parameters flow directly into SQL queries without parameterization

