Skip to content

DenizParlak/heimdall

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

4 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Heimdall Logo

Heimdall

AWS Attack Path Scanner
The Bifrรถst Guardian for Your Cloud Security

Quick Start โ€ข Examples โ€ข Features โ€ข Installation โ€ข Commands โ€ข Roadmap

Python License AWS Patterns


What is Heimdall?

Heimdall is an AWS security scanner that discovers privilege escalation paths attackers could exploit to gain admin access.

By the numbers:

  • ๐ŸŽฏ 50+ IAM privilege escalation patterns detected
  • ๐Ÿ”— 85+ attack chain patterns with MITRE ATT&CK mapping
  • ๐ŸŒ 10 AWS services analyzed for cross-service escalation
  • โœ… Low false-positive rate - tested on production accounts with 50+ roles
  • โšก One command to assess your entire security posture

In Norse mythology, Heimdall stands at Bifrรถst and sees all paths between realms.
In AWS, Heimdall watches your environment and reveals all paths to compromise.

โœจ Key Features

Feature Description
๐Ÿ”— Attack Chain Analysis Multi-step privilege escalation paths with MITRE ATT&CK mapping
๐ŸŒ Cross-Service Scanner Analyze 10 AWS services (EC2, RDS, S3, Lambda, KMS, Secrets Manager, STS, SNS, SQS, DynamoDB)
๐Ÿ—๏ธ Terraform Engine โญ Detect IAM attack paths in Terraform plans before deployment
๐ŸŽจ Interactive TUI Cosy Nordic-themed terminal interface
๐Ÿ“Š One-Command Dashboard heimdall dashboard - instant security overview
๐ŸŽฏ 50+ Privesc Patterns Comprehensive IAM privilege escalation coverage
๐Ÿ“ค CI/CD Ready SARIF export for GitHub Security, CSV for spreadsheets
๐Ÿ”’ Baseline System Ignore known/accepted risks with .heimdall-ignore

๐Ÿข Enterprise Edition (Preview)

๐Ÿ”’ Limited Access - Web UI is currently in private preview.
Interested in a demo? Contact: denizparlak@protonmail.ch

๐Ÿ–ผ๏ธ Click to see Web UI Screenshots

Attack Simulator - Interactive privilege escalation visualization Attack Simulator

Live Graph - Real-time security posture with auto-refresh Live Graph

Trust Graph - IAM trust relationship explorer Trust Graph


๐Ÿš€ Quick Start

# 1. Install
pip install -e .

# 2. One-command security overview
heimdall dashboard

# 3. Deep privilege escalation analysis
heimdall iam detect-privesc --profile prod

That's it! You'll see a complete security posture in seconds.


๐Ÿงช Real World Examples

โœ… Well-Configured Account (No False Positives)

$ heimdall iam scan --profile prod --summary

โœ“ Scanned 52 IAM roles
โœ“ Scanned 40 IAM users
โœ“ Found 55 assume-role relationships
โœ“ Identified 0 privilege escalation paths

Summary:
  Roles: 52
  Users: 40
  Service principals: 29
  Federated principals: 1
  Humanโ†’Role paths: 1
  Risky paths: 0 (Critical: 0, High: 0)

โœ… Good security posture detected:
   - Admin access via SSO only (federated)
   - Minimal userโ†’role permissions
   - Service roles properly isolated

โš ๏ธ Account with Privilege Escalation Risks

$ heimdall iam detect-privesc --profile prod

๐Ÿ” Heimdall Privilege Escalation Detector

โœ“ Scanned 52 IAM roles
โœ“ Scanned 40 IAM users
โœ“ Detected 14 privilege escalation opportunities

โš ๏ธ  Privilege Escalation Opportunities:

CRITICAL (8):
  โ€ข user/admin-user
    Method: passrole_lambda
    Create Lambda with privileged role, execute code with elevated permissions

  โ€ข user/admin-user
    Method: attach_user_policy
    Attach AdministratorAccess policy to self or other user

HIGH (6):
  โ€ข user/admin-user
    Method: create_policy_version
    Modify existing policy to grant admin access

๐Ÿ”— Multi-Hop Attack Path Detection

$ heimdall iam detect-privesc --include-indirect --max-depth 2

๐Ÿ”— Indirect Privilege Escalation Paths (Multi-Hop):

