7-Step Threat Modeling Process
AegisShield guides you through a comprehensive 7-step process to create professional threat models. Each step builds on the previous one, culminating in a complete PDF report.Overview
The workflow is implemented inmain.py with seven tabs, each handling a specific phase of threat modeling.
main.py:123-131
Complete Workflow
Step 1: Application Description
Purpose: Describe your application or upload an architecture diagram.Implementation:
tabs/step1_description.pyInputs:- Application description (manual text input)
- Architecture diagram (optional upload)
- Application type (21 options)
- Industry sector (32 options)
- Authentication methods
- Internet facing (Yes/No)
- Sensitive data classification
- Technical ability (Low/Medium/High)
app_input- Application descriptionapp_type- Selected application typeindustry_sector- Selected industryauthentication- Auth methodsinternet_facing- Exposure levelsensitive_data- Data classification
Example from step1_description.py
Step 2: Technology Selection
Purpose: Select the technology stack to enable vulnerability scanning.Implementation: Outputs:
tabs/step2_technology.pyInputs:- Databases (8 options with versions)
- Operating systems (13 options with versions)
- Programming languages (11 options with versions)
- Web frameworks (8 options with versions)
From step2_technology.py:50-72
- CPE names for NVD searches
- Technology versions for precise CVE matching
Accurate version selection is critical. AegisShield uses CPE (Common Platform Enumeration) identifiers to match exact versions against the NVD database.
Step 3: Generate Threat Model
Purpose: Generate STRIDE-based threats integrated with MITRE ATT&CK.Implementation:
tabs/step3_threat_model.pyProcess:- Search NVD for vulnerabilities in selected technologies
- Fetch AlienVault OTX threat intelligence for industry
- Create comprehensive threat modeling prompt
- Call GPT-4o to generate threats (3 per STRIDE category)
- Load MITRE ATT&CK STIX data
- Map threats to specific ATT&CK techniques
- 18 STRIDE threats with scenarios, impacts, and assumptions
- MITRE ATT&CK technique mappings (Technique IDs)
- NVD CVE data for technology stack
- AlienVault OTX pulse data
- Improvement suggestions for better threat models
| Threat Type | Scenario | Potential Impact | MITRE Technique |
|---|---|---|---|
| Spoofing | Attacker creates fake OAuth2 provider | Unauthorized access to user accounts | T1566 (Phishing) |
| Tampering | SQL injection via search parameter | Database modification, data theft | T1190 (Exploit Public-Facing Application) |
Step 4: Generate Mitigations
Purpose: Create mitigation strategies for each identified threat.Implementation:
Example from step4_mitigations.py:
tabs/step4_mitigations.pyProcess:- Format threat model with MITRE mappings and NVD CVEs
- Create mitigation prompt
- Call GPT-4o to generate specific mitigations
| Threat Type | Scenario | Suggested Mitigation(s) |
|---|---|---|
| Spoofing | Fake OAuth2 provider | Implement OAuth2 provider allowlist, Use HTTPS for all OAuth flows, Validate redirect URIs against whitelist |
Step 5: DREAD Risk Assessment
Purpose: Assign quantitative risk scores to prioritize threats.Implementation:
tabs/step5_dread_assessment.pyProcess:- Create DREAD assessment prompt with threats, MITRE, and NVD data
- Call GPT-4o to score each threat on 5 dimensions (1-10 scale)
- Calculate average risk score
- Display sorted by risk score
- Damage Potential (1-10)
- Reproducibility (1-10)
- Exploitability (1-10)
- Affected Users (1-10)
- Discoverability (1-10)
| Threat | Damage | Reprod. | Exploit. | Users | Discov. | Risk Score |
|---|---|---|---|---|---|---|
| SQL Injection | 9 | 8 | 7 | 10 | 9 | 8.60 |
| OAuth Spoofing | 8 | 6 | 5 | 9 | 7 | 7.00 |
Session State Management
AegisShield tracks progress using Streamlit session state:main.py:38-42
app_input- Application descriptionthreat_model- Generated threatsmitre_techniques- ATT&CK mappingsdread_assessment- Risk scorestest_cases- Gherkin testsattack_tree- Mermaid diagram
Error Handling
Each step has centralized error handling:From main.py:92-109
Time Estimates
Typical completion times:| Step | Time | Notes |
|---|---|---|
| Step 1 | 2-5 min | Longer with image analysis |
| Step 2 | 1-2 min | Technology selection |
| Step 3 | 2-5 min | Multiple API calls (NVD, OTX, OpenAI, MITRE) |
| Step 4 | 1-2 min | Single OpenAI call |
| Step 5 | 1-2 min | Single OpenAI call |
| Step 6 | 1-2 min | Single OpenAI call |
| Step 7 | 1-2 min | PDF generation |
| Total | 10-20 min | For complete threat model |
Best Practices
Complete Steps in Order
Each step depends on data from previous steps. Don’t skip ahead.
Save Incrementally
Download intermediate outputs (threat model, test cases) as you go. Don’t wait until the end.
Detailed Descriptions
More detail in Step 1 leads to more accurate threats. Include architecture, data flows, and security controls.
Accurate Technology
Precise version selection in Step 2 enables accurate CVE identification.
Troubleshooting
Session State Lost
Session State Lost
Symptom: Data from previous steps disappears.Cause: Browser refresh or Streamlit reconnection.Solution: Don’t refresh the browser. If you must, restart from Step 1.
API Rate Limits
API Rate Limits
Symptom: “Rate limit exceeded” errors.Cause: Too many API calls too quickly.Solution: Wait 60 seconds and retry. Consider upgrading OpenAI API tier for higher limits.
Incomplete Threat Model
Incomplete Threat Model
Symptom: Fewer than 18 threats generated.Cause: Insufficient application description or API timeout.Solution: Provide more detail in Step 1. Retry Step 3.
Related Guides
- Application Description - Tips for effective descriptions
- Technology Selection - Choosing the right technologies
- Interpreting Results - Understanding threat model output
- PDF Reports - Customizing report generation