SSZcreate/Pentab_server / .agents/skills/cybersecurity/skills/detecting-aws-credential-exposure-with-trufflehog
detecting-aws-credential-exposure-with-trufflehog
FlaggedScan source code repositories, CI/CD pipelines, and configuration files for exposed AWS credentials using TruffleHog, git-secrets, and AWS-native detection. Use when integrating secrets scanning into CI/CD, auditing repositories (including git history) for historically committed AWS keys, responding to a GuardDuty alert about credential use from an unexpected location, or verifying credential rotation removed all exposed keys.
| File | Kind | Size |
|---|---|---|
| LICENSE | other | 11.0 KB |
| SKILL.md | skill md | 11.3 KB |
| references/api-reference.md | markdown | 2.1 KB |
| scripts/agent.py | script | 7.6 KB |
references/api-reference.md
View on GitHub# AWS Credential Exposure Detection API Reference
## TruffleHog CLI
```bash
# Scan local git repo
trufflehog git file:///path/to/repo --json
# Scan GitHub organization
trufflehog github --org my-org --token $GITHUB_TOKEN --json
# Scan GitHub repo
trufflehog git https://github.com/org/repo.git --json
# Scan filesystem (non-git)
trufflehog filesystem /path/to/dir --json
# Scan S3 bucket
trufflehog s3 --bucket my-bucket --json
# Only show verified credentials
trufflehog git file:///repo --only-verified --json
```
## git-secrets CLI
```bash
# Install hooks in repo
git secrets --install
git secrets --register-aws
# Scan repo history
git secrets --scan-history
# Scan specific file
git secrets --scan /path/to/file
# Add custom pattern
git secrets --add 'PRIVATE KEY'
git secrets --add-provider -- cat /path/to/patterns.txt
```
## AWS IAM CLI - Key Management
```bash
# Check key last used
aws iam get-access-key-last-used --access-key-id AKIA_SAMPLE_KEY_EXAMPLE_4
# List access keys for user
aws iam list-access-keys --user-name jsmith
# Deactivate exposed key
aws iam update-access-key --access-key-id AKIA_SAMPLE_KEY_EXAMPLE_4 \
--user-name jsmith --status Inactive
# Delete key
aws iam delete-access-key --access-key-id AKIA_SAMPLE_KEY_EXAMPLE_4 \
--user-name jsmith
# Create new key (after rotation)
aws iam create-access-key --user-name jsmith
```
## AWS Access Key Regex Patterns
```
Access Key ID: AKIA[A-Z0-9]{16}
Temp Key ID: ASIA[A-Z0-9]{16}
Secret Key: [A-Za-z0-9/+=]{40}
```
## GuardDuty Credential Findings
| Finding Type | Description |
|-------------|-------------|
| `UnauthorizedAccess:IAMUser/InstanceCredentialExfiltration.OutsideAWS` | Instance creds used outside AWS |
| `UnauthorizedAccess:IAMUser/ConsoleLoginSuccess.B` | Console login from unusual IP |
| `Recon:IAMUser/MaliciousIPCaller.Custom` | API calls from threat intel IPs |
## AWS CloudTrail - Credential Abuse Queries (Athena)
```sql
SELECT eventtime, useridentity.accesskeyid, sourceipaddress, eventname
FROM cloudtrail_logs
WHERE useridentity.accesskeyid = 'AKIA_SAMPLE_KEY_EXAMPLE_4'
ORDER BY eventtime DESC
LIMIT 100;
```
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |