web——ctf (登陆一下好吗??)

登陆一下好吗??

  不要怀疑,我已经过滤了一切,还再逼你注入,哈哈哈哈哈!

flag格式:ctf{xxxx}

解题链接: http://ctf5.shiyanbar.com/web/wonderkun/web/index.html                    

1:首先看源码。

<html>
<meta charset="utf-8">

<head>
<!-- 新 Bootstrap 核心 CSS 文件 -->
<link rel="stylesheet" href="./bootstrap/css/bootstrap.min.css">

<!-- 可选的Bootstrap主题文件(一般不用引入) -->
<link rel="stylesheet" href="./bootstrap/css/bootstrap-theme.min.css">

<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
<script src="./bootstrap//bootstrap.js"></script>

<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script src="./bootstrap/js/bootstrap.min.js"></script>
<title>web200</title>
<head>
<style type="text/css">
	body{
		background: #ccc;

	}
	.main{
		margin:200px auto ;
		width: 500px;
		height: 300px;
		padding: 100px 0;

	}
   .input-group{
    margin-top:10px;

   }
   .button{
   	margin-top: 10px;
   	width: 100%;
   }
   .header{

   	width: 100%;
   	text-align: center;
   }
</style>

<body>
	 <div class="main">
	  <div class="header" >实验吧登陆系统</div>
	 <form method="post" action="./login.php">  
	    <div class="input-group">
  			<span class="input-group-addon" id="sizing-addon2">username</span>
 	 		<input type="text" class="form-control" placeholder="username" aria-describedby="sizing-addon2" name="username">
		</div>
		<div class="input-group">
  			<span class="input-group-addon" id="sizing-addon2">password</span>
 	 		<input type="password" class="form-control" placeholder="password" aria-describedby="sizing-addon2" name="password">
		</div>
		<button type="submit" class="btn btn-primary button " >登陆</button>
	 </form>

	 </div>

</body>
</html>

对,没什么卵用。然后

抓包呗!


也没什么卵用。

看来真的是要注入了

看看它过滤了什么东西



看来没过滤引号‘’和“”

那么就可以用引号来注入了。

猜猜数据库的查询语句是什么呢?

$sql = “select user from flag where user=’\$_POST[‘user’]’ and password=’\$_POST[‘password’]’”; 

可能是这样

那就试一试。

select * from user where username = 'user' and password = 'passwd'  因为引号没有过滤,所以我们输入 1'='0

密码输入 1'='0

那么语句就成了

select * from user where username = '1'='0' and password = '1'='0' 

从左到右,username= ‘1’(数据库中没有pass项就会返回false,也就是0)。右边也就变为 0 = ‘0’,也就是0 = 0,所以就为真 ,也就是1,同理password 也是 。所以select语句就变为 select * from user where 1 and 1

看看效果怎么样。



获取flag,解题完成。

在PHP study上面做做试验




摸拟注入可以得到结果。

如果有不当之处希望大家指出,共同学习。谢谢大家

  • 1
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值