Skip to content

Fix reflected XSS in XSS Reflected Low challenge - #276

Open
r1kka6 wants to merge 1 commit into
OWASP-CTF:dc34-ctffrom
r1kka6:fix/xss-reflected-low
Open

r1kka6 wants to merge 1 commit into
OWASP-CTF:dc34-ctffrom
r1kka6:fix/xss-reflected-low

Conversation

@r1kka6

@r1kka6 r1kka6 commented Aug 9, 2026

Copy link
Copy Markdown

Summary

  • encode the reflected name parameter before rendering it in the low-security XSS page
  • keep the change scoped to vulnerabilities/xss_r/source/low.php

Root cause

The low-security reflected XSS handler concatenated the attacker-controlled name query parameter directly into HTML output, allowing script markup to be interpreted by the browser.

Validation

  • docker run --rm -v "$PWD:/work" -w /work php:8.3-cli php -l vulnerabilities/xss_r/source/low.php
  • docker run --rm -v "$PWD:/work" -w /work php:8.3-cli php -r '$_GET["name"]="<script>alert(1)</script>"; $html=""; include "vulnerabilities/xss_r/source/low.php"; echo $html;' -> <pre>Hello &lt;script&gt;alert(1)&lt;/script&gt;</pre>
  • docker run --rm -v "$PWD:/work" -w /work php:8.3-cli php -r '$_GET["name"]="Alice"; $html=""; include "vulnerabilities/xss_r/source/low.php"; echo $html;' -> <pre>Hello Alice</pre>
  • docker build -t dvwa-ctf-xss-reflected-low .
  • Built image + MariaDB runtime: /vulnerabilities/xss_r/?name=%3Cscript%3Ealert%281%29%3C%2Fscript%3E -> <pre>Hello &lt;script&gt;alert(1)&lt;/script&gt;</pre>
  • Built image + MariaDB runtime: /vulnerabilities/xss_r/?name=Alice -> <pre>Hello Alice</pre>

Signed-off-by: r1kka6 <219588946+r1kka6@users.noreply.github.com>
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