CognitoHunter is a specialized toolkit designed for security researchers and penetration testers to analyze and exploit vulnerabilities in AWS Cognito implementations.

This powerful tool focuses on configuration discovery, credential acquisition, session conversion, and validation, making it a valuable resource for exploring the security of AWS Cognito-based systems.

Key Features

  1. Deep Configuration Discovery
  • Identifies AWS Cognito configurations embedded in web applications and JavaScript files.
  • Extracts critical components like identity pools, user pools, and client IDs.
  • Maps authentication flows to reveal potential vulnerabilities.
  1. Advanced Credential Acquisition
  • Validates identity pools across multiple AWS regions.
  • Obtains temporary AWS credentials for unauthenticated access.
  • Extracts security tokens to facilitate further testing.
  1. Multi-method Session Conversion
  • Supports various session conversion techniques, including SDK token exchange, JWT token exchange, and direct API access.
  • Emulates browser SDKs and leverages Cognito-hosted UI flows for session manipulation.
  1. Session Validation & Hijacking
  • Tests acquired sessions against endpoints to validate their permissions.
  • Generates browser-ready cookies and authorization headers for exploitation.

To install CognitoHunter:

# Clone the repository
git clone https://github.com/yourusername/cognitohunter.git
cd cognitohunter

# Install dependencies
pip3 install -r requirements.txt

Quick Start Examples:

  • Full Analysis Mode:
  python3 cognitohunter.py -u https://example.com -v --insecure
  • Direct Credentials Mode:
  python3 cognitohunter.py -u https://example.com \
      --creds "ACCESS_KEY:SECRET_KEY:SESSION_TOKEN" \
      --identity "IDENTITY_ID"
  1. Configuration Discovery Phase: Scans target websites to extract AWS Cognito configurations and authentication endpoints.
  2. Credential Acquisition Phase: Validates identity pools and retrieves temporary credentials for testing permissions.
  3. Session Conversion Phase: Converts credentials into active sessions using various methods.
  4. Result Generation Phase: Produces detailed analysis reports and exploitation commands.

To mitigate risks associated with AWS Cognito:

  • Disable unauthenticated access unless explicitly required.
  • Implement strict IAM roles and conduct regular audits.
  • Secure session storage with proper timeouts and validation mechanisms.
  • Hide AWS configurations in client-side code and enforce robust CORS policies.

CognitoHunter is intended strictly for authorized security research. Unauthorized use may violate legal agreements or regulations. Always obtain proper permissions before testing any system.

LEAVE A REPLY

Please enter your comment!
Please enter your name here