Summary
Hydro's default UI has a stored cross-site scripting vulnerability in how it handles language-class tokens in Markdown. A registered user who can save a crafted profile bio may cause script to run when another user or an administrator views it; the script could access the non-HttpOnly session cookie and enable session hijacking.
Affected context
The issue occurs in Hydro's @hydrooj/ui-default Markdown rendering path, specifically the handling of language-class tokens in markdown-it-xss.ts. It is relevant when user-controlled Markdown, such as a profile bio, is rendered for other users and token values are not safely encoded or constrained before being included in HTML.
Exploit preconditions
- Attack surface: Markdown rendering in Hydro's default UI.
- Required access: A registered account able to set or modify a profile bio.
- Trigger point: Another user or administrator views the bio.
- Why exploitation is possible: User-controlled language-class token content can affect generated HTML, allowing script injection if it is not safely encoded or restricted.
Why this happens
The underlying issue is improper neutralization of user-controlled input in generated web content, which maps to CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'). Insecure handling of class-token values can allow input to escape its intended HTML attribute context and introduce executable markup or script.
Potential impact
- A viewing user's session could be compromised if the script can access the non-HttpOnly session cookie.
- An attacker could impersonate a victim or perform actions using the victim's session.
- Administrators who view the affected profile could have their accounts or privileged actions exposed.
General mitigation guidance
Defensive patterns include encoding output for its exact HTML context and restricting language-class values to a narrow, validated allowlist. Treat profile content and Markdown tokens as untrusted, and use rendering approaches that avoid assembling HTML from raw input. Session protections such as HttpOnly and appropriate SameSite cookie settings, along with a restrictive Content Security Policy, can reduce the impact of a rendering flaw. Keep the rendering component and its security checks within established maintenance and review processes.
How teams detect issues like this
- Use static analysis and security tests to identify unsafe HTML construction and missing context-specific output encoding.
- Review Markdown rendering paths, especially code that transfers user-controlled token attributes into HTML.
- Add tests that verify unexpected class-token values are rejected or safely rendered.
- Enforce code-review or CI policies for untrusted data reaching HTML attributes and other browser-interpreted contexts.

