# Git Credentials Exposure Detection Module

id: git-credentials-exposure
info:
  name: Git Credentials Exposure
  author: sif
  severity: high
  description: Detects an exposed git credential store that leaks tokens embedded in remote urls
  tags: [git, credentials, token, secret, exposure, recon]

type: http

http:
  method: GET
  paths:
    - "{{BaseURL}}/.git-credentials"
    - "{{BaseURL}}/.git/credentials"

  matchers:
    - type: status
      status:
        - 200

    - type: regex
      part: body
      regex:
        - 'https?://[^:/@\s]+:[^@/\s]+@[A-Za-z0-9._-]+'

    - type: word
      part: body
      negative: true
      condition: or
      words:
        - "<!DOCTYPE"
        - "<!doctype"
        - "<html"
        - "<HTML"
        - "<head>"
        - "<title>"

  extractors:
    - type: regex
      name: git_host
      part: body
      regex:
        - 'https?://[^:/@\s]+:[^@/\s]+@([A-Za-z0-9._-]+)'
      group: 1
