访问题目url
还是经典语句起手
<script>alert('xss')</script>
输入之后我们发现没什么变化,所以猜测得使用点击事件来点击友情连接,然后触发弹窗,直接上代码层面看看自己猜的对不对。
ini_set("display_errors", 0);
$str = strtolower($_GET["keyword"]);
$str2=str_replace("script","scr_ipt",$str);
$str3=str_replace("on","o_n",$str2);
$str4=str_replace("src","sr_c",$str3);
$str5=str_replace("data","da_ta",$str4);
$str6=str_replace("href","hr_ef",$str5);
$str7=str_replace('"','"',$str6);
echo '<center>
<form action=level8.php method=GET>
<input name=keyword value="'.htmlspecialchars($str).'">
<input type=submit name=submit value=添加友情链接 />
</form>
</center>';
strtolower()
将输入值转换为小写。str_replace()
删除一些可能用于XSS攻击的关键词,包括"script",“on”,“src”,“data"和"href”。htmlspecialchars()
将字符转义为HTML实体,以防止XSS攻击。
所以只能是在input标签里面设置onclick属性 属性值设置为弹窗命令 所以最终我们只能够是进行unicode编码绕过了。
javascRipt:alert(1)
R是"R"的的 Unicode 编码。能被浏览器自动解析