id: putty-private-key-disclosure

info:
  name: Putty Private Key Disclosure
  author: DhiyaneshDk,geeknik
  severity: medium
  description: Putty internal user key file is exposed.
  reference:
    - https://github.com/detectify/ugly-duckling/blob/master/modules/crowdsourced/putty-private-key-disclosure.json
  metadata:
    verified: true
    max-request: 8
    github-query: filename:putty.ppk
  tags: exposure,files

http:
  - method: GET
    path:
      - "{{BaseURL}}/my.ppk"
      - "{{BaseURL}}/putty.ppk"
      - "{{BaseURL}}/{{Hostname}}.ppk"
      - "{{BaseURL}}/.ssh/putty.ppk"
      - "{{BaseURL}}/.ssh/{{Hostname}}.ppk"
      - "{{BaseURL}}/.putty/my.ppk"
      - "{{BaseURL}}/.putty/putty.ppk"
      - "{{BaseURL}}/.putty/{{Hostname}}.ppk"

    stop-at-first-match: true

    matchers-condition: and
    matchers:
      - type: word
        part: body
        words:
          - "PuTTY-User-Key-File"
          - "Encryption:"
        condition: and

      - type: status
        status:
          - 200
# digest: 4a0a004730450221009743a619b8ae5bbb216de2254c978a6aff3bceeb7cc54124697d3e8b2d7b5150022068d3fcc4ef1b0bcfb6c280cd87534daf8cce9751a796c0a344d8751af50b19a7:922c64590222798bb761d5b6d8e72950