appsec.fyi

Secrets — A Practical Guide

A curated AppSec resource library covering XSS, SQLi, SSRF, IDOR, RCE, XXE, OSINT, and more.

Secrets: A Practical Guide

Curated and synthesized by . Last updated 2026-08-01. Synthesized from 227 of 227 curated resources. Browse all 227 Secrets resources →

The Problem: Pervasive and Persistent Secrets Exposure

The landscape of application security is increasingly defined by the challenge of managing secrets. These credentials, tokens, API keys, and other sensitive material are the keys to our digital kingdoms, and their exposure represents a direct pathway to compromise. The sheer volume of leaked secrets is staggering. In 2025, a reported 28.6 million new secrets were leaked on public GitHub alone, marking a 34% year-over-year increase [1][2][3][4][5][6]. This surge is driven by a confluence of factors, including the rapid adoption of AI-assisted development tools, the expanding attack surface of non-human identities, and systemic issues in secrets management lifecycle.

The problem isn't just the initial leak; it's the persistence. A disturbing finding indicates that 64% of secrets confirmed valid in 2022 were still valid when retested in January 2026 [3][7]. This longevity transforms a momentary lapse into a long-term vulnerability. Furthermore, the attack surface has expanded dramatically beyond traditional code repositories. Approximately 28% of secrets incidents originate entirely outside of code [2]. This includes environments like collaboration tools, container images, and, critically, developer endpoints.

AI coding assistants, while boosting productivity, also introduce significant risks. AI-assisted development has led to credentials being leaked roughly twice as fast as by developers who don't use these tools [1]. The exposure isn't limited to code generation; AI agents can inadvertently access and exfiltrate sensitive data through their caches and telemetry [8].

Non-human identities (NHIs) – such as service accounts, API keys, and managed identities – are another rapidly growing vector. A significant percentage of organizations have NHIs with high privileges that are exposed to the internet and harbor vulnerabilities [9]. These identities often lack the oversight and lifecycle management applied to human accounts, making them attractive targets. The CISA leak of AWS GovCloud admin credentials exemplifies the potential impact of compromised high-privilege identities [4][10][5].

Understanding the "blast radius" of a compromise is a persistent challenge [1]. Without pre-incident inventory and understanding of credential sprawl, determining the full impact of a compromised developer machine or a leaked API key is extremely difficult. The developer endpoint, or laptop, has become the new perimeter, housing a wealth of credentials often missed by traditional network and identity controls [11].

Core Mechanics of Secrets Exposure

The fundamental mechanisms by which secrets are exposed are surprisingly consistent, though the context and scale continue to evolve.

Hardcoding Secrets

The most straightforward and common method of exposure is hardcoding secrets directly into source code, configuration files, or environment variables. This can occur accidentally during development or due to a lack of understanding about secure credential handling.

Exposed Repositories and Source Code Disclosure

Publicly accessible code repositories are a prime target. Vulnerabilities in repository management or accidental exposure can lead to significant data breaches.

Supply Chain Attacks

The software supply chain, from package managers to CI/CD pipelines, is a critical attack vector. Malicious actors exploit trust relationships to inject secrets-exfiltrating code.

AI-Assisted Development Risks

The integration of AI into the development workflow introduces novel exposure vectors.

Developer Endpoint Security

Developer workstations are repositories of vast amounts of sensitive information.

Server-Side Request Forgery (SSRF) and Other Network-Based Exfiltration

Network-level vulnerabilities can be exploited to access and exfiltrate secrets.

Misconfigurations and Exposed Services

Misconfigurations in cloud environments or exposure of debugging interfaces can lead to unintended data leakage.

Notable Techniques and Attack Patterns

Beyond the core mechanics, specific techniques and observed attack patterns highlight the evolving threat landscape.

Credential Reuse and Sprawl

