Summary
Dolibarr ERP-CRM 14.0.2 contains a stored cross-site scripting vulnerability in the ticket creation module that allows low-privilege users to inject persistent JavaScript into ticket messages.
When an administrator later interacts with the crafted ticket text (for example, by copying the message), the malicious script can execute in the admin's browser context, potentially enabling privilege escalation and unauthorized actions.
Affected context
The vulnerability occurs in the ticket creation workflow of Dolibarr ERP-CRM 14.0.2, where user-supplied ticket messages are stored and later rendered in the administrative interface.
It becomes relevant when low-privilege or helpdesk users can submit tickets containing rich text or HTML-like content, and when the application displays this content to higher-privileged users without consistently sanitizing or encoding it in all views and interaction flows.
The risk is heightened in environments where administrators frequently review, copy, or otherwise interact with ticket content in a modern web browser.
Exploit preconditions
- Attack surface: Web-based ticket creation and review pages within Dolibarr's ERP-CRM interface.
- Required access: Ability to authenticate or otherwise act as a low-privilege user who can create or update tickets.
- Trigger point: An administrator or higher-privileged user opens the malicious ticket and performs specific interactions (such as copying text) that cause the browser to process and execute the embedded script.
- Why exploitation is possible: User-controlled ticket message content is stored server-side and later rendered into an administrative page without sufficient output encoding or sanitization, allowing script execution in the context of the admin's session.
Why this happens
This issue stems from improper neutralization of user-controlled input before it is included in a web page, corresponding to CWE-79: Improper Neutralization of Input During Web Page Generation (Cross-site Scripting).
The ticket creation module accepts arbitrary message content from low-privilege users and stores it, but when the same content is later retrieved and presented in the admin interface, it is not consistently HTML-encoded or filtered.
As a result, embedded JavaScript or event handlers can survive storage and be interpreted by the browser as active code rather than inert text, particularly during user interactions such as selecting or copying content.
The underlying pattern is a lack of strict separation between data and executable markup when rendering untrusted text in privileged views.
Potential impact
- Execution of arbitrary JavaScript in the browser of an administrator or other privileged user.
- Theft of session cookies or tokens associated with high-privilege accounts, which could enable account takeover.
- Unauthorized actions performed on behalf of an administrator (e.g., configuration changes, user management, or data manipulation) via forged requests in the admin's session.
- Modification or exfiltration of sensitive ERP/CRM data accessible to the targeted administrator.
- Establishment of persistent malicious content within the application interface, affecting multiple admin sessions.
General mitigation guidance
Mitigation usually focuses on enforcing context-aware output encoding and strict handling of untrusted HTML-like input:
- Treat all ticket message content as untrusted and apply HTML-encoding by default when displaying it, especially in administrative views.
- Use a vetted, server-side HTML sanitization library if rich text is genuinely required, configured with a restrictive allowlist of tags and attributes, and explicitly stripping all scripting capabilities (e.g.,
<script>,on*event handlers,javascript:URLs). - Apply output encoding at the point of rendering, tailored to the specific context (HTML body, attribute, URL, JavaScript, etc.) rather than relying solely on input validation.
- Implement role-aware display rules that avoid rendering untrusted user content with elevated privileges unless it has been safely transformed.
- Limit the need for administrators to work directly with raw, user-supplied markup by providing safe, text-only modes or preview components.
How teams detect issues like this
Detection generally involves a mix of review, tooling, and testing:
- Static analysis: Configure security linters or SAST tools to flag direct insertion of user-controlled variables into templates or DOM construction APIs without encoding functions.
- Code review: Examine the ticket creation and display code paths for unchecked use of request parameters, database fields, or template variables within HTML, attributes, or inline scripts.
- Security testing: Use automated and manual web security testing tools to inject benign XSS test payloads into ticket messages and observe whether any are reflected or stored and later executed in admin views.
- Policy enforcement: Define development guidelines that mandate output encoding helpers in templating layers and prohibit direct interpolation of raw user content in privileged UIs, with pre-merge checks to enforce these patterns.

