登陆一下好吗??
不要怀疑,我已经过滤了一切,还再逼你注入,哈哈哈哈哈!
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上面做做试验
摸拟注入可以得到结果。
如果有不当之处希望大家指出,共同学习。谢谢大家