Key Takeaways

Why Cloud Secrets Management Testing Matters for Bug Bounty

Every cloud application depends on secrets — API keys, database passwords, service account credentials, encryption keys, OAuth tokens. When these secrets leak or their management infrastructure is misconfigured, attackers gain direct access to production systems without needing to exploit any application vulnerability.

In 2026, secrets exposure remains one of the most impactful vulnerability classes in bug bounty. The reason is simple: a single leaked credential often provides more access than any SQL injection or XSS chain. Programs know this, which is why exposed production credentials routinely earn critical-severity bounties.

This guide covers the complete methodology for finding secrets management vulnerabilities in bug bounty targets — from automated scanning to manual analysis of vault misconfigurations.

Understanding the Secrets Attack Surface

Before hunting for secrets, you need to understand where they live and how they leak. The attack surface breaks down into three categories:

1. Secrets in Code and Artifacts

The most common exposure vector. Secrets end up in:

2. Secrets Management Infrastructure

Organizations use dedicated tools to manage secrets, and these tools themselves become targets:

3. Secrets in Transit

Secrets leak during runtime through:

Phase 1: Automated Secrets Scanning

Start every engagement with automated scanning to catch the obvious leaks. This is your baseline — it finds the low-hanging fruit that many programs still haven't addressed.

GitHub Repository Scanning

If the target has public repositories, scan them immediately:

# TruffleHog — scans entire Git history for high-entropy strings and known patterns
trufflehog github --org=target-org --only-verified

# Gitleaks — fast pattern-based scanning
gitleaks detect --source=https://github.com/target-org/repo --verbose

# Search for specific file patterns that commonly contain secrets
# .env files, config files, key files
github-dorking: "org:target-org filename:.env"
github-dorking: "org:target-org filename:credentials"
github-dorking: "org:target-org filename:secret"
github-dorking: "org:target-org extension:pem"
github-dorking: "org:target-org extension:key"

TruffleHog's --only-verified flag is critical — it actually tests discovered credentials against their respective APIs, so you only get results that are currently valid. This saves hours of manual validation.

JavaScript Bundle Analysis

Modern web applications bundle secrets into client-side JavaScript more often than you'd expect:

# Download and extract JavaScript bundles
wget -r -l 1 -A "*.js" https://target.com/

# Search for common secret patterns
grep -rn "AKIA[0-9A-Z]{16}" *.js          # AWS Access Key IDs
grep -rn "sk_live_[a-zA-Z0-9]{24}" *.js    # Stripe Live Secret Keys
grep -rn "AIza[0-9A-Za-z_-]{35}" *.js      # Google API Keys
grep -rn "ghp_[a-zA-Z0-9]{36}" *.js        # GitHub Personal Access Tokens
grep -rn "xox[bpsa]-[a-zA-Z0-9-]+" *.js    # Slack Tokens

# Use nuclei for structured scanning
nuclei -u https://target.com -t exposures/tokens/

Cloud-Specific Scanning

If you discover cloud credentials during recon, validate them safely:

# AWS — validate without making changes
aws sts get-caller-identity  # Shows account ID, user/role ARN
aws iam list-attached-user-policies --user-name $(aws iam get-user --query 'User.UserName' --output text)

# GCP — validate service account
gcloud auth activate-service-account --key-file=found-key.json
gcloud projects list  # Shows accessible projects

# Azure — validate service principal
az login --service-principal -u $APP_ID -p $SECRET --tenant $TENANT_ID
az account list  # Shows accessible subscriptions

Phase 2: Manual Secrets Discovery

Automated tools catch known patterns, but many secrets don't match standard regex patterns. Manual analysis finds what scanners miss.

Environment and Debug Endpoints

Probe for endpoints that dump configuration data:

# Spring Boot Actuator (Java applications)
/actuator/env
/actuator/configprops
/actuator/heapdump    # Memory dump — may contain secrets

# Django/Flask debug mode
/debug/
/__debug__/

# Node.js/Express
/env
/debug/vars

# PHP
/phpinfo.php          # Shows environment variables
/.env                 # Laravel/Symfony environment file

# Generic
/server-info
/server-status
/config
/configuration

Spring Boot Actuator's /actuator/env endpoint is particularly valuable — even when it masks secret values with asterisks, the key names reveal what secrets exist, and the /actuator/heapdump endpoint often contains the actual values in memory.

Error-Based Secret Extraction

Trigger errors that may reveal secrets in stack traces:

API Response Analysis

Some APIs return more data than intended:

# Check user profile endpoints for leaked tokens
GET /api/v1/me
GET /api/v1/user/profile
GET /api/v1/account/settings

# Check configuration endpoints
GET /api/v1/config
GET /api/v1/settings
GET /api/v1/app/config

# Check admin endpoints (even without admin access — some leak data in 403 responses)
GET /api/v1/admin/config
GET /api/v1/internal/config

