首先我们打开题目
题目上说这里啥也没有,我们尝试一下从源代码中看看有没有什么提示
我们翻译一下这段代码:
第一个if过滤了_和url编码的%5f 解码后也是_ ,PHP会将传参中的空格( )、小数点(.)自动替换成下划线
第二个if要求get传的参不能等于2333且传的参结尾开头中间都是2333,在23333结尾加个换行符url编码为%0a 即可绕过
我们尝试一下进行注入后得到反馈
进入提示页面
我们查看源代码
通过查询资料,我们可以知道被注释的是一串jsfuck的的编码
参考资料
https://blog.csdn.net/qq_29566629/article/details/122796325?ops_request_misc=&request_id=&biz_id=102&utm_term=jsfuck%E7%BC%96%E7%A0%81&utm_medium=distribute.pc_search_result.none-task-blog-2~all~sobaiduweb~default-0-122796325.142^v82^insert_down1,201^v4^add_ask,239^v2^insert_chatgpt&spm=1018.2226.3001.4187
我们进行解码
得到了提示,需要进行一次post的传参
我们进行传参之后得到以下代码
error_reporting(0);
include 'takeip.php';
ini_set('open_basedir','.');
include 'flag.php';
if(isset($_POST['Merak'])){
highlight_file(__FILE__);
die();
}
function change($v){
$v = base64_decode($v);
$re = '';
for($i=0;$i<strlen($v);$i++){
$re .= chr ( ord ($v[$i]) + $i*2 );
}
return $re;
}
echo 'Local access only!'."<br/>";
$ip = getIp();
if($ip!='127.0.0.1')
echo "Sorry,you don't have permission! Your ip is :".$ip;
if($ip === '127.0.0.1' && file_get_contents($_GET['2333']) === 'todat is a happy day' {
echo "Your REQUEST is:".change($_GET['file']);
echo file_get_contents(change($_GET['file'])); }
?>
我们运用chatgpt来对代码进行翻译
通过查询资料和对比,知道了这是一个jQuery事件,并且使用change()的办法来做题
参考资料
https://blog.csdn.net/qq_45709231/article/details/122207821?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522168093547516800226553192%2522%252C%2522scm%2522%253A%252220140713.130102334..%2522%257D&request_id=168093547516800226553192&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~all~top_click~default-1-122207821-null-null.142^v82^insert_down1,201^v4^add_ask,239^v2^insert_chatgpt&utm_term=jQuery%E4%BA%8B%E4%BB%B6&spm=1018.2226.3001.4187
简而言之就是变量改变会有提醒,因为我们绕过不能有提醒所以上传的v和file相同
1、来源ip是127.0.0.1 用 Client-ip
2、get参数2333传来的值,使用文件流打开后内容为todat is a happy day
3、file_get_contents用php伪协议绕过
4.反写change加密函数
我们对代码进行解密
构造paylaod
?2333=data://text/plain,todat is a happy day &file=ZmpdYSZmXGI=
我们用Bp来抓包并且进行重发之后得到了flag