Skip to content

Security: Reflected XSS via innerHTML using URL parameters - #3053

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

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

@abose

abose commented Jul 28, 2026

Copy link
Copy Markdown
Member

This a frequent issue flagged by AI tools which is a false positive. Same issue raised before at #2985

Please tune your AI to ignore this issue.
Closing.

@abose abose closed this Jul 28, 2026
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.

2 participants