Summary
MajorDoMo exposes an unauthenticated endpoint that allows attacker-controlled property values to be stored in the database and later rendered as HTML/JavaScript in the admin interface without escaping.
When an administrator opens the property editor, the malicious content executes automatically, and because session cookies are not marked HttpOnly, this can lead to session hijacking and full admin takeover.
Affected context
The vulnerability appears in MajorDoMo's property handling for IoT device integration, specifically the /objects/?op=set endpoint and the admin panel property editor.
The system is designed so that /objects/?op=set is intentionally unauthenticated to accept updates from devices, and user-supplied property values are persisted directly to the database.
In affected setups, the admin panel's property editor page displays these values in both a paragraph tag (SOURCE field) and a textarea (VALUE field) without HTML escaping.
This behavior becomes risky when external networks, untrusted devices, or integrators can reach the unauthenticated endpoints or when the admin interface is used from browsers with active sessions.
Exploit preconditions
- Attack surface:
- Publicly or internally exposed
/objects/?op=setendpoint for property updates - Accessible
/api.php/data/endpoint allowing property enumeration - Administrative web interface where properties are viewed
- Required access:
- Network-level access to the MajorDoMo instance (no authentication required for
/objects/?op=setand/api.php/data/) - An administrator must later view the affected property in the admin panel while logged in
- Trigger point:
- Stored XSS fires automatically when the admin opens the property editor page, as the stored payload is rendered unescaped in the SOURCE and VALUE fields on page load
- Why exploitation is possible:
- Property values are accepted from unauthenticated sources and stored without validation or sanitization.
- The admin UI reflects these values without HTML encoding.
- The session cookie is not marked HttpOnly, enabling JavaScript access to
document.cookieand subsequent session hijacking.
Why this happens
This issue is rooted in treating untrusted input as safe content during server-side rendering, consistent with CWE-79: Improper Neutralization of Input During Web Page Generation (Cross-site Scripting).
The /objects/?op=set endpoint persists user/device-supplied data directly to the database without applying an output-neutral format (e.g., proper HTML encoding) or any server-side sanitization.
When the admin property editor renders the SOURCE and VALUE fields in HTML, it inserts these raw values into a paragraph tag and a textarea element without escaping, allowing embedded scripts or event handlers to become part of the DOM and execute.
This is compounded by a session management weakness: session cookies lack the HttpOnly attribute, meaning that once arbitrary JavaScript is executing in the admin's browser, it can read and exfiltrate the session token, facilitating full account compromise.
Potential impact
- An attacker may hijack administrator sessions by exfiltrating non-HttpOnly session cookies via JavaScript.
- Malicious scripts can run with the admin's privileges, allowing configuration changes, new user creation, or disabling of security features.
- Attackers could modify or delete IoT device properties, disrupt automation logic, or manipulate sensor readings and actuator commands.
- Further attacks against the administrator's browser environment can occur, such as keylogging, phishing overlays, or browser-based pivoting to other internal systems.
- Persistent XSS payloads may remain active until the affected property values are identified and cleaned, prolonging exposure.
General mitigation guidance
Effective mitigation focuses on strict separation between untrusted input and rendered HTML, hardening of unauthenticated interfaces, and robust session protection:
- Output encoding by context:
- Apply HTML entity encoding to all dynamic content before inserting it into the DOM, especially in the admin property editor.
- Use templating engines or frameworks that auto-escape by default and treat any raw HTML insertion as an exception that requires explicit justification.
- Input trust reduction:
- Treat all data originating from
/objects/?op=setand/api.php/data/as untrusted, regardless of presumed device authenticity. - Optionally introduce allowlists or structured schemas for property values (e.g., numeric ranges, strings of limited length, or enumerated values) to prevent arbitrary markup.
- Interface hardening:
- Reconsider intentionally unauthenticated endpoints; where possible, use lightweight authentication (API keys, device tokens, or signed payloads) rather than fully open endpoints.
- Segment device-update endpoints onto isolated network paths or interfaces not reachable from general user networks or the internet.
- Session protection:
- Configure session cookies to use security attributes (HttpOnly, Secure, and SameSite where appropriate) so that browser-executed scripts cannot access tokens.
- Avoid exposing sensitive session identifiers in any client-readable storage.
- Least privilege for admin operations:
- Limit which admin roles can access sensitive configuration and property editing screens.
- Encourage the use of separate, low-privilege accounts for routine monitoring and higher-privilege accounts for configuration tasks only when needed.
How teams detect issues like this
To identify and monitor this class of vulnerability, organizations can use a mix of code-centric and runtime strategies:
- Static analysis and code scanning:
- Configure static analysis tools or linters to flag direct insertion of untrusted variables into HTML templates without encoding, particularly in admin panel views related to properties.
- Search for raw echo/print/render calls that combine HTML markup with unescaped dynamic values from request parameters or database fields associated with
/objects/?op=set. - Security-focused code review:
- During manual reviews, trace data flow from unauthenticated endpoints (
/objects/?op=set,/api.php/data/) through the persistence layer into the admin templates. - Look for patterns where user/device input is stored and later displayed to privileged users without clear sanitization or encoding steps.
- Dynamic testing / DAST:
- Use application security testing tools to inject benign XSS test strings into properties via the unauthenticated endpoints and verify whether those strings appear unencoded when viewing the admin UI.
- Incorporate these tests into CI/CD pipelines to catch regressions when templates or device integration logic change.
- Runtime monitoring:
- Enable server and application logging of property updates, especially from unusual IP ranges or user agents that do not resemble known IoT devices.
- Use Content Security Policy (CSP) reporting where possible to detect blocked script execution attempts that may indicate attempted XSS.

