id: netrc

info:
  name: Netrc - Config File Discovery
  author: geeknik
  severity: high
  description: Netrc configuration file was discovered.
  reference:
    - https://www.gnu.org/software/inetutils/manual/html_node/The-_002enetrc-file.html
  metadata:
    max-request: 2
  tags: netrc,config,exposure

http:
  - method: GET
    path:
      - "{{BaseURL}}/.netrc"
      - "{{BaseURL}}/_netrc"

    matchers-condition: and
    matchers:
      - type: status
        status:
          - 200

      - type: regex
        regex:
          - "machine [0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\\.?"

      - type: word
        words:
          - "login "
          - "password "
        condition: and

    extractors:
      - type: regex
        part: body
        regex:
          - "machine [0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\\.?"

# digest: 490a00463044022072f3810d5161d773a7e963bf1431f25dc27b0af216a44b5d3ebc90f6bbc4b9f402207701413414bce54d3da7716463e173f5192dfe85efd4dcaa10f91901a398163e:922c64590222798bb761d5b6d8e72950