CRITICAL:
  โ€ข user/junior โ†’ DevRole โ†’ ProdRole
    Path length: 2 hops
    Target: attach_user_policy (CRITICAL)

  โ€ข user/contractor โ†’ IntegrationRole โ†’ DeployerRole โ†’ AdminRole
    Path length: 3 hops
    Target: put_user_policy (CRITICAL)

What's detected:
  โœ“ Devs who can assume roles leading to admin
  โœ“ Contractors with indirect paths through role chains
  โœ“ Hidden escalation paths not obvious from direct permissions

๐Ÿ“ธ Screenshots

๐Ÿ“Š Security Dashboard

One command to see everything: IAM stats, privilege escalation risks, and recommendations.

heimdall dashboard --quick

Dashboard

๐ŸŽจ Interactive TUI

Navigate findings, explore attack chains, and drill down into details with keyboard shortcuts.

heimdall iam tui

TUI

๐Ÿ”— Attack Chain Analysis

Multi-step privilege escalation paths with risk scores and quick fix suggestions.

heimdall iam attack-chain --format tree --top 5 --steps

Attack Chain

๐ŸŒ Cross-Service Analysis

Detect privilege escalation across 10 AWS services (S3, Lambda, EC2, KMS, and more).

heimdall iam cross-service --compact

Cross-Service


โšก Features

๐Ÿ” Core Scanning

  • 50+ Privilege Escalation Patterns - Most comprehensive coverage
  • Trust Graph Analysis - Map all AssumeRole relationships
  • Multi-Hop Detection - Find indirect escalation paths (Aโ†’Bโ†’Cโ†’Admin)

๐Ÿ”— Attack Chain Analysis

  • 85+ Attack Patterns with MITRE ATT&CK mapping
  • Blast Radius Scoring (0-100) - Impact assessment
  • Step-by-Step Narratives - How attacks unfold
  • 3 Output Formats - Table, JSON, Tree

๐ŸŒ Cross-Service Engine

Analyze privilege escalation across 10 AWS services:

Service Checks
๐Ÿ–ฅ๏ธ EC2 Instance profiles, IMDSv1, public IPs
๐Ÿ›ข๏ธ RDS Public instances, snapshot sharing
๐Ÿชฃ S3 Public buckets, cross-account, sensitive data
โšก Lambda Execution roles, env vars, code injection
๐Ÿ” KMS Key policies, grants, cross-account
๐Ÿ”‘ Secrets Resource policies, rotation status
๐Ÿ”€ STS Trust policies, cross-account assumptions
๐Ÿ“ข SNS Topic policies, public access
๐Ÿ“ฌ SQS Queue policies, encryption
๐Ÿ—„๏ธ DynamoDB Encryption, sensitive tables

๐Ÿ—๏ธ Terraform Attack Path Engine

Shift-left security - Detect IAM privilege escalation in Terraform plans before deployment.

# Generate plan JSON
terraform plan -out=plan.tfplan
terraform show -json plan.tfplan > plan.json

# Scan for attack paths
heimdall terraform scan plan.json
heimdall terraform scan plan.json --fail-on critical  # CI/CD gate

What makes it different from tfsec/checkov/trivy?

Tool Approach Focus
tfsec, checkov, trivy Static config checks "Is this bucket encrypted?"
Heimdall Attack path analysis "Does this IAM change create an escalation path to admin?"

Key capabilities:

  • 45+ IAM attack patterns - PassRole chains, trust policy hijacks, credential creation
  • Before/After comparison - Shows security posture change, not just violations
  • Multi-hop chain detection - Developer โ†’ Lambda Role โ†’ Admin
  • Cross-service triggers - S3 โ†’ Lambda, SNS โ†’ Lambda, API Gateway โ†’ Lambda
  • Risk delta scoring - Quantifies security impact of changes

Example output:

โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•คโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•คโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•คโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
โ•‘ Metric                    โ”‚    Before    โ”‚    After     โ”‚     Change      โ•‘
โ•Ÿโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ข
โ•‘ โš”๏ธ Attack Paths            โ”‚      2       โ”‚      7       โ”‚       +5        โ•‘
โ•‘ ๐ŸŽฏ Risk Score             โ”‚      10      โ”‚      60      โ”‚       +50       โ•‘
โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•งโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•งโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•งโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

โ›” BLOCKING ISSUES:
  โ€ข CHAIN: 'dev-role' โ†’ PassRole โ†’ admin role 'prod-admin'
  โ€ข CRITICAL: Role 'deploy-role' can create credentials (iam:CreateAccessKey)

