Skip to content
Pwnversity
RECON-CODEintermediate · 4 min · upd. 2026-10

Code Repository OSINT

T1593.003

GitHub, GitLab, and the like are among the most rewarding recon sources there are: a company’s developers (and their employees personally) push code that, by mistake, contains credentials, API keys, tokens, internal paths, infrastructure names, and sensitive logic. And remember: Git keeps the history, so a “deleted” secret is still there. Searching repos well finds access no scan would reveal.

  • Secrets: API keys (AWS, GCP, Stripe…), passwords, tokens, SSH/PGP private keys.
  • Infrastructure: internal URLs, hostnames, IPs, non-public API endpoints.
  • Logic: how authentication works, proprietary algorithms, validations (to break them).
  • Employee repos: dotfiles and personal projects with work credentials.

GitHub code search is a specific form of dorking. Some high-yield queries:

  • By organization: org:target-inc password and org:target-inc "api_key".
  • By domain/hostname in the code: "target.com" password and "internal.target.local".
  • By secret type: "AKIA" (AWS access key id), "-----BEGIN RSA PRIVATE KEY-----".
  • By path/file: path:.env DB_PASSWORD, path:config.php password.
  • By extension/path: path:*.yml password, path:.github/workflows secret (current code search uses path:; filename:/extension: are legacy and may be treated as text).

And don’t forget the commit history and gists (public snippets people push and forget).

Ventana de terminal
trufflehog github --org=target-inc # high recall; verifies whether the key is live
gitleaks detect --source . # local secret scan
trufflehog git https://github.com/target-inc/repo # by a repo's commits

TruffleHog also verifies whether the found key is still active, which drastically cuts false positives. For automated GitHub dorking there are GitDorker, gitrob, and github-search.

  1. Identify the org on GitHub/GitLab and its public repos.
  2. Enumerate employees (see People OSINT) and their personal accounts.
  3. Scan repos, history, and gists with trufflehog/gitleaks.
  4. Manually search specific dorks (domain, "password", filename:.env).
  5. Verify each secret: is it still live? what does it grant access to?
  6. If a .git/ is exposed on the web, reconstruct the code (see Exposed .git).

The same mistakes appear on more platforms:

  • GitLab, Bitbucket — same secrets-in-repos-and-history problems.
  • Postman public workspaces — collections with tokens and internal endpoints.
  • Docker Hub — images with secrets in layers or ENV variables.
  • npm / PyPI — internal packages published by mistake (dependency confusion).
  • Pastebin and similar — credential dumps.
  • Looking only at current code and forgetting the history, where “deleted” secrets live.
  • Not verifying the key: an expired or revoked secret isn’t a finding, it’s noise.
  • Ignoring employees’ personal accounts, which often leak work credentials.
  • Using a found secret against production out of scope: verify it only in an authorized way.

Prevention: secret scanning in the pipeline (GitHub Advanced Security, gitleaks pre-commit), .gitignore for .env and keys, and rotating immediately any secret that reached a repo (deleting it from history isn’t enough: it must be rotated). Train employees on personal repos and monitor mentions of the org with the same tools an attacker would use.

  • Public repos of the org identified.
  • Code dorks (org:, "password", filename:.env, "AKIA").
  • History and gists reviewed (“deleted” secrets).
  • trufflehog / gitleaks over repos and commits.
  • Employees’ personal accounts scanned.
  • Secrets verified (live? what do they open?).
  • Postman / Docker Hub / npm reviewed.
  • Exposed .git/ on the web reconstructed.