Identity, AI/ML, Generative AI, Application security, DevSecOps

Why secrets detection belongs everywhere in your security workflow

A digital representation of a data leak warning, featuring glowing red text against a dark, high-tech background.

Picture the second week of a red team engagement. You have a foothold and it is time to start pivoting. A hundred repositories sit cloned on your laptop, another fifty are still being enumerated from the target organization's source control, and you are already deep into their internal web portal through an intercepting proxy. Somewhere in that pile of code and HTTP responses is a hardcoded cloud key, a payment processor secret, or an internal service token that nobody rotated after the last contractor left.

There is always something. It is just a matter of time.

The challenge for offensive security practitioners is not whether leaked credentials exist. They almost always do. The challenge is finding them efficiently across an ever expanding range of formats, protocols, and interfaces before the engagement clock runs out.

Secrets detection has an integration problem

Most secret scanners operate as standalone command line tools. You point them at a directory and they return matches. That workflow covers one scenario well, but offensive engagements generate credential exposure across multiple surfaces simultaneously: source code repositories, HTTP proxy traffic, browser rendered JavaScript, exported spreadsheets, mobile application packages, and database dumps. Running a single CLI tool against a single directory misses secrets hiding in all those other places.


Related reading:


The real gap is not detection rules. Open source rule sets have matured dramatically, with hundreds of patterns covering cloud providers, CI/CD systems, payment processors, SaaS platforms, and more. The gap is that the detection engine lives in only one place. If it ran as a library embeddable in your own tooling, as a browser proxy extension scanning HTTP responses passively, and as a browser extension scanning JavaScript in real time, you would catch secrets you currently miss without changing your workflow at all.

Validation changes everything

Regex based scanners inevitably produce false positives. Test fixtures, example configurations, and placeholder values trip detection rules constantly. On a large engagement you might see hundreds of hits, making triage a real time sink. The single most impactful improvement the industry can make to secrets scanning is automated validation: making a controlled API request with the detected credential to determine whether it is actually live.

The implementation is straightforward. Each detection rule can optionally define a validator, which is simply a templated HTTP request specifying how to test the credential and how to interpret the response. A 200 means the key is live. A 401 or 403 means it has been revoked. An unreachable endpoint gets marked as unknown. When validation runs concurrently against every finding, what used to be a manual triage exercise becomes an automated prioritization step. You know which keys are confirmed live before you start writing your report or planning lateral movement.

Binary files are a blind spot

Most scanners only examine plaintext, but credentials routinely appear in places that require extraction first. Exported spreadsheets, PDF reports, Jupyter notebooks, SQLite databases, and mobile application packages all regularly contain hardcoded API keys and service tokens. Archive formats compound the problem. A zip inside a zip, a JAR file inside a WAR file, or an IPA containing embedded configuration files all require recursive extraction before scanning. Any secrets detection strategy that ignores binary formats is leaving real findings on the table.

LLMs as a denoising layer

Validation eliminates some false positives, but not all. A test key will not return a 200 from a cloud provider's API, but certain patterns still generate noise. Large language models offer a compelling second pass. Feeding each finding's surrounding context into an LLM and asking whether the match looks like a real credential or a false positive eliminates a significant portion of remaining noise. Three years ago this would have been impractical. Today it is a straightforward API call costing fractions of a cent per finding.

From discovery to impact

Secrets discovery is only the first step. Once you have validated credentials, the natural next move is to test them at scale across an entire network infrastructure, targeting SSH, RDP, SMB, database protocols, and other services. This turns a single finding into a map of lateral movement opportunities. The workflow from detection to validation to credential spraying represents a kill chain that is increasingly automatable.

What defenders should do now

If you are on the defensive side, the takeaway is clear. The tooling available to attackers for finding, validating, and exploiting leaked credentials is becoming more integrated and more automated every quarter. Organizations should audit not just their source code repositories but also their binary artifacts, exported documents, CI/CD pipelines, and browser accessible internal applications for credential exposure. Automated secret rotation, short lived tokens, and vault based credential management remain the most effective countermeasures. If an attacker finds a credential, the question should not be whether it is valid. The answer should already be no.

Praetorian's Michael Weber

Michael Weber is a security engineer at Praetorian and has worked in security as a malware reverse engineer, penetration tester, and offensive security developer for over a decade.

Noah Tutt

Noah Tutt is a Senior Security Engineer at Praetorian specializing in product security assessments, including web application, hardware testing, reverse engineering, and secure code review.

Zach Grace

Zach Grace is a Principal Security Engineer at Praetorian with extensive consulting experience across cloud, application security, network, red teaming, social engineering, and physical penetration testing.

Get daily email updates

SC Media's daily must-read of the most current and pressing daily news

By clicking the Subscribe button below, you agree to SC Media Terms of Use and Privacy Policy.

You can skip this ad in 5 seconds