Terraform Sample Scan

๐ŸŽจ Interactive TUI

  • Nordic-themed beautiful terminal interface
  • Real-time finding exploration
  • Keyboard navigation - vim-style bindings
  • Live scan progress with logs

๐Ÿ“Š Dashboard

  • One-command security overview
  • Risk scoring (0-100)
  • Severity breakdown with visual bars
  • Actionable recommendations

๐Ÿ“ค Export & Integration

  • SARIF - GitHub Security Code Scanning
  • CSV - Excel/Sheets analysis
  • JSON - CI/CD pipelines
  • Baseline - Ignore known/accepted risks

๐Ÿ“ฆ Installation

Requirements

  • Python 3.9+
  • AWS credentials configured (~/.aws/credentials or environment)

Install from Source

git clone https://github.com/DenizParlak/heimdall.git
cd heimdall
pip install -e .

Verify Installation

heimdall doctor
heimdall --version

๐Ÿ”ง Commands

Quick Overview

heimdall dashboard                    # ๐ŸŽฏ One-command security overview
heimdall dashboard --quick            # Skip cross-service (faster)

IAM Scanning

heimdall iam scan                     # Scan IAM, build trust graph
heimdall iam detect-privesc           # Find privilege escalation
heimdall iam detect-privesc --explain # AI-powered explanations

Attack Analysis

heimdall iam attack-chain             # Multi-step attack paths
heimdall iam attack-chain --top 10    # Top 10 chains
heimdall iam cross-service            # Cross-service escalation
heimdall iam cross-service --compact  # Summary only

Interactive Mode

heimdall iam tui                      # Interactive terminal UI
heimdall iam tui --graph scan.json    # Load existing scan

Terraform Security

# Scan Terraform plan for attack paths
heimdall terraform scan plan.json                    # Full analysis
heimdall terraform scan plan.json --quick            # Skip AWS state fetch
heimdall terraform scan plan.json --json             # JSON output
heimdall terraform scan plan.json --fail-on critical # CI/CD gate

# Detailed report
heimdall terraform report plan.json --format markdown

Export & CI/CD

# SARIF for GitHub Security
heimdall iam detect-privesc --format sarif -o findings.sarif

# CSV for spreadsheets
heimdall iam detect-privesc --format csv -o findings.csv

# With baseline (ignore known risks)
heimdall iam detect-privesc --baseline .heimdall-ignore
heimdall iam detect-privesc --init-baseline  # Create sample file

Utilities

heimdall quickstart                   # Interactive setup guide
heimdall doctor                       # Health check
heimdall aws profiles                 # List AWS profiles
heimdall completion zsh               # Shell completion

๐Ÿ” Required IAM Permissions

Minimum permissions for Heimdall to scan your account:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "iam:List*",
        "iam:Get*",
        "sts:GetCallerIdentity"
      ],
      "Resource": "*"
    }
  ]
}

For cross-service scanning, add:

{
  "Action": [
    "s3:ListAllMyBuckets",
    "s3:GetBucketPolicy",
    "lambda:ListFunctions",
    "lambda:GetFunction",
    "ec2:DescribeInstances",
    "kms:ListKeys",
    "secretsmanager:ListSecrets"
  ],
  "Resource": "*"
}

๐Ÿ—บ๏ธ Roadmap

โœ… Completed

  • 50+ IAM privilege escalation patterns
  • Attack chain analysis with MITRE mapping
  • Cross-service scanner (10 services)
  • Interactive TUI
  • One-command dashboard
  • SARIF/CSV export
  • Baseline/ignore system
  • Terraform Attack Path Engine โญ NEW

๐Ÿ”œ Coming Soon

  • Slack/Teams alerts
  • Multi-account organization scanning
  • Compliance framework mapping (CIS, PCI-DSS)
  • Auto-remediation suggestions

๐Ÿค Contributing

Contributions welcome! Please read CONTRIBUTING.md first.

# Run tests
pytest

# Run linting
ruff check heimdall/

๐Ÿ“„ License

MIT License - see LICENSE for details.


๐Ÿ™ Credits

Built with:


Heimdall Guard your cloud like Heimdall guards Bifrรถst
Made with โค๏ธ for the AWS security community

About

AWS Attack Path Scanner - Discover privilege escalation paths across 10+ AWS services

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages