Summary
OpenProject's roadmap view contains a stored cross-site scripting vulnerability where user-controlled project names are rendered as HTML without proper escaping.
When roadmap entries reference work packages from other projects or subprojects, malicious HTML or script content in the project name can be injected into the page and executed in the victim's browser.
Affected context
This vulnerability occurs in OpenProject's Roadmap view when rendering the "Related work packages" list for a version that includes work packages from other projects or subprojects.
The helper link_to_work_package prepends package.project.to_s (the project name) to the link and marks the entire string as html_safe, causing any HTML in project names to be injected into the DOM.
The issue manifests in deployments where users can control project or subproject names and where browsers interpret the injected markup without effective downstream defenses.
Exploit preconditions
- Attack surface: The Roadmap view in the OpenProject web interface.
- Required access: Ability to create or modify a project or subproject name (typically authenticated user with project management or administration permissions).
- Stored payload location: The malicious payload is stored in the project/subproject name field in the database.
- Trigger point: Any user viewing the Roadmap page that renders "Related work packages" for a version containing work packages from the maliciously named project.
- Why exploitation is possible: The application converts
package.project.to_sto a string, appends it to an HTML link, and then calls.html_safewithout escaping user-controlled content, allowing arbitrary HTML/JS injection.
Why this happens
The root cause is an output encoding flaw: user-controlled data (project names) is inserted into an HTML context and then explicitly marked as safe using a framework-specific mechanism (html_safe) that disables automatic escaping.
This directly maps to CWE-79: Improper Neutralization of Input During Web Page Generation (Cross-site Scripting), where data is trusted at render time instead of being escaped according to the output context.
By treating the concatenated string as already sanitized, the template engine renders untrusted HTML verbatim in the browser, enabling script execution if the content includes <script>, event handlers, or other active HTML constructs.
Potential impact
- Attacker-controlled JavaScript execution in the context of the OpenProject application.
- Theft of session identifiers or use of active session context to perform actions as the victim.
- Modification of UI content (defacement, fake dialogs, or phishing prompts) to trick users into divulging sensitive information.
- Execution of CSRF-like actions against OpenProject on behalf of the victim, such as changing project data or workflow settings.
- Potential pivoting to browser-based attacks, including exfiltration of accessible project data or credentials stored in the browser for the same origin.
General mitigation guidance
Effective mitigation generally focuses on context-aware output encoding and defensive rendering defaults:
- Avoid marking user-controlled strings as globally safe (
html_safeor equivalents) unless they have passed strict, centralized sanitization policies. - Apply automatic escaping by default at the template level and only selectively allow whitelisted markup where absolutely necessary.
- Enforce context-specific encoding (HTML, attribute, URL) whenever user input is rendered into views, ensuring that script injection cannot occur.
- Restrict who can set or change project names and implement validation rules that disallow dangerous markup where HTML is never required.
- Complement application-level fixes with browser-facing security headers (e.g., X-Content-Type-Options, CSP) as defense in depth, not as the primary protection for XSS.
How teams detect issues like this
Detection can leverage a combination of automated analysis and targeted review:
- Static analysis: Configure rules to flag uses of
html_safe, raw HTML helpers, or other escape-bypassing APIs when applied to variables derived from user input. - Code review: Focus on view helpers and templates that concatenate model fields (names, titles, descriptions) into HTML, verifying that framework escaping is not bypassed.
- Security testing: Use manual or automated XSS testing against fields that surface in roadmap, project, or work-package views; test with benign HTML and script probes.
- Policy enforcement: Introduce coding guidelines that require justification and review for any use of escape-bypassing APIs, backed by CI checks or pre-commit hooks.
- Runtime monitoring: Employ application-level logging or web application firewalls that can flag suspicious project names containing tags or JavaScript patterns as indicators of potential exploitation.

