
IaC 위협 모델러, STRIDE, MITRE ATT&CK 및 PASTA 프레임워크 사용. Terraform, CloudFormation 및 Kubernetes를 위한 REST API, GraphQL 및 Docker 지원.
정적 IaC 위협 모델러로, Terraform, CloudFormation 및 Kubernetes 매니페스트를 파싱하여 STRIDE, MITRE ATT&CK 또는 PASTA 프레임워크를 사용한 구조화된 위협 모델 보고서를 생성합니다. 네트워크 호출, 클라우드 자격 증명이 필요 없으며 완전히 오프라인에서 작동합니다. CLI, REST API 또는 컨테이너화된 서비스로 실행됩니다.
CLI:
pip install threatmap
threatmap scan ./examples --output report.md --fail-on HIGH
Docker:
docker run -v $(pwd):/workspace bogdynn/threatmap:2.1.0 threatmap scan /workspace --output /workspace/report.md
REST API 서버:
threatmap serve --host 0.0.0.0 --port 8000
# 또는 Docker 사용:
docker run -p 8000:8000 bogdynn/threatmap:2.1.0
# API 엔드포인트: /health, /version, /rules, /analyze
GraphQL API:
docker run -p 8000:8000 bogdynn/threatmap:2.1.0
# GraphQL 엔드포인트: http://localhost:8000/graphql
# 쿼리: health, version, rules
# 뮤테이션: analyze(content, filename, framework)
| 형식 | 제공자 | 확장자 |
|---|---|---|
| Terraform HCL | AWS, Azure, GCP | .tf |
| CloudFormation | AWS | .yaml, .yml, .json |
| Kubernetes 매니페스트 | Kubernetes | .yaml, .yml |
PyPI에서 설치:
pip install threatmap
또는 로컬 개발용:
git clone https://github.com/bogdanticu88/threatmap.git
cd threatmap
pip install -e .
디렉터리를 스캔하고 Markdown 보고서를 stdout으로 출력:
threatmap scan ./terraform/
여러 경로를 스캔하고 JSON 보고서를 파일로 작성:
threatmap scan ./terraform/ ./k8s/ ./cloudformation/ --format json --output report.json
대화형 HTML 보고서 또는 GitHub Security용 SARIF 보고서 생성:
threatmap scan ./infra/ --format html --output report.html
threatmap scan ./infra/ --format sarif --output report.sarif
CI 게이트 — CRITICAL 또는 HIGH 위협이 발견되면 종료 코드 1 반환:
threatmap scan ./infra/ --fail-on HIGH --output threat-report.md
전체 보고서 작성 없이 터미널 요약 테이블만 출력:
threatmap scan ./infra/ --summary
유니코드를 지원하지 않는 환경을 위해 ASCII 전용 심각도 표시기(이모지 없음) 사용:
threatmap scan ./infra/ --ascii --output report.md
다양한 위협 모델링 프레임워크를 사용하여 분석:
# STRIDE (기본값)
threatmap scan ./infra/ --framework stride
# MITRE ATT&CK (전술 및 기술에 매핑)
threatmap scan ./infra/ --framework mitre --format json
# PASTA (자산 중심 위협 모델링)
threatmap scan ./infra/ --framework pasta --format json
STRIDE (73개 규칙)
MITRE ATT&CK (11개 규칙, 14개 전술)
PASTA (12개 규칙, 자산 중심)
threatmap scan ./examples --output report.md를 번들 예제에 대해 실행하면 전체 Markdown 보고서가 생성됩니다. 아래는 대표적인 발췌문입니다.
| ID | 심각도 | STRIDE 범주 | 리소스 | 설명 |
|---|---|---|---|---|
| T-001 | 🔴 CRITICAL | Information Disclosure | AuditBucket | S3 버킷 'AuditBucket'에 공용 액세스 차단이 구성되지 않았습니다 — 버킷이 공개적으로 액세스 가능할 수 있습니다. |
| T-002 | 🔴 CRITICAL | Spoofing | WebSecurityGroup | 보안 그룹 'WebSecurityGroup'이 0.0.0.0/0에 SSH/RDP(포트 22/3389)를 노출합니다. |
| T-003 | 🔴 CRITICAL | Elevation of Privilege | app_contributor | 역할 할당 'app_contributor'이 권한 있는 역할 'Contributor'를 부여합니다. |
| T-006 | 🟠 HIGH | Information Disclosure | AuditBucket | S3 버킷 'AuditBucket'에 서버 측 암호화가 구성되지 않았습니다. |
| T-008 | 🟠 HIGH | Elevation of Privilege | api | Deployment 'api'의 컨테이너 'api'가 루트로 실행될 수 있습니다(runAsNonRoot=true 또는 runAsUser=0 없음). |
| T-011 | 🟠 HIGH | Elevation of Privilege | web | EC2 인스턴스 'web'이 IMDSv1을 허용합니다 — 메타데이터 서비스에 세션 토큰 없이 액세스 가능하여 SSRF 기반 자격 증명 도용을 가능하게 합니다. |
### T-002 — Spoofing (CRITICAL)
Resource: AWS::EC2::SecurityGroup.WebSecurityGroup
Property: ingress.ssh_rdp_open
Finding: Security group 'WebSecurityGroup' exposes SSH/RDP (port 22/3389) to 0.0.0.0/0.
Mitigation: Remove public SSH/RDP access. Use AWS Systems Manager Session Manager
or a bastion host with IP restrictions.
보고서는 Mermaid flowchart LR 다이어그램을 추가합니다. 노드는 최악의 심각도에 따라 색상이 지정됩니다(🔴 빨강 = CRITICAL, 🟠 주황 = HIGH). 블록을 Mermaid 렌더러에 붙여넣거나 GitHub에서 직접 확인하십시오.
flowchart LR
Internet((Internet))
subgraph Networking
aws_security_group_web_sg{web_sg}
NetworkPolicy_default_deny{default-deny}
azurerm_network_security_group_app_nsg{app_nsg}
end
subgraph Compute
aws_instance_web[web]
end
subgraph Kubernetes
Namespace_myapp[myapp]
Deployment_api[api]
Service_api_svc[api-svc]
Ingress_api_ingress[api-ingress]
end
subgraph Data
aws_s3_bucket_app_data[(app_data)]
aws_db_instance_app_db[(app_db)]
azurerm_storage_account_app_storage[(app_storage)]
end
subgraph Security
azurerm_key_vault_app_kv[app_kv]
end
subgraph Identity
azurerm_role_assignment_app_contributor[/app_contributor/]
end
AWS__S3__Bucket_AppBucket -->|ref| AWS__S3__Bucket_AuditBucket
AWS__CloudTrail__Trail_AppTrail -->|ref| AWS__S3__Bucket_AuditBucket
Internet -->|HTTPS| Ingress_api_ingress
style aws_security_group_web_sg fill:#ff4444,color:#fff
style aws_s3_bucket_app_data fill:#ff4444,color:#fff
style aws_instance_web fill:#ff8800,color:#fff
style Deployment_api fill:#ff8800,color:#fff
style azurerm_key_vault_app_kv fill:#ffcc00,color:#000
style azurerm_network_security_group_app_nsg fill:#ff8800,color:#fff
style azurerm_role_assignment_app_contributor fill:#ff4444,color:#fff