Vulnerability Scanner
Think like an attacker, defend like an expert. 2025 threat landscape awareness.
🔧 Runtime Scripts
Execute for automated validation:
| Script |
Purpose |
Usage |
scripts/security_scan.py |
Validate security principles applied |
python scripts/security_scan.py <project_path> |
📋 Reference Files
| File |
Purpose |
| checklists.md |
OWASP Top 10, Auth, API, Data protection checklists |
1. Security Expert Mindset
Core Principles
| Principle |
Application |
| Assume Breach |
Design as if attacker already inside |
| Zero Trust |
Never trust, always verify |
| Defense in Depth |
Multiple layers, no single point |
| Least Privilege |
Minimum required access only |
| Fail Secure |
On error, deny access |
Threat Modeling Questions
Before scanning, ask:
- What are we protecting? (Assets)
- Who would attack? (Threat actors)
- How would they attack? (Attack vectors)
- What's the impact? (Business risk)
2. OWASP Top 10:2025/2026
Risk Categories
| Rank |
Category |
Think About |
| A01 |
Broken Access Control |
Who can access what? IDOR, SSRF |
| A02 |
Security Misconfiguration |
Defaults, headers, exposed services |
| A03 |
Software Supply Chain 🆕 |
Dependencies, CI/CD, build integrity |
| A04 |
Cryptographic Failures |
Weak crypto, exposed secrets |
| A05 |
Injection |
User input → system commands |
| A06 |
Insecure Design |
Flawed architecture |
| A07 |
Authentication Failures |
Session, credential management |
| A08 |
Integrity Failures |
Unsigned updates, tampered data |
| A09 |
Logging & Alerting |
Blind spots, no monitoring |
| A10 |
Exceptional Conditions 🆕 |
Error handling, fail-open states |
2025/2026 Key Changes
2021 → 2025/2026 Shifts:
├── SSRF merged into A01 (Access Control)
├── A02 elevated (Cloud/Container configs)
├── A03 NEW: Supply Chain (major focus)
├── A10 NEW: Exceptional Conditions
└── Agentic Shift: OWASP Agentic Top 10 (ASI04) addresses prompt & tool supply chains
3. Supply Chain Security (A03)
Attack Surface
| Vector |
Risk |
Question to Ask |
| Dependencies |
Malicious packages |
Do we audit new deps? |
| Lock files |
Integrity attacks |
Are they committed? |
| Build pipeline |
CI/CD compromise |
Who can modify? |
| Registry |
Typosquatting / Poisoning |
Verified sources? |
| Cooldown Period |
Zero-day package uploads |
Do we use exclude-newer? |
Defense Principles
- Verify package integrity (checksums/hashes in
uv.lock)
- Enforce dependency cooldowns (use
exclude-newer in pyproject.toml) to delay using brand new package releases until community vetted
- Pin exact versions in lock files, audit updates with automated tools (e.g.
pip-audit)
- Sign and verify artifacts
4. Agentic Supply Chain (ASI04:2026)
Attack Surface
| Vector |
Risk |
Question to Ask |
| Prompt Templates |
Dynamic prompt injection |
Are templates sanitized? |
| Tool Definitions |
Executing malicious tools |
Are tools pinned and verified? |
| MCP Servers |
Rogue servers stealing data |
Is MCP transport secure/auth'd? |
| API Boundaries |
Data leakage to external LLMs |
Are payloads size-bounded? |
Defense Principles
- Enforce zero-trust on dynamic inputs injected into prompts
- Validate and authenticate all Model Context Protocol (MCP) server endpoints
- Prevent dynamic import or execution of tool code supplied by untrusted APIs
- Strictly separate system prompt instructions from user-provided content
5. Attack Surface Mapping
What to Map
| Category |
Elements |
| Entry Points |
APIs, forms, file uploads |
| Data Flows |
Input → Process → Output |
| Trust Boundaries |
Where auth/authz checked |
| Assets |
Secrets, PII, business data |
Prioritization Matrix
Risk = Likelihood × Impact
High Impact + High Likelihood → CRITICAL
High Impact + Low Likelihood → HIGH
Low Impact + High Likelihood → MEDIUM
Low Impact + Low Likelihood → LOW
6. Risk Prioritization
CVSS + Context
| Factor |
Weight |
Question |
| CVSS Score |
Base severity |
How severe is the vuln? |
| EPSS Score |
Exploit likelihood |
Is it being exploited? |
| Asset Value |
Business context |
What's at risk? |
| Exposure |
Attack surface |
Internet-facing? |
Prioritization Decision Tree
Is it actively exploited (EPSS >0.5)?
├── YES → CRITICAL: Immediate action
└── NO → Check CVSS
├── CVSS ≥9.0 → HIGH
├── CVSS 7.0-8.9 → Consider asset value
└── CVSS <7.0 → Schedule for later
7. Exceptional Conditions (A10 - New)
Fail-Open vs Fail-Closed
| Scenario |
Fail-Open (BAD) |
Fail-Closed (GOOD) |
| Auth error |
Allow access |
Deny access |
| Parsing fails |
Accept input |
Reject input |
| Timeout |
Retry forever |
Limit + abort |
What to Check
- Exception handlers that catch-all and ignore
- Missing error handling on security operations
- Race conditions in auth/authz
- Resource exhaustion scenarios
8. Scanning Methodology
Phase-Based Approach
1. RECONNAISSANCE
└── Understand the target
├── Technology stack
├── Entry points
└── Data flows
2. DISCOVERY
└── Identify potential issues
├── Configuration review
├── Dependency analysis
└── Code pattern search
3. ANALYSIS
└── Validate and prioritize
├── False positive elimination
├── Risk scoring
└── Attack chain mapping
4. REPORTING
└── Actionable findings
├── Clear reproduction steps
├── Business impact
└── Remediation guidance
9. Code Pattern Analysis
High-Risk Patterns
| Pattern |
Risk |
Look For |
| String concat in queries |
Injection |
"SELECT * FROM " + user_input |
| Dynamic code execution |
RCE |
eval(), exec(), Function() |
| Unsafe deserialization |
RCE |
pickle.loads(), unserialize() |
| Path manipulation |
Traversal |
User input in file paths |
| Disabled security |
Various |
verify=False, --insecure |
Secret Patterns
| Type |
Indicators |
| API Keys |
api_key, apikey, high entropy |
| Tokens |
token, bearer, jwt |
| Credentials |
password, secret, key |
| Cloud |
AWS_, AZURE_, GCP_ prefixes |
10. Cloud Security Considerations
Shared Responsibility
| Layer |
You Own |
Provider Owns |
| Data |
✅ |
❌ |
| Application |
✅ |
❌ |
| OS/Runtime |
Depends |
Depends |
| Infrastructure |
❌ |
✅ |
Cloud-Specific Checks
- IAM: Least privilege applied?
- Storage: Public buckets?
- Network: Security groups tightened?
- Secrets: Using secrets manager?
11. Anti-Patterns
| ❌ Don't |
✅ Do |
| Scan without understanding |
Map attack surface first |
| Alert on every CVE |
Prioritize by exploitability + asset |
| Ignore false positives |
Maintain verified baseline |
| Fix symptoms only |
Address root causes |
| Scan once before deploy |
Continuous scanning |
| Trust third-party deps blindly |
Verify integrity, audit code |
12. Reporting Principles
Finding Structure
Each finding should answer:
- What? - Clear vulnerability description
- Where? - Exact location (file, line, endpoint)
- Why? - Root cause explanation
- Impact? - Business consequence
- How to fix? - Specific remediation
Severity Classification
| Severity |
Criteria |
| Critical |
RCE, auth bypass, mass data exposure |
| High |
Data exposure, privilege escalation |
| Medium |
Limited scope, requires conditions |
| Low |
Informational, best practice |
Remember: Vulnerability scanning finds issues. Expert thinking prioritizes what matters. Always ask: "What would an attacker do with this?"
Source: threatpatrols/hibp-downloader — distributed by TomeVault.
1---2name: vulnerability-scanner3description: Advanced vulnerability analysis principles. OWASP 2025, Supply Chain Security, attack surface mapping, risk prioritization. Use when this capability is needed.4---56# Vulnerability Scanner78> Think like an attacker, defend like an expert. 2025 threat landscape awareness.910## 🔧 Runtime Scripts1112**Execute for automated validation:**1314| Script | Purpose | Usage |15|--------|---------|-------|16| `scripts/security_scan.py` | Validate security principles applied | `python scripts/security_scan.py <project_path>` |1718## 📋 Reference Files1920| File | Purpose |21|------|---------|22| [checklists.md](checklists.md) | OWASP Top 10, Auth, API, Data protection checklists |2324---2526## 1. Security Expert Mindset2728### Core Principles2930| Principle | Application |31|-----------|-------------|32| **Assume Breach** | Design as if attacker already inside |33| **Zero Trust** | Never trust, always verify |34| **Defense in Depth** | Multiple layers, no single point |35| **Least Privilege** | Minimum required access only |36| **Fail Secure** | On error, deny access |3738### Threat Modeling Questions3940Before scanning, ask:411. What are we protecting? (Assets)422. Who would attack? (Threat actors)433. How would they attack? (Attack vectors)444. What's the impact? (Business risk)4546---4748## 2. OWASP Top 10:2025/20264950### Risk Categories5152| Rank | Category | Think About |53|------|----------|-------------|54| **A01** | Broken Access Control | Who can access what? IDOR, SSRF |55| **A02** | Security Misconfiguration | Defaults, headers, exposed services |56| **A03** | Software Supply Chain 🆕 | Dependencies, CI/CD, build integrity |57| **A04** | Cryptographic Failures | Weak crypto, exposed secrets |58| **A05** | Injection | User input → system commands |59| **A06** | Insecure Design | Flawed architecture |60| **A07** | Authentication Failures | Session, credential management |61| **A08** | Integrity Failures | Unsigned updates, tampered data |62| **A09** | Logging & Alerting | Blind spots, no monitoring |63| **A10** | Exceptional Conditions 🆕 | Error handling, fail-open states |6465### 2025/2026 Key Changes6667```682021 → 2025/2026 Shifts:69├── SSRF merged into A01 (Access Control)70├── A02 elevated (Cloud/Container configs)71├── A03 NEW: Supply Chain (major focus)72├── A10 NEW: Exceptional Conditions73└── Agentic Shift: OWASP Agentic Top 10 (ASI04) addresses prompt & tool supply chains74```7576---7778## 3. Supply Chain Security (A03)7980### Attack Surface8182| Vector | Risk | Question to Ask |83|--------|------|-----------------|84| **Dependencies** | Malicious packages | Do we audit new deps? |85| **Lock files** | Integrity attacks | Are they committed? |86| **Build pipeline** | CI/CD compromise | Who can modify? |87| **Registry** | Typosquatting / Poisoning | Verified sources? |88| **Cooldown Period** | Zero-day package uploads | Do we use `exclude-newer`? |8990### Defense Principles9192- Verify package integrity (checksums/hashes in `uv.lock`)93- Enforce dependency cooldowns (use `exclude-newer` in `pyproject.toml`) to delay using brand new package releases until community vetted94- Pin exact versions in lock files, audit updates with automated tools (e.g. `pip-audit`)95- Sign and verify artifacts9697---9899## 4. Agentic Supply Chain (ASI04:2026)100101### Attack Surface102103| Vector | Risk | Question to Ask |104|--------|------|-----------------|105| **Prompt Templates** | Dynamic prompt injection | Are templates sanitized? |106| **Tool Definitions** | Executing malicious tools | Are tools pinned and verified? |107| **MCP Servers** | Rogue servers stealing data | Is MCP transport secure/auth'd? |108| **API Boundaries** | Data leakage to external LLMs | Are payloads size-bounded? |109110### Defense Principles111112- Enforce zero-trust on dynamic inputs injected into prompts113- Validate and authenticate all Model Context Protocol (MCP) server endpoints114- Prevent dynamic import or execution of tool code supplied by untrusted APIs115- Strictly separate system prompt instructions from user-provided content116117---118119120## 5. Attack Surface Mapping121122### What to Map123124| Category | Elements |125|----------|----------|126| **Entry Points** | APIs, forms, file uploads |127| **Data Flows** | Input → Process → Output |128| **Trust Boundaries** | Where auth/authz checked |129| **Assets** | Secrets, PII, business data |130131### Prioritization Matrix132133```134Risk = Likelihood × Impact135136High Impact + High Likelihood → CRITICAL137High Impact + Low Likelihood → HIGH138Low Impact + High Likelihood → MEDIUM139Low Impact + Low Likelihood → LOW140```141142---143144## 6. Risk Prioritization145146### CVSS + Context147148| Factor | Weight | Question |149|--------|--------|----------|150| **CVSS Score** | Base severity | How severe is the vuln? |151| **EPSS Score** | Exploit likelihood | Is it being exploited? |152| **Asset Value** | Business context | What's at risk? |153| **Exposure** | Attack surface | Internet-facing? |154155### Prioritization Decision Tree156157```158Is it actively exploited (EPSS >0.5)?159├── YES → CRITICAL: Immediate action160└── NO → Check CVSS161 ├── CVSS ≥9.0 → HIGH162 ├── CVSS 7.0-8.9 → Consider asset value163 └── CVSS <7.0 → Schedule for later164```165166---167168## 7. Exceptional Conditions (A10 - New)169170### Fail-Open vs Fail-Closed171172| Scenario | Fail-Open (BAD) | Fail-Closed (GOOD) |173|----------|-----------------|---------------------|174| Auth error | Allow access | Deny access |175| Parsing fails | Accept input | Reject input |176| Timeout | Retry forever | Limit + abort |177178### What to Check179180- Exception handlers that catch-all and ignore181- Missing error handling on security operations182- Race conditions in auth/authz183- Resource exhaustion scenarios184185---186187## 8. Scanning Methodology188189### Phase-Based Approach190191```1921. RECONNAISSANCE193 └── Understand the target194 ├── Technology stack195 ├── Entry points196 └── Data flows1971982. DISCOVERY199 └── Identify potential issues200 ├── Configuration review201 ├── Dependency analysis202 └── Code pattern search2032043. ANALYSIS205 └── Validate and prioritize206 ├── False positive elimination207 ├── Risk scoring208 └── Attack chain mapping2092104. REPORTING211 └── Actionable findings212 ├── Clear reproduction steps213 ├── Business impact214 └── Remediation guidance215```216217---218219## 9. Code Pattern Analysis220221### High-Risk Patterns222223| Pattern | Risk | Look For |224|---------|------|----------|225| **String concat in queries** | Injection | `"SELECT * FROM " + user_input` |226| **Dynamic code execution** | RCE | `eval()`, `exec()`, `Function()` |227| **Unsafe deserialization** | RCE | `pickle.loads()`, `unserialize()` |228| **Path manipulation** | Traversal | User input in file paths |229| **Disabled security** | Various | `verify=False`, `--insecure` |230231### Secret Patterns232233| Type | Indicators |234|------|-----------|235| API Keys | `api_key`, `apikey`, high entropy |236| Tokens | `token`, `bearer`, `jwt` |237| Credentials | `password`, `secret`, `key` |238| Cloud | `AWS_`, `AZURE_`, `GCP_` prefixes |239240---241242## 10. Cloud Security Considerations243244### Shared Responsibility245246| Layer | You Own | Provider Owns |247|-------|---------|---------------|248| Data | ✅ | ❌ |249| Application | ✅ | ❌ |250| OS/Runtime | Depends | Depends |251| Infrastructure | ❌ | ✅ |252253### Cloud-Specific Checks254255- IAM: Least privilege applied?256- Storage: Public buckets?257- Network: Security groups tightened?258- Secrets: Using secrets manager?259260---261262## 11. Anti-Patterns263264| ❌ Don't | ✅ Do |265|----------|-------|266| Scan without understanding | Map attack surface first |267| Alert on every CVE | Prioritize by exploitability + asset |268| Ignore false positives | Maintain verified baseline |269| Fix symptoms only | Address root causes |270| Scan once before deploy | Continuous scanning |271| Trust third-party deps blindly | Verify integrity, audit code |272273---274275## 12. Reporting Principles276277### Finding Structure278279Each finding should answer:2801. **What?** - Clear vulnerability description2812. **Where?** - Exact location (file, line, endpoint)2823. **Why?** - Root cause explanation2834. **Impact?** - Business consequence2845. **How to fix?** - Specific remediation285286### Severity Classification287288| Severity | Criteria |289|----------|----------|290| **Critical** | RCE, auth bypass, mass data exposure |291| **High** | Data exposure, privilege escalation |292| **Medium** | Limited scope, requires conditions |293| **Low** | Informational, best practice |294295---296297> **Remember:** Vulnerability scanning finds issues. Expert thinking prioritizes what matters. Always ask: "What would an attacker do with this?"298299---300> Source: [threatpatrols/hibp-downloader](https://github.com/threatpatrols/hibp-downloader) — distributed by [TomeVault](https://tomevault.io).301<!-- tomevault:4.0:skill_md:2026-06-17 -->