Skip to content

Security: Reflected XSS via innerHTML using URL parameters#3053

Open
tomaioo wants to merge 1 commit into
phcode-dev:mainfrom
tomaioo:fix/security/reflected-xss-via-innerhtml-using-url-pa
Open

Security: Reflected XSS via innerHTML using URL parameters#3053
tomaioo wants to merge 1 commit into
phcode-dev:mainfrom
tomaioo:fix/security/reflected-xss-via-innerhtml-using-url-pa

Conversation

@tomaioo

@tomaioo tomaioo commented Jul 27, 2026

Copy link
Copy Markdown

Summary

Security: Reflected XSS via innerHTML using URL parameters

Problem

Severity: High | File: src-node/www/phoenix-splash/error.html:L9

The applyTranslations function reads URL parameters mainHeading and mainSpan and directly inserts them into the DOM using the innerHTML property. This occurs after decoding the URI component. An attacker can craft a malicious URL containing JavaScript payloads within these parameters. When a victim visits the crafted URL, the script will execute in the context of the victim's browser, leading to reflected Cross-Site Scripting (XSS).

Solution

Avoid using innerHTML with untrusted input. Instead, use textContent or document.createElement to safely construct the DOM elements. If HTML formatting is strictly required, sanitize the input using a robust HTML sanitization library like DOMPurify before insertion.

Changes

  • src-node/www/phoenix-splash/error.html (modified)

The `applyTranslations` function reads URL parameters `mainHeading` and `mainSpan` and directly inserts them into the DOM using the `innerHTML` property. This occurs after decoding the URI component. An attacker can craft a malicious URL containing JavaScript payloads within these parameters. When a victim visits the crafted URL, the script will execute in the context of the victim's browser, leading to reflected Cross-Site Scripting (XSS).

Signed-off-by: tomaioo <203048277+tomaioo@users.noreply.github.com>
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant