acquiring-disk-image-w…
Create forensically sound bit-for-bit disk images using dd and dcfldd while preserving evidence integrity through
Detecting exposed AWS credentials in source code repositories, CI/CD pipelines, and configuration files using
$ npx -y skills add Mikaru0Mystic/sectinel --skill detecting-aws-credential-exposure-with-trufflehog --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/detecting-aws-credential-exposure-with-trufflehogContext preview
The summary Claude sees to decide when to auto-load this skill.
Detecting exposed AWS credentials in source code repositories, CI/CD pipelines, and configuration files using
name: detecting-aws-credential-exposure-with-trufflehog description: 'Detecting exposed AWS credentials in source code repositories, CI/CD pipelines, and configuration files using TruffleHog, git-secrets, and AWS-native detection mechanisms to prevent credential theft and unauthorized account access. ' domain: cybersecurity subdomain: cloud-security tags: - cloud-security - aws - credential-exposure - trufflehog - secrets-detection - devsecops version: '1.0' author: mahipal license: Apache-2.0 nist_csf: - PR.IR-01 - ID.AM-08 - GV.SC-06 - DE.CM-01
**Do not use** for real-time credential monitoring (use AWS GuardDuty or Amazon Macie), for managing secrets (use AWS Secrets Manager or HashiCorp Vault), or for detecting non-credential sensitive data like PII (use Amazon Macie or DLP tools).
Install TruffleHog v3 and verify it can detect the AWS credential patterns.
# Install TruffleHog v3 pip install trufflehog # Or install from binary release curl -sSfL https://raw.githubusercontent.com/trufflesecurity/trufflehog/main/scripts/install.sh | sh -s -- -b /usr/local/bin # Verify installation trufflehog --version # Test with a known test repository trufflehog git https://github.com/trufflesecurity/test_keys --only-verified
Scan entire git history including all branches and commits for AWS access keys, secret keys, and session tokens.
# Scan a local git repository (full history) trufflehog git file:///path/to/repo --only-verified --json > trufflehog-results.json # Scan a GitHub organization's repositories trufflehog github --org=your-organization --token=$GITHUB_TOKEN --only-verified # Scan a specific GitHub repository with all branches trufflehog git https://github.com/org/repo.git --only-verified --branch=main # Scan a GitLab group trufflehog gitlab --group=your-group --token=$GITLAB_TOKEN --only-verified # Scan filesystem paths for credentials in config files trufflehog filesystem /path/to/project --only-verified
Parse TruffleHog results to identify verified (still-active) credentials versus rotated or test keys.
# Parse TruffleHog JSON output for AWS findings
cat trufflehog-results.json | python3 -c "
import json, sys
for line in sys.stdin:
finding = json.loads(line)
if 'AWS' in finding.get('DetectorName', ''):
print(f\"Detector: {finding['DetectorName']}\")
print(f\"Verified: {finding.get('Verified', False)}\")
print(f\"Source: {finding.get('SourceMetadata', {})}\")
print(f\"Commit: {finding.get('SourceMetadata', {}).get('Data', {}).get('Git', {}).get('commit', 'N/A')}\")
print(f\"File: {finding.get('SourceMetadata', {}).get('Data', {}).get('Git', {}).get('file', 'N/A')}\")
print('---')
"
# Check if a detected access key is still active
aws iam get-access-key-last-used --access-key-id AKIAIOSFODNN7EXAMPLE
# List all access keys for a user to find active keys
aws iam list-access-keys --user-name target-user \
--query 'AccessKeyMetadata[*].[AccessKeyId,Status,CreateDate]' --output tablePrevent credentials from being committed in the first place using git-secrets as a pre-commit hook.
# Install git-secrets
git secrets --install # In each repository
# Register AWS credential patterns
git secrets --register-aws
# Add custom patterns for internal credential formats
git secrets --add 'AKIA[0-9A-Z]{16}'
git secrets --add 'aws_secret_access_key\s*=\s*.{40}'
git secrets --add 'aws_session_token\s*=\s*.+'
# Scan entire repository history
git secrets --scan-history
# Add to global git template for all new repos
git secrets --install ~/.git-templates/git-secrets
git config --global init.templateDir ~/.git-templates/git-secretsAdd TruffleHog scanning as a CI/CD gate to block deployments containing exposed credentials.
# GitHub Actions workflow (.github/workflows/secrets-scan.yml)
name: Secrets Scan
on: [push, pull_request]
jobs:
trufflehog:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: TruffleHog Scan
uses: trufflesecurity/trufflehog@main
with:
extra_args: --only-verified --results=verified# GitLab CI (.gitlab-ci.yml)
secrets_scan:
stage: test
image: trufflesecurity/trufflehog:latest
script:
- trufflehog git file://$CI_PROJECT_DIR --since-commit $CI_COMMIT_BEFORE_SHA --only-verified --fail
allow_failure: falseExecute incident response procedures when verified credentials are found exposed.
# IMMEDIATE: Deactivate the exposed access key aws iam update-access-key \ --user-name compromised-us
Open-source security arsenal for AI coding agents: 784 cybersecurity skills, scanner integrations, and a security MCP for Claude Code, Cursor, opencode, Gemini CLI, Cline, and any agentskills.io agent. Mapped to OWASP, MITRE ATT&CK, NIST CSF, D3FEND, ATLAS.
Repo: Mikaru0Mystic/sectinel
Create forensically sound bit-for-bit disk images using dd and dcfldd while preserving evidence integrity through
Detect dangerous ACL misconfigurations in Active Directory using ldap3 to identify GenericAll, WriteDACL, and
Perform static analysis of Android APK malware samples using apktool for decompilation, jadx for Java source
Parses API Gateway access logs (AWS API Gateway, Kong, Nginx) to detect BOLA/IDOR attacks, rate limit bypass,
Analyze advanced persistent threat (APT) group techniques using MITRE ATT&CK Navigator to create layered heatmaps
Queries Azure Monitor activity logs and sign-in logs via azure-monitor-query to detect suspicious administrative