Summary
In affected versions of OpenProject, filenames pulled from connected repositories were rendered into the Repositories module without proper HTML escaping.
An attacker with push access to a repository could craft filenames containing HTML/JavaScript that would execute in the browser of any project member viewing the affected changeset, enabling a stored (persisted) XSS attack.
Affected context
This vulnerability appears in OpenProject's Repositories module when it displays file listings and changesets coming from connected VCS repositories.
It manifests only when filenames from commits are incorporated into the HTML response without neutralizing embedded markup or script content.
The risk is present in projects where:
- The Repositories module is enabled and used, and
- Users other than administrators have push access to the underlying repository, and
- Project members browse repository views that include changesets in which a malicious file has been created and subsequently deleted.
Exploit preconditions
- Attack surface: Web UI of the OpenProject Repositories module.
- Required access: Ability to push commits to a repository integrated with the affected OpenProject project (e.g., project member or collaborator with write access).
- Trigger point: A user with access to the project opens a repositories page or changeset view that lists a commit containing a filename crafted with HTML/JavaScript, particularly where the malicious file was deleted in that changeset.
- Why exploitation is possible: The application interpolates repository filenames directly into HTML without consistent escaping or sanitization, allowing attacker-controlled content to be interpreted by the browser as active markup or script.
Why this happens
The core issue is insufficient output encoding of untrusted data in an HTML context.
Filenames originating from a connected repository are treated as benign text but injected into the page's DOM without robust escaping of characters such as <, >, ", and '.
This pattern maps to CWE-79: Improper Neutralization of Input During Web Page Generation (Cross-Site Scripting), where user- or attacker-controlled data is dynamically included in HTML output and executed by the browser.
The bug is not in input validation at commit time but in output handling when rendering repository views, which should treat all repository metadata as untrusted content.
Potential impact
- Execution of arbitrary JavaScript in the context of affected users' browsers.
- Theft of session cookies or other authentication tokens, potentially enabling account takeover.
- Unwanted actions performed on behalf of the victim (CSRF-like behavior via authenticated XSS), including project configuration changes or data manipulation.
- Injection of malicious content into other parts of the UI via DOM manipulation.
- Phishing-style UI modifications, such as fake login prompts or deceptive project messages.
General mitigation guidance
Effective mitigation focuses on robust output encoding and strict handling of untrusted display data:
- Apply context-appropriate HTML escaping to all repository-derived strings (filenames, paths, commit messages) before rendering them into templates.
- Avoid constructing HTML with raw string concatenation; instead, use template helpers or rendering engines that auto-escape by default and require explicit opt-out.
- Treat repository metadata as untrusted input regardless of its source, and ensure it passes through a consistent encoding/sanitization layer before display.
- Where rich formatting of user-controlled content is necessary, use vetted sanitization libraries configured with an allowlist-based policy.
- Enforce least privilege on repository write access so that fewer users can introduce malicious filenames, reducing exposure if presentation bugs occur.
How teams detect issues like this
Detection can combine code-level review and behavioral monitoring:
- Use static analysis tools or linters configured to flag direct insertion of unescaped variables into HTML templates, particularly in views that handle repository data.
- During code review, treat any rendering of filenames, paths, commit messages, or other repository metadata as a high-risk sink and verify proper escaping in all contexts (HTML body, attributes, URLs, JavaScript).
- Introduce secure coding guidelines and template engine rules that enforce auto-escaping by default and require justification for any bypass.
- Implement security testing and QA scenarios that push commits with edge-case or HTML-like filenames, verifying that the UI renders them as inert text.
- Employ Content Security Policy (CSP) in report-only mode to surface unexpected inline script execution patterns indicative of XSS.