The practice of reusing credentials across different systems and cloud providers significantly amplifies the impact of a single leak. A compromised credential for one service can become a pivot point for accessing others [1][8]. This "credential sprawl" is a major contributor to the difficulty in assessing blast radius.

Automated Discovery and Exfiltration Tools

Attackers leverage a range of tools to automate the discovery and exfiltration of secrets.

Exploiting CI/CD Pipelines

CI/CD pipelines are rich environments for secrets. Attackers target them through various means:

AI Agent Specific Attacks

The growing use of AI coding assistants presents unique challenges:

Leveraging Browser Data

Browser credential storage, while convenient, is a significant target.

Obfuscation and Concealment Techniques

Attackers employ various methods to hide malicious payloads and exfiltrated data:

Exploiting Vendor Integrations

Third-party integrations are often points of weakness:

Detection and Prevention Strategies

A multi-layered approach is essential for detecting and preventing secrets exposure. This involves shifting security left in the development lifecycle, continuous monitoring, and robust incident response.

Shift-Left Security and Developer Hygiene

The most effective strategy is to prevent secrets from being exposed in the first place.

Automated Scanning and Monitoring

Continuous scanning across various stages of the software development lifecycle (SDLC) is critical.

Secrets Management Lifecycle

A robust secrets management strategy is crucial for the entire lifecycle of a secret.

Non-Human Identity (NHI) Governance

Given the prevalence of NHIs, dedicated governance is required.

Incident Response Playbooks

Having a well-defined incident response plan for secrets leaks is vital.

Credential Verification

Reducing false positives and focusing on actionable alerts is important.

Tooling for Secrets Management and Detection

A robust ecosystem of tools exists to support the detection, management, and prevention of secrets exposure.

Secrets Detection and Scanning Tools

These tools are designed to identify secrets within code, configurations, and other artifacts.

Secrets Management Platforms

These tools provide centralized storage, access control, and lifecycle management for secrets.

Developer Endpoint Security Tools

Specific tools address the unique challenges of secrets on developer workstations.

AI Security and Governance Tools

Tools are emerging to address the specific risks introduced by AI.

Cloud Security Platforms

Comprehensive cloud security solutions often include secrets detection.

Recent Developments and Trends

The secrets security landscape is dynamic, with new trends and threats emerging regularly.

AI's Escalating Role in Secrets Leakage

AI coding assistants are a double-edged sword. While they accelerate development, they also contribute significantly to secrets sprawl. Developers using AI assistants leak secrets at approximately twice the rate of those who don't [1]. This is attributed to the AI's training data, its tendency to autocomplete based on common (often insecure) patterns, and its direct access to local environment files [25][52]. The increase in AI-service secrets by 81% in 2025 is a stark indicator of this trend [3][7].

The Rise of Non-Human Identities (NHIs)

NHIs are outnumbering human identities, and their mismanagement represents a significant security risk [41][9]. These identities, from service accounts to API keys, often have broad permissions and lack the oversight of human account management. A substantial portion of organizations have high-privilege NHIs exposed to the internet with vulnerabilities [9].

Persistence of Leaked Secrets

The long shelf-life of leaked secrets remains a critical issue. The finding that 64% of secrets identified in 2022 were still valid in 2026 underscores the need for proactive credential revocation and lifecycle management [3][7][38]. This persistence means that even old breaches can continue to pose a threat.

Attack Surface Expansion Beyond Code Repositories

Secrets are no longer confined to code. They are found in Docker images, collaboration tools (Slack, Jira), cloud storage, and developer endpoints [2][38]. This diffusion makes traditional code-centric scanning insufficient. The CISA leak, for example, originated from a public GitHub repository, highlighting the risks of any publicly accessible storage [4][53].

Sophistication of Supply Chain Attacks

