buuctf刷题 3(1个sstl模板注入 1个session伪造 以及php)

[护网杯 2018]easy_tornado 1

访问页面所给的可以得到

/flag.txt
flag in /fllllllllllllag  可知flag在/fllllllllllllag。

/welcome.txt
render 

/hints.txt
md5(cookie_secret+md5(filename))

render不知道是上面意思。看别人题解说:结合题目给的tornado,可以想到SSTI。

render()函数是渲染函数,进行服务器端渲染。所以能想到模板注入

[护网杯 2018]easy_tornado 1_succ3的博客-CSDN博客

这个md5()应该就和我们的filehash参数有关了。

那么这个cookie-secret在哪呢?

搜索可知:Tornado框架的附属文件handler.settings中存在cookie_secret

cookie_secret在项目的Application中,而handler 指向RequestHandler

且RequestHandler.settings又指向self.application.settings
所以handler.settings就指向RequestHandler.application.settings了,

tornado中的cookie - TianTianLi - 博客园 Tornado小记 -- 模板中的Handler - 黑翼天使23 - 博客园

尝试filename=/fllllllllllllag。

 不行,看见msg参数,再模板注入,?msg={{handler.settings}}

得到cookie_secret :c62c5e9e-bb15-4531-b3d2-eb903fa5d0e7

md5(cookie_secret+md5(/fllllllllllllag))=70203d7e155aa1ac68ac09110580cdb2

构造filename为/fllllllllllllag,filehash为70203d7e155aa1ac68ac09110580cdb2

得到flag。

[极客大挑战 2019]BuyFlag 1

查看源码,发现了pay.php。题目为buyflag。可能与此有关。

在源码中得到一段代码:

<!--
	~~~post money and password~~~
if (isset($_POST['password'])) {
	$password = $_POST['password'];
	if (is_numeric($password)) {
		echo "password can't be number</br>";
	}elseif ($password == 404) {
		echo "Password Right!</br>";
	}
}
-->

发现既要满足password不能为数字,又要满足password==404.

1.is_numberic()函数漏洞:is_numeric函数对于空字符%00,无论是%00放在前后都可以判断为非数值,而%20空格字符只能放在数值后。

2.php存在弱类型比较,因此我们post传入password=404a也可

 发现 Flag need your 100000000 money

我们上面代码中也提到,~~~ post money and password ~~~

再post money=100000000。

还是不行,还需要满足我们是cuit‘s students。这个不知道怎么满足。

查看别人题解可知,burp抓包更改cookie中的user=1即可。

 再post传入money=1000000000

 发现对长度进行了限制。用科学计数法绕过,money=1e9

 得到flag。

[HCTF 2018]admin 1

首先随便注册了一个用户名密码登陆,查看源码看见,you are not admin。注册一个用户名为admin的用户登录.回去之后发现被注册了。。。果然不会这么简单。看别人题解三种解法感觉都好厉害,参考:[HCTF 2018]admin 1_bfengj的博客-CSDN博客_admin

    从这到题感悟:一定要仔细好好看源码。

[ZJCTF 2019]NiZhuanSiWei 1

 <?php  
$text = $_GET["text"];
$file = $_GET["file"];
$password = $_GET["password"];
if(isset($text)&&(file_get_contents($text,'r')==="welcome to the zjctf")){
    echo "<br><h1>".file_get_contents($text,'r')."</h1></br>";
    if(preg_match("/flag/",$file)){
        echo "Not now!";
        exit(); 
    }else{
        include($file);  //useless.php
        $password = unserialize($password);
        echo $password;
    }
}
else{
    highlight_file(__FILE__);
}
?> 

data协议来满足第一个if条件,php filter伪协议读取useless.php源码,之后根据构造反序列化。最终构造:

http://2a884744-d6ed-44cb-a6b3-f3bc61417890.node4.buuoj.cn:81/?text=data://text/plain;base64,d2VsY29tZSB0byB0aGUgempjdGY=&file=useless.php&password=O:4:"Flag":1:{s:4:"file";s:8:"flag.php";}

 查看源码,得到flag。

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值