Threat Modeling
AegisShield’s core threat modeling engine leverages GPT-4o to generate comprehensive STRIDE-based threat models tailored to your application. The system combines AI-powered analysis with real-time threat intelligence from multiple sources.Overview
The threat modeling module (threat_model.py) provides three primary capabilities:
Threat Generation
AI-powered STRIDE threat identification
Image Analysis
Architecture diagram analysis using vision models
Prompt Engineering
Sophisticated prompts for 20+ years of expertise
STRIDE Methodology
AegisShield implements the STRIDE threat modeling framework:- Spoofing - Identity impersonation attacks
- Tampering - Data or code modification
- Repudiation - Denial of actions performed
- Information Disclosure - Unauthorized data access
- Denial of Service - Service disruption
- Elevation of Privilege - Unauthorized access elevation
The system generates 3 threats per STRIDE category (18 total) by default, ensuring comprehensive coverage across all threat types.
Core Functions
get_threat_model()
Generates a complete threat model using OpenAI’s API.OpenAI API key for authentication
OpenAI model to use (typically “gpt-4o”)
Formatted threat modeling prompt
dict[str, Any] - JSON object containing:
threat_model: Array of identified threatsimprovement_suggestions: Recommendations for better descriptions
threat_model.py
create_threat_model_prompt()
Creates a comprehensive prompt incorporating application details and threat intelligence.Application type (e.g., “Web application”)
Authentication methods used
Whether application is internet-facing
Industry sector (e.g., “Finance”)
Types of sensitive data handled
Detailed application description
NVD CVE data for technology stack
AlienVault OTX threat intelligence
User’s technical level (Low/Medium/High)
Example usage
get_image_analysis()
Analyzes architecture diagrams using GPT-4 Vision.OpenAI API key
Vision model (e.g., “gpt-4o”)
Analysis prompt
Base64-encoded image data
Image analysis example
Threat Model Structure
Each threat in the model includes:Threat structure
Understanding Assumptions
Understanding Assumptions
Assumptions document the conditions that must be true for a threat to be realized:
- Assumption: What must be true
- Role: Who is responsible (Developer, Admin, User)
- Condition: When it applies
Error Handling
The module implements robust error handling:Retry logic from threat_model.py
Output Format
The threat model is converted to Markdown for display:json_to_markdown() usage
| Threat Type | Scenario | Potential Impact | Assumptions |
|---|---|---|---|
| Spoofing | An attacker could… | Unauthorized access… | - Assumption 1 (Role, Condition) |
Best Practices
Detailed Descriptions
Provide comprehensive application descriptions with architecture details, data flows, and authentication mechanisms for better threat identification.
Include Context
Upload architecture diagrams when available - visual analysis enhances threat detection accuracy.
Specify Tech Stack
Accurate technology selection enables CVE-specific threat identification from NVD.
Review Assumptions
Validate assumptions against your actual environment to prioritize relevant threats.
Integration
The threat model feeds into downstream processes:Related Functions
- process_mitre_attack_data() - Maps threats to techniques
- get_mitigations() - Generates mitigation strategies
- get_dread_assessment() - Produces risk scores
- get_test_cases() - Creates security test cases