Harvested Secrets are credentials such as API keys, tokens, passwords and certificates that an attacker collects from compromised hosts, code repositories, CI/CD logs, environment variables or malicious packages. They enable lateral movement without exploiting further flaws. Defenders respond by rotating every exposed secret, scanning repositories and pipelines for leakage, and reviewing logs for use from unfamiliar locations.
What Harvested Secrets Are in Security Operations
Harvested secrets are not just “found” credentials, they are reusable authentication material taken from places where developers and systems often expose them accidentally or at scale. In practice, the threat is that a token, key, password, or certificate can be lifted from one weak point and then used elsewhere without breaking the target system itself.
That makes harvested secrets especially valuable to attackers because they bypass normal exploit chains. Once a valid secret is in hand, the attacker often does not need a new vulnerability, only a trusted path into a cloud account, source repository, deployment pipeline, or internal service.
Where Harvested Secrets Come From
The most common sources are places that accumulate sensitive material during normal engineering work: code repositories, build logs, CI/CD output, environment variables, configuration files, crash dumps, and developer workstations. Secrets can also arrive through malicious packages or compromised dependencies, where the attacker’s goal is to steal credentials from the build or runtime environment.
NHIMG’s Guide to the Secret Sprawl Challenge is useful here because it treats exposure as a lifecycle problem, not a one-off leak. The same underlying weakness can surface in source control, pipelines, cloud configs, or leaked artifacts.
Public repositories and cloud tooling make the problem worse because secrets are often copied into multiple places before anyone notices. A credential that was meant to be temporary can become durable if it is duplicated into logs, branches, forks, artifacts, or cached environment snapshots.
Why Harvested Secrets Are Dangerous
A harvested secret is dangerous because it is already trusted by the environment. If the secret still works, the attacker can impersonate a user, service, or application, move laterally, access data, or invoke internal functions without needing to defeat MFA or exploit code again.
This is why secret type and lifetime matter. A long-lived API key is far harder to contain than a short-lived token, and a broadly scoped secret is far more damaging than one tied to a narrow purpose. NHIMG’s Static vs Dynamic Secrets section is a good reference point for understanding how lifecycle design changes exposure.
For cloud and platform access, the blast radius can be immediate. A single exposed secret may be enough to reach storage, identity providers, deployment systems, or downstream services, especially when the secret is reused across environments or embedded in automation.
How Organisations Reduce Exposure and Recover
Defence starts with finding where secrets are likely to exist and then reducing how often they persist in plain form. That means scanning repositories, pipelines, artifacts, and logs, then replacing long-lived credentials with shorter-lived or better-scoped alternatives where possible. API Key Management Guide and Secrets Management Guide both support that operational view: store secrets centrally, rotate them quickly, and remove unnecessary exposure paths.
After exposure is discovered, response should focus on revocation, rotation, and trace review. Rotation is not optional if the secret has been seen outside trusted boundaries, and logs should be checked for unfamiliar source locations, unusual user agents, or activity that suggests the secret was already used by an intruder.
Where the leak originated in a build or package path, the organisation should also review the pipeline itself. NHIMG’s Guide to the Secret Sprawl Challenge and Secrets Management Guide both align with the practical point that remediation is incomplete if the same exposure path remains open.
Risk and Threat Considerations
Harvested secrets are attractive because they convert a single exposure into broad trusted access. The main risk is not the leak itself, but the fact that the secret may still be valid, overprivileged, and usable from outside the expected environment before defenders notice.
Failure mechanism: Attackers steal a credential from code, logs, environment variables, or a compromised host, then use it directly or resell it before rotation, revocation, or detection occurs.
Impact: The result can be account takeover, data access, privilege abuse, lateral movement, and persistence through a trusted authentication path that looks legitimate to monitoring tools.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP Non-Human Identity Top 10 addresses the attack and risk surface, while CIS Controls v8 and NIST SP 800-53 Rev 5 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP Non-Human Identity Top 10 | NHI-02 — Secret Leakage | Harvested secrets are leaked credentials that enable unauthorised access. |
| NHI-07 — Long-Lived Secrets | The term is dangerous because stolen long-lived secrets remain usable. | |
| NHI-05 — Overprivileged NHI | Stolen non-human credentials often grant excessive access beyond need. | |
| Recommendation — Scan for exposed secrets and revoke or rotate them immediately. Shorten secret lifetimes and replace durable credentials with time-bound alternatives. Reduce secret scope so a stolen credential cannot reach unnecessary resources. | ||
| CIS Controls v8 | CIS-5 — Account Management | Harvested secrets work as access material and must be lifecycle-managed. |
| Recommendation — Inventory, revoke and rotate exposed credentials as part of account management. | ||
| NIST SP 800-53 Rev 5 | IA-5 — Authenticator Management | Leaked secrets are authenticators whose lifecycle must be controlled. |
| Recommendation — Manage authenticator issuance, rotation and revocation to limit secret reuse. | ||
Practitioner Guidance
Why practitioners should care: The key judgement is not whether a secret leaked, but whether it is still live, where it is scoped, and what systems trust it. A narrow secret with fast expiry is far easier to contain than a reusable credential that appears in multiple services or repositories.
What to watch for: Treat any leaked token, key, or certificate as a potential access event, not just a hygiene issue. If usage appears from unfamiliar hosts, regions, or automation contexts, assume the secret has moved beyond its intended trust boundary and investigate the path as well as the credential.
Practitioner takeaway: The fastest containment comes from pairing immediate revocation with a search for every place the secret may have been copied, cached, or reused.
Related resources from NHI Mgmt Group
Deepen Your Knowledge
Free weekly newsletter
Subscribe to the NHI & AI Identity Journal
The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.
Bonus 33% off our NHI Course when you subscribe.
Reviewed and updated by the NHIMG editorial team on November 26, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org