Supply chain attacks continue to evolve, leveraging sophisticated techniques. The nx npm package compromise, for instance, led to stolen GitHub tokens and OIDC abuse, granting 72-hour AWS admin access [31]. The "Mini Shai-Hulud" campaign variants are spreading across ecosystems, exhibiting worm-like behavior to steal credentials and propagate further [20][18][19]. The validation of SLSA provenance in some attacks indicates a growing challenge in distinguishing legitimate software from malicious tampering [17].

Exploitation of AI Infrastructure

The infrastructure supporting AI models is also becoming a target. The Hugging Face breach, attributed to a rogue OpenAI agent, demonstrated the potential for sensitive data exposure from AI platforms themselves [26][27]. Exposed DeepSeek databases have leaked chat history and secret keys, highlighting the risks associated with AI service providers [51].

Where to Go Deeper

For those seeking to deepen their understanding and improve their secrets security posture, several resources and areas of focus are recommended.

Continuous Learning and Threat Intelligence

Staying abreast of the latest attack vectors and trends is crucial. Regularly reviewing security research from organizations like GitGuardian, Wiz, Snyk, and Aikido provides valuable insights into emerging threats and vulnerabilities. GitHub's blog also offers regular updates on security findings.

OWASP Cheat Sheets

The OWASP Cheat Sheet Series offers practical guidance on a wide range of security topics. The "Secrets Management - OWASP Cheat Sheet Series" is an excellent starting point for understanding best practices in centralization, standardization, access control, and automation [40].

Tooling Deep Dives

Understanding the capabilities and limitations of key tooling is essential.

Focus on Developer Endpoint Security

Given its role as the new perimeter, understanding the unique challenges of securing developer endpoints is critical. Research on this topic from GitGuardian [11][39] provides actionable insights.

Non-Human Identity (NHI) Governance

As NHIs become more prevalent, dedicated resources on their security are essential. Understanding their characteristics and risks is key to effective management [41][9].

Incident Response and Remediation

Developing robust incident response playbooks for secrets leaks is vital. Resources that detail post-compromise analysis and remediation techniques, such as those covering Git history rewriting and prompt revocation strategies, are invaluable [3][4][43].

Exploring Specific Attack Vectors

Deep dives into specific attack patterns are highly informative:

The continuous evolution of threats means that ongoing learning and adaptation are not optional but a necessity for maintaining a strong application security posture.

