In-depth lesson · Leaked secrets
Tips for beginners
Every point the Leaked secrets reports back under this heading, best-backed first, each with the reports it is seen in.
-
Start by searching public repositories for common secret patterns. Use GitHub's code search or dedicated tools to look for strings like 'api_key', 'password', 'token', or file names like '.env', 'config.json', or 'id_rsa'. Focus on repositories belonging to the target organisation or its employees. The evidence shows many leaks in dotfiles, environment files, and configuration files.
Seen in 3 reports
-
Check client-side JavaScript bundles for hardcoded secrets. Modern web apps often include API keys for third-party services in their JavaScript. Look for strings that resemble keys, and test whether they are live and what they allow. Be aware that some keys are meant to be public (like some map tokens) but may still have insufficient restrictions.
Seen in 3 reports
-
Inspect mobile and desktop applications. Decompile Android APKs or unpack Electron apps to search for embedded credentials. The evidence includes many cases where API keys, tokens, and even private keys were found in app packages. Pay attention to third-party service credentials, which can sometimes be used to access data or send messages.
Seen in 3 reports
-
When you find a secret, validate it responsibly. Use the least intrusive method to confirm it is live, such as a read-only API call or a request to a key-check endpoint. Avoid actions that could modify or delete data, send messages, or disrupt services. Document exactly what you did and what access you gained.
Seen in 3 reports
-
Assess the full impact of the secret. Determine what permissions it has and what data it can access. For example, a cloud access key might allow listing buckets or reading objects; a GitHub token might allow accessing private repositories or modifying code. The more sensitive the access, the higher the severity.
Seen in 3 reports
-
Look through CI/CD logs and build output for secrets. Build scripts sometimes print environment variables or command output that includes tokens. Search public build logs for strings like 'token', 'password', or 'secret'. If you find a token, test its validity carefully.
Seen in 2 reports
-
Be careful with out-of-scope findings. If you find a secret that belongs to a third party or is not part of the target's assets, do not test it without permission. Many programs have strict rules about third-party services. Report it to the target if it's their secret, but avoid using it against the third party.
Seen in 2 reports
-
Do not report secrets that are not live or have no impact. A leaked key that has been revoked or only grants access to public information is not a valid finding. Always verify that the secret is active and that it provides some meaningful access before reporting.
Seen in 2 reports
-
Use automation to scale your search. Tools like truffleHog, gitleaks, or custom scripts can scan repositories and other sources for secrets. But always review the results manually to avoid false positives and to understand the context.
Seen in 2 reports
-
When reporting, clearly explain the location of the secret, how you found it, and what you did to validate it. Include the impact: what access the secret grants and what data or systems are at risk. Avoid including the actual secret in the report; instead, provide a redacted version or describe it.
Seen in 2 reports
-
Remember that some secrets are designed to be public, such as certain API keys for client-side services. However, they should still have restrictions (like domain or referrer checks). If you can bypass those restrictions, it may still be a valid finding. Test whether the key can be used from an unauthorised origin.
-
If you find a secret that grants access to a system, consider the potential for lateral movement or escalation. For example, a leaked token might allow accessing other services or obtaining more credentials. However, always stay within the program's rules and avoid actions that could cause harm.
Seen in 2 reports
-
Finally, keep a record of your findings and the steps you took. This helps in writing a clear report and in case the program asks for more details. Also, be patient: some secrets may take time to validate, and some may be revoked quickly.
Seen in 2 reports
-
Check for secrets in less obvious places: web archives, chat channels, error logs, and API responses. The evidence includes cases where credentials were found in the Wayback Machine, in team chat, and in error messages. These can be overlooked but may still be valid.
Seen in 1 report