Summary
An HTML injection issue in Tactical RMM up to v1.3.1 allows authenticated users to store arbitrary HTML in the agent_id field when creating a new agent via the /api/v3/newagent/ endpoint.
When an administrator later views, removes, or shuts down the affected agent in the management panel, the injected HTML is rendered in their browser, enabling client-side attacks such as UI manipulation or phishing within the admin interface.
Affected context
This vulnerability occurs in the Tactical RMM web-based management interface where agents are created and administered.
It specifically affects deployments where:
- Authenticated users can create or register agents via the
/api/v3/newagent/HTTP POST endpoint. - The
agent_idfield is persisted and later rendered in the web UI of the management console. - DOMPurify.sanitize() is used with an HTML-permissive configuration (
html: true), allowing crafted HTML content to survive sanitization and be reflected back into the admin view.
The risk is concentrated around views in which administrators interact with or manage the injected agent entry.
Exploit preconditions
- Attack surface: Tactical RMM web API (
/api/v3/newagent/) and subsequent rendering in the management UI. - Required access: Authenticated access capable of creating a new agent (e.g., standard user, technician, or any role with agent-registration rights).
- Trigger point: The vulnerability is triggered when an administrator opens management views that display the malicious
agent_id, such as during agent removal, shutdown, or detail inspection. - Why exploitation is possible: The
agent_idparameter is treated as HTML content and sanitized with DOMPurify configured to allow HTML (html: true), which may fail to strip all potentially dangerous markup. The resulting HTML is then embedded into the admin interface and interpreted by the browser, enabling hostile user-controlled markup to influence the page.
Why this happens
The core issue is improper neutralization of user-controlled HTML content before it is embedded into a privileged web interface.
The application relies on DOMPurify.sanitize() with an HTML-permissive configuration that assumes the resulting content is safe to render, but still allows attackers to craft markup that alters the UI or user perception.
This falls under CWE-94 when user-controlled content is not adequately constrained or encoded and ends up being handled in a way that can affect execution behavior or security decisions in the client environment.
Abstractly, the pattern is: user input is accepted as a label/identifier, stored without strict validation, sanitized in a mode that preserves HTML semantics, and then reinserted into the DOM in a context where it can impact the administrator's interaction with the interface.
Potential impact
- Attackers could inject deceptive UI elements (e.g., fake buttons or dialogs) to trick administrators into performing unintended actions.
- The injected HTML could be used for phishing-style attacks, such as presenting fake login prompts within the management console.
- Visual tampering with the interface may cause administrators to misinterpret system state, leading to operational mistakes or misconfiguration.
- Depending on browser behavior and any surrounding context, the injected content could potentially contribute to script execution or other client-side compromise scenarios.
General mitigation guidance
Effective mitigation focuses on tightening how user-controlled fields are handled, especially those intended as identifiers or labels:
- Treat
agent_idand similar fields as plain text, not HTML; enforce strict character sets and length limits, and reject input containing markup-like characters where feasible. - Prefer output encoding (e.g., HTML-escaping) at render time so that user input cannot be interpreted as markup by the browser.
- If sanitization libraries like DOMPurify are used, configure them defensively (e.g., disallow arbitrary HTML, restrict to a minimal and well-understood subset) and avoid using modes that preserve rich HTML unless genuinely required.
- Apply a least-privilege approach in the UI: do not place user-controlled content in locations that influence security decisions, critical controls, or authentication flows.
- Consider a clear separation between data storage and presentation: store identifiers in canonical, constrained form and derive any display formatting on the server using trusted templates.
How teams detect issues like this
Organizations can approach detection of this type of issue via:
- Static analysis and linting: Flagging patterns where user-controlled data is inserted into templates without proper encoding or where sanitization is configured in permissive modes that allow HTML.
- Code review practices: Explicitly reviewing endpoints that accept identifiers, labels, or descriptions and tracking how those values flow into rendered views, especially in administrative panels.
- Policy enforcement: Establishing internal standards that all user-controlled text must be HTML-encoded by default, and that rich HTML input is allowed only in narrowly scoped, well-documented areas.
- Automated testing: Using security tests or fuzzing tools to inject benign but clearly visible HTML markers into fields like
agent_idand verifying whether they render as markup in any UI screens.