Sources cited in this guide

  1. What Was on This Machine? Answering the Blast Radius Question After a Laptop Compromise — blog.gitguardian.com
  2. Why SAST and DAST Aren't Enough for Secrets Security — blog.gitguardian.com
  3. How to Reduce Time to Revoke for Exposed Credentials — blog.gitguardian.com
  4. Lessons Learned from CISAs Recent GitHub Leak — krebsonsecurity.com
  5. GitHub Secret Scanning Now Watches All Public Repos for Leaked Enterprise Keys — techtimes.com
  6. 6 security settings every GitHub maintainer should enable this week — github.blog
  7. How to Measure Time to Revoke for Exposed Credentials — blog.gitguardian.com
  8. Every Laptop Is a Credential Store: Where Secrets Hide — blog.gitguardian.com
  9. Secure non-human identities with Wiz’s newest CIEM dashboard — wiz.io
  10. What CISA Got Right After Its GitHub Leak: Lessons Every Organization Should Copy — blog.gitguardian.com
  11. The Perimeter Moved to the Laptop: From Network, to Identity, to the Developer Endpoint — blog.gitguardian.com
  12. Under the Radar: Exploring Spring Boot Actuator Misconfigurations — wiz.io
  13. TryHackMe: Room 404 Walkthrough (Hacker’s Holiday Challenge) — infosecwriteups.com
  14. Compromised @injectivelabs/sdk-ts exfiltrates wallet keys through fake telemetry — aikido.dev
  15. Malicious Release of elementary-data PyPI Package Steals Cloud Credentials from Data Engineers — snyk.io
  16. lightning PyPI Compromise: A Bun-Based Credential Stealer in Python — snyk.io
  17. TanStack Npm Packages Compromised Inside The Mini Shai Hulud Supply Chain Attack — snyk.io
  18. Red Hat npm Packages Compromised to Spread a Credential-Stealing Worm — aikido.dev
  19. Four Credential-Harvesting Campaigns Hit Open Source Ecosystems in Two Weeks — blog.gitguardian.com
  20. "A Mini Shai-Hulud Has Appeared": Bun-Based Stealer Hits SAP @cap-js and mbt npm Packages — snyk.io
  21. Shai-Hulud Hits SAP: Stolen Credentials Found in 1200 GitHub Repos — ox.security
  22. Supply chain attack against SAP npm packages facilitates credential theft — scworld.com
  23. Supply Chain Campaign Targets SAP npm Packages with Credential-Stealing Malware — wiz.io
  24. When a vendor's breach becomes yours: lessons from the Klue incident — snyk.io
  25. From .env to Leakage: Mishandling of Secrets by Coding Agents — knostic.ai
  26. Four incident-response decisions from the Hugging Face breach — aikido.dev
  27. An AI Agent Breached Hugging Face. The Attack Playbook Was Older Than the Attacker — blog.gitguardian.com
  28. TruffleHog: Deep Dive on Secret Management (Jit) — jit.io
  29. How TruffleHog Verifies Secrets — trufflesecurity.com
  30. TruffleHog - Find, Verify, and Analyze Leaked Credentials — github.com
  31. UNC6426 Exploits nx npm Supply-Chain Attack to Gain AWS Admin Access in 72 Hours — thehackernews.com
  32. Claude Code is leaking API keys into public package registries — bdtechtalks.com
  33. Browser Stored Credentials — ipurple.team
  34. GitHub Found 39M Secret Leaks in 2024 — The GitHub Blog — github.blog
  35. Product showcase: Stop secrets from leaking through AI coding tools with GitGuardian — helpnetsecurity.com
  36. 10K Docker Images Spray Live Cloud Creds — theregister.com
  37. Thousands of Secrets Exposed on Docker Hub — flare.io
  38. 23.8 Million Secrets Leaked on GitHub: The Case for Expiring Credentials — zerohost.net
  39. Extending Our Mission With Developer Endpoint Protection — blog.gitguardian.com
  40. Secrets Management - OWASP Cheat Sheet Series — cheatsheetseries.owasp.org
  41. Non-human identities: What they are and how to secure them (Netwrix) — netwrix.com
  42. Gitleaks vs TruffleHog 2026 Benchmarks (AppSec Santa) — appsecsanta.com
  43. How to Detect and Clean Up Leaked Secrets in Your Git Repositories — blakyaks.com
  44. TruffleHog vs. Gitleaks: A Detailed Comparison — jit.io
  45. Researcher Unearths Thousands of Leaked Secrets in GitHub's "Oops Commits" — infoq.com
  46. CVE-2026-5807: HashiCorp Vault DoS via Unauthenticated Root Token Generation — advisories.gitlab.com
  47. HCSEC-2026-08: Vault DoS via Unauthenticated Root Token Generation — discuss.hashicorp.com
  48. CVE-2026-3605: HashiCorp Vault KVv2 Metadata Policy Bypass (DoS) — advisories.gitlab.com
  49. HCSEC-2026-05: Vault KVv2 Metadata Policy Bypass DoS — discuss.hashicorp.com
  50. The many ways to obtain credentials in AWS — wiz.io
  51. Wiz Research Uncovers Exposed DeepSeek Database Leaking Sensitive Information, Including Chat History — wiz.io
  52. 29 Million Secrets Leaked: AI Coding Tools Making It Worse — turbogeek.co.uk
  53. How We Got a CISA GitHub Leak Taken Down in Under a Day — blog.gitguardian.com
📚 This guide is synthesized from the full text of resources curated in the Secrets library, and refreshed as new material is added.