Summary
A stored cross-site scripting flaw in OpenReplay allows arbitrary scripts to be injected via custom event names and page URLs collected by the public tracking SDK.
When these values are later rendered in the authenticated dashboard without proper output encoding, an attacker's script can execute in the dashboard origin, hijack session tokens, and take over accounts.
Affected context
This vulnerability affects OpenReplay deployments where:
- The public tracking SDK is integrated into websites and accepts visitor-supplied event names and page URLs.
- Collected data is stored in ClickHouse and later rendered in the OpenReplay dashboard UI.
- Output encoding or robust HTML escaping is not enforced on these dynamic fields when displayed in components like TextEllipsis or event-details modals.
In such environments, attacker-controlled text from any visitor can become executable script in the authenticated dashboard context.
Exploit preconditions
- Attack surface: Public-facing websites or applications instrumented with the OpenReplay tracking SDK.
- Required access: Ability to generate sessions using a valid public project key (no dashboard authentication required).
- Trigger point: Viewing the injected events or URLs inside the OpenReplay dashboard, particularly in event detail views or listings.
- Why exploitation is possible: User-controlled strings are stored and later rendered in the dashboard UI without proper contextual output encoding, causing them to be interpreted as active HTML/JavaScript.
Why this happens
The bug stems from treating untrusted display data as benign text and rendering it in the dashboard without applying robust output encoding for HTML and JavaScript contexts.
Event names and page URLs, captured from arbitrary visitors via the tracking SDK, are stored and then passed through UI components that may allow HTML interpretation.
This aligns with CWE-79: Improper Neutralization of Input During Web Page Generation (Cross-Site Scripting), where untrusted data is incorporated into a web page without appropriate escaping for the target context.
Potential impact
- Unauthorized execution of arbitrary JavaScript in the dashboard origin.
- Theft of session JWTs or other credentials stored in browser storage.
- Full takeover of affected dashboard user accounts.
- Manipulation of dashboard views and configuration data.
- Lateral movement to other systems integrated with the dashboard.
General mitigation guidance
Effective mitigation focuses on treating all analytics and telemetry fields as untrusted and enforcing strict output encoding whenever they are rendered.
Common defensive patterns include:
- Applying contextual HTML/JavaScript escaping to all dynamic fields displayed in the dashboard, especially event names and URLs.
- Normalizing and sanitizing telemetry values at ingestion or before UI rendering, stripping or neutralizing script-capable constructs.
- Designing dashboard components to use safe rendering primitives that never interpret user-controlled data as markup.
- Using least-privilege principles for dashboard tokens and limiting the exposure of sensitive data in client-side storage.
These measures reduce the risk that attacker-controlled analytics data becomes executable code in privileged interfaces.
How teams detect issues like this
Detection typically involves both code-level and behavior-level analysis:
- Static analysis or linting rules that flag direct insertion of analytics fields into DOM, innerHTML, or dangerouslySetInnerHTML equivalents without encoding.
- Code review practices that treat all ClickHouse-backed or telemetry-derived fields as untrusted and verify explicit escaping in UI components.
- Security testing of the dashboard by injecting benign script markers through the tracking SDK and confirming they are rendered safely.
- Policy-based enforcement that prohibits rendering raw user-supplied strings in privileged dashboards without passing through approved sanitization helpers.
Automated SAST and frontend security tools can assist in identifying unsafe rendering patterns in dashboard code.

