mirror of
https://github.com/BagelHole/DevOps-Security-Agent-Skills.git
synced 2026-08-22 12:49:53 +02:00
.
This commit is contained in:
@@ -0,0 +1,96 @@
|
||||
---
|
||||
name: threat-modeling
|
||||
description: Conduct threat modeling using STRIDE methodology. Identify threats, assess risks, and design security controls. Use when designing secure systems or assessing application security.
|
||||
license: MIT
|
||||
metadata:
|
||||
author: devops-skills
|
||||
version: "1.0"
|
||||
---
|
||||
|
||||
# Threat Modeling
|
||||
|
||||
Identify and mitigate security threats during system design.
|
||||
|
||||
## STRIDE Methodology
|
||||
|
||||
| Threat | Description | Mitigation |
|
||||
|--------|-------------|------------|
|
||||
| **S**poofing | Pretending to be someone else | Authentication |
|
||||
| **T**ampering | Modifying data | Integrity controls |
|
||||
| **R**epudiation | Denying actions | Audit logging |
|
||||
| **I**nformation Disclosure | Data exposure | Encryption |
|
||||
| **D**enial of Service | Making service unavailable | Rate limiting |
|
||||
| **E**levation of Privilege | Gaining higher access | Authorization |
|
||||
|
||||
## Process
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
1_scope:
|
||||
- Define system boundaries
|
||||
- Identify assets
|
||||
- Document data flows
|
||||
|
||||
2_diagram:
|
||||
- Create data flow diagrams
|
||||
- Identify trust boundaries
|
||||
- Mark entry points
|
||||
|
||||
3_identify:
|
||||
- Apply STRIDE to each component
|
||||
- List potential threats
|
||||
- Document attack vectors
|
||||
|
||||
4_assess:
|
||||
- Rate likelihood and impact
|
||||
- Prioritize by risk score
|
||||
|
||||
5_mitigate:
|
||||
- Design countermeasures
|
||||
- Accept/transfer risks
|
||||
- Document decisions
|
||||
```
|
||||
|
||||
## Data Flow Diagram
|
||||
|
||||
```
|
||||
[External User] --> |HTTPS| --> [Load Balancer]
|
||||
|
|
||||
v
|
||||
[Web Server]
|
||||
|
|
||||
[Trust Boundary]
|
||||
|
|
||||
v
|
||||
[App Server] --> [Database]
|
||||
```
|
||||
|
||||
## Threat Cards
|
||||
|
||||
```yaml
|
||||
threat:
|
||||
id: T001
|
||||
name: SQL Injection
|
||||
category: Tampering
|
||||
component: Database queries
|
||||
likelihood: High
|
||||
impact: Critical
|
||||
mitigations:
|
||||
- Parameterized queries
|
||||
- Input validation
|
||||
- WAF rules
|
||||
status: Mitigated
|
||||
```
|
||||
|
||||
## Best Practices
|
||||
|
||||
- Integrate into SDLC
|
||||
- Review on architecture changes
|
||||
- Include development team
|
||||
- Document all decisions
|
||||
- Regular reassessment
|
||||
|
||||
## Related Skills
|
||||
|
||||
- [sast-scanning](../../scanning/sast-scanning/) - Code analysis
|
||||
- [penetration-testing](../penetration-testing/) - Validation
|
||||
@@ -0,0 +1,100 @@
|
||||
# Threat Modeling Template
|
||||
|
||||
## 1. System Overview
|
||||
|
||||
### Description
|
||||
[Brief description of the system being modeled]
|
||||
|
||||
### Architecture Diagram
|
||||
```
|
||||
[ASCII diagram or link to diagram]
|
||||
|
||||
+--------+ +--------+ +--------+
|
||||
| Client | --> | API | --> | DB |
|
||||
+--------+ +--------+ +--------+
|
||||
```
|
||||
|
||||
### Components
|
||||
| Component | Description | Technology |
|
||||
|-----------|-------------|------------|
|
||||
| Frontend | Web UI | React |
|
||||
| API | REST API | Node.js |
|
||||
| Database | Data storage | PostgreSQL |
|
||||
|
||||
### Data Flows
|
||||
| # | From | To | Data | Protocol |
|
||||
|---|------|----|----- |----------|
|
||||
| 1 | Client | API | User requests | HTTPS |
|
||||
| 2 | API | DB | Queries | TCP/TLS |
|
||||
|
||||
## 2. Trust Boundaries
|
||||
|
||||
```
|
||||
INTERNET
|
||||
|
|
||||
================|================ Trust Boundary 1
|
||||
|
|
||||
[ WAF/LB ]
|
||||
|
|
||||
================|================ Trust Boundary 2
|
||||
|
|
||||
[ API Server ]
|
||||
|
|
||||
================|================ Trust Boundary 3
|
||||
|
|
||||
[ Database ]
|
||||
```
|
||||
|
||||
## 3. Threat Identification (STRIDE)
|
||||
|
||||
### Spoofing
|
||||
| ID | Threat | Component | Mitigation |
|
||||
|----|--------|-----------|------------|
|
||||
| S1 | Session hijacking | API | Use secure cookies, short TTL |
|
||||
| S2 | API impersonation | Client | Certificate pinning |
|
||||
|
||||
### Tampering
|
||||
| ID | Threat | Component | Mitigation |
|
||||
|----|--------|-----------|------------|
|
||||
| T1 | Request modification | API | Input validation, signing |
|
||||
| T2 | Data modification | DB | Access controls, audit logs |
|
||||
|
||||
### Repudiation
|
||||
| ID | Threat | Component | Mitigation |
|
||||
|----|--------|-----------|------------|
|
||||
| R1 | Action denial | API | Comprehensive logging |
|
||||
|
||||
### Information Disclosure
|
||||
| ID | Threat | Component | Mitigation |
|
||||
|----|--------|-----------|------------|
|
||||
| I1 | Data leak | API | Encryption, access controls |
|
||||
| I2 | Error messages | All | Generic error responses |
|
||||
|
||||
### Denial of Service
|
||||
| ID | Threat | Component | Mitigation |
|
||||
|----|--------|-----------|------------|
|
||||
| D1 | Resource exhaustion | API | Rate limiting, auto-scaling |
|
||||
|
||||
### Elevation of Privilege
|
||||
| ID | Threat | Component | Mitigation |
|
||||
|----|--------|-----------|------------|
|
||||
| E1 | IDOR | API | Authorization checks |
|
||||
| E2 | SQL injection | DB | Parameterized queries |
|
||||
|
||||
## 4. Risk Assessment
|
||||
|
||||
| Threat ID | Likelihood | Impact | Risk | Priority |
|
||||
|-----------|------------|--------|------|----------|
|
||||
| S1 | Medium | High | High | P1 |
|
||||
| E2 | Low | Critical | High | P1 |
|
||||
|
||||
## 5. Mitigations
|
||||
|
||||
| Threat ID | Mitigation | Status | Owner |
|
||||
|-----------|------------|--------|-------|
|
||||
| S1 | Implement secure session management | In Progress | Auth Team |
|
||||
| E2 | Use ORM with parameterized queries | Done | Backend Team |
|
||||
|
||||
## 6. Residual Risks
|
||||
|
||||
[List any accepted risks with justification]
|
||||
Reference in New Issue
Block a user