본문으로 건너뛰기
Skillpedia
에이전트35k · #7798

detecting-aws-credential-exposure-with-trufflehog

하는 일

이 도구는 코드, 파일 기록, 자동화 시스템에 실수로 노출된 AWS 자격 증명(비밀번호와 비밀 키 등)을 찾습니다. 악용되기 전에 이 민감한 정보를 찾아 경고하도록 돕습니다.

사용하는 경우

  • ✓자동화된 개발 과정(CI/CD)에 보안 점검을 통합할 때.
  • ✓침해된 AWS 키를 찾기 위해 오래된 저장소에 보안 감사를 실시할 때.
  • ✓예상치 못한 위치에서 발생한 자격 증명 사용에 대한 AWS 보안 경보에 대응하는 경우.

스킬 링크

https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/detecting-aws-credential-exposure-with-trufflehog/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/detecting-aws-credential-exposure-with-trufflehog/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“제 코드 저장소에서 노출된 AWS 키를 검사해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

도구는 TruffleHog와 git-secrets 같은 프로그램을 사용해 코드와 파일 기록을 분석합니다. AWS 자격 증명과 비슷한 패턴을 찾고, 여전히 유효한지 확인합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Detecting AWS Credential Exposure with TruffleHog

When to Use

  • When integrating secrets detection into CI/CD pipelines to prevent credential commits reaching production
  • When performing a security audit of existing repositories for historically committed AWS credentials
  • When responding to an AWS GuardDuty alert about credential usage from an unexpected IP or region
  • When onboarding repositories from acquired companies or third-party vendors
  • When validating that credential rotation processes have removed all references to old access keys

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).

Prerequisites

  • TruffleHog v3 installed (brew install trufflehog or pip install trufflehog)
  • git-secrets installed for pre-commit hook integration (brew install git-secrets)
  • Access to source code repositories (GitHub, GitLab, Bitbucket, or local git repos)
  • AWS CLI configured with permissions to check key status (iam:ListAccessKeys, iam:GetAccessKeyLastUsed)
  • GitHub or GitLab API token for scanning organization-wide repositories

Workflow

Step 1: Install and Configure TruffleHog

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

Step 2: Scan Git Repositories for Exposed Credentials

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

Step 3: Analyze and Validate Detected Credentials

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 table

Step 4: Set Up Pre-Commit Hooks with git-secrets

Prevent 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-secrets

Step 5: Integrate TruffleHog into CI/CD Pipeline

…

자주 묻는 질문

AWS 자격 증명이란 무엇인가요?

사람과 프로그램이 AWS 서비스에 접근할 수 있게 하는 로그인 정보(사용자 이름과 비밀번호, 또는 액세스 키 등)입니다.

노출된 자격 증명을 찾는 것이 왜 중요한가요?

공격자가 노출된 자격 증명으로 AWS 자원에 접근해, 예상치 못한 비용, 데이터 도난, 서비스 중단을 일으킬 수 있기 때문입니다.

이 도구로 비밀 정보를 관리할 수 있나요?

아니요, 이 도구는 노출된 비밀 정보를 찾기 위한 것이며 관리하지는 않습니다. 안전한 비밀 정보 관리를 위해서는 AWS Secrets Manager 같은 서비스를 사용하세요.

상세 정보

작성자의 원본 설명

Scan 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 rota

repo: mukul975/Anthropic-Cybersecurity-Skills

인기도

GitHub 스타
35k
순위
#7798
라이선스
Apache-2.0
업데이트
2026. 8. 31.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