Phase 3: Secrets Management Infrastructure Testing

When targets use dedicated secrets management tools, test the infrastructure itself.

HashiCorp Vault

Vault is the most common secrets manager in production environments. Look for:

# Discover Vault endpoints
# Default ports: 8200 (HTTP), 8201 (cluster)
nmap -p 8200,8201 target.com

# Check if Vault UI is exposed
curl -s https://target.com:8200/ui/ | grep -i vault

# Check Vault health (unauthenticated)
curl -s https://target.com:8200/v1/sys/health

# Check seal status
curl -s https://target.com:8200/v1/sys/seal-status

# Test for unauthenticated access to secret paths
curl -s https://target.com:8200/v1/secret/data/test
curl -s https://target.com:8200/v1/kv/data/test

# Check if token auth allows listing
curl -s -H "X-Vault-Token: root" https://target.com:8200/v1/sys/mounts

Common Vault misconfigurations:

AWS Secrets Manager and Parameter Store

If you have any level of AWS access (even read-only), check for secrets access:

# List secrets you can access
aws secretsmanager list-secrets
aws ssm describe-parameters

# Attempt to read secret values
aws secretsmanager get-secret-value --secret-id production/database
aws ssm get-parameter --name /production/db-password --with-decryption

# Check for unencrypted SSM parameters (SecureString vs String)
aws ssm describe-parameters --query "Parameters[?Type=='String']"

Key findings to report:

Azure Key Vault

# List accessible Key Vaults
az keyvault list

# Attempt to list secrets in a vault
az keyvault secret list --vault-name target-vault

# Check access policies
az keyvault show --name target-vault --query "properties.accessPolicies"

# Look for soft-deleted secrets (recoverable)
az keyvault secret list-deleted --vault-name target-vault

Kubernetes Secrets

If you have any Kubernetes access, secrets are a prime target:

# List secrets in all namespaces
kubectl get secrets --all-namespaces

# Read a specific secret (base64-encoded, not encrypted)
kubectl get secret db-credentials -o jsonpath='{.data}' | base64 -d

# Check RBAC — can your service account read secrets?
kubectl auth can-i get secrets --all-namespaces

# Look for secrets mounted as environment variables in pods
kubectl get pods -o jsonpath='{range .items[*]}{.metadata.name}{"\n"}{range .spec.containers[*]}{.env[*]}{"\n"}{end}{end}'

Phase 4: Git History Deep Dive

Secrets removed from the current codebase often persist in Git history. This is one of the most productive manual techniques.

# Search entire Git history for secrets
git log -p --all -S 'AKIA'           # AWS keys
git log -p --all -S 'password'       # Passwords
git log -p --all -S 'secret_key'     # Generic secrets
git log -p --all -S 'BEGIN RSA'      # Private keys

# Find deleted files that may have contained secrets
git log --diff-filter=D --summary | grep -E '\.(env|key|pem|p12|pfx|json)$'

# Check specific commits where .gitignore was modified
# (developers often add .env to .gitignore AFTER committing it)
git log -p -- .gitignore

# Extract a deleted file from history
git show <commit-hash>:path/to/.env

Phase 5: Reporting Secrets Findings

Secrets findings require careful reporting to demonstrate impact without causing harm.

Report Structure

  1. What was found — type of secret (AWS key, database password, API token), where it was found (Git commit, JS bundle, API response)
  2. Validation method — exactly how you confirmed the secret is valid, using only read-only operations
  3. Access scope — what the secret grants access to (list IAM permissions, accessible resources, data exposure)
  4. Impact — what an attacker could do with this access (data exfiltration, infrastructure compromise, lateral movement)
  5. Remediation — rotate the secret immediately, remove from source code, implement proper secrets management

Severity Guidelines

Common Secrets Patterns by Cloud Provider

Provider Secret Type Pattern / Identifier
AWS Access Key ID AKIA[0-9A-Z]{16}
AWS Secret Access Key 40-character base64 string
GCP Service Account Key JSON file with type: "service_account"
GCP API Key AIza[0-9A-Za-z_-]{35}
Azure Storage Account Key 88-character base64 string
Azure Connection String DefaultEndpointsProtocol=https;AccountName=...
Stripe Live Secret Key sk_live_[a-zA-Z0-9]{24,}
GitHub Personal Access Token ghp_[a-zA-Z0-9]{36}
Slack Bot/User Token xox[bpsa]-[a-zA-Z0-9-]+
Firebase Config apiKey in firebaseConfig object

Tools Reference

Tool Purpose Best For
TruffleHog Git history + live credential scanning Verified credential discovery across repos
Gitleaks Pattern-based secret scanning Fast CI/CD integration, custom rules
Nuclei Template-based vulnerability scanning Exposed tokens in web responses
Trivy Container and filesystem scanning Secrets in Docker images and filesystems
KeyHacks API key validation techniques Verifying discovered keys are valid

Internal Links

Advertisement