Vulnerability Scanner
💡 MCP Tool Available: Use Context7, Tavily, BraveSearch, or Serper.dev first; only if those fail, use WebSearch or WebFetch as needed.
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
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 Key Changes
2021 → 2025 Shifts:
├── SSRF merged into A01 (Access Control)
├── A02 elevated (Cloud/Container configs)
├── A03 NEW: Supply Chain (major focus)
├── A10 NEW: Exceptional Conditions
└── Focus shift: Root causes > Symptoms
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 |
Verified sources? |
Defense Principles
- Verify package integrity (checksums)
- Pin versions, audit updates
- Use private registries for critical deps
- Sign and verify artifacts
4. 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
5. 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
6. 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
7. 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
8. 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 |
9. 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?
10. 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 |
11. 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?"
1---2name: vulnerability-scanner3description: Advanced vulnerability analysis principles. OWASP 2025, Supply Chain Security, attack surface mapping, risk prioritization.4---56# Vulnerability Scanner78> **💡 MCP Tool Available**: Use **Context7**, **Tavily**, **BraveSearch**, or **Serper.dev** first; only if those fail, use **WebSearch** or **WebFetch** as needed.910> Think like an attacker, defend like an expert. 2025 threat landscape awareness.1112## 🔧 Runtime Scripts1314**Execute for automated validation:**1516| Script | Purpose | Usage |17|--------|---------|-------|18| `scripts/security_scan.py` | Validate security principles applied | `python scripts/security_scan.py <project_path>` |1920## 📋 Reference Files2122| File | Purpose |23|------|---------|24| [checklists.md](checklists.md) | OWASP Top 10, Auth, API, Data protection checklists |2526---2728## 1. Security Expert Mindset2930### Core Principles3132| Principle | Application |33|-----------|-------------|34| **Assume Breach** | Design as if attacker already inside |35| **Zero Trust** | Never trust, always verify |36| **Defense in Depth** | Multiple layers, no single point |37| **Least Privilege** | Minimum required access only |38| **Fail Secure** | On error, deny access |3940### Threat Modeling Questions4142Before scanning, ask:431. What are we protecting? (Assets)442. Who would attack? (Threat actors)453. How would they attack? (Attack vectors)464. What's the impact? (Business risk)4748---4950## 2. OWASP Top 10:20255152### Risk Categories5354| Rank | Category | Think About |55|------|----------|-------------|56| **A01** | Broken Access Control | Who can access what? IDOR, SSRF |57| **A02** | Security Misconfiguration | Defaults, headers, exposed services |58| **A03** | Software Supply Chain 🆕 | Dependencies, CI/CD, build integrity |59| **A04** | Cryptographic Failures | Weak crypto, exposed secrets |60| **A05** | Injection | User input → system commands |61| **A06** | Insecure Design | Flawed architecture |62| **A07** | Authentication Failures | Session, credential management |63| **A08** | Integrity Failures | Unsigned updates, tampered data |64| **A09** | Logging & Alerting | Blind spots, no monitoring |65| **A10** | Exceptional Conditions 🆕 | Error handling, fail-open states |6667### 2025 Key Changes6869```702021 → 2025 Shifts:71├── SSRF merged into A01 (Access Control)72├── A02 elevated (Cloud/Container configs)73├── A03 NEW: Supply Chain (major focus)74├── A10 NEW: Exceptional Conditions75└── Focus shift: Root causes > Symptoms76```7778---7980## 3. Supply Chain Security (A03)8182### Attack Surface8384| Vector | Risk | Question to Ask |85|--------|------|-----------------|86| **Dependencies** | Malicious packages | Do we audit new deps? |87| **Lock files** | Integrity attacks | Are they committed? |88| **Build pipeline** | CI/CD compromise | Who can modify? |89| **Registry** | Typosquatting | Verified sources? |9091### Defense Principles9293- Verify package integrity (checksums)94- Pin versions, audit updates95- Use private registries for critical deps96- Sign and verify artifacts9798---99100## 4. Attack Surface Mapping101102### What to Map103104| Category | Elements |105|----------|----------|106| **Entry Points** | APIs, forms, file uploads |107| **Data Flows** | Input → Process → Output |108| **Trust Boundaries** | Where auth/authz checked |109| **Assets** | Secrets, PII, business data |110111### Prioritization Matrix112113```114Risk = Likelihood × Impact115116High Impact + High Likelihood → CRITICAL117High Impact + Low Likelihood → HIGH118Low Impact + High Likelihood → MEDIUM119Low Impact + Low Likelihood → LOW120```121122---123124## 5. Risk Prioritization125126### CVSS + Context127128| Factor | Weight | Question |129|--------|--------|----------|130| **CVSS Score** | Base severity | How severe is the vuln? |131| **EPSS Score** | Exploit likelihood | Is it being exploited? |132| **Asset Value** | Business context | What's at risk? |133| **Exposure** | Attack surface | Internet-facing? |134135### Prioritization Decision Tree136137```138Is it actively exploited (EPSS >0.5)?139├── YES → CRITICAL: Immediate action140└── NO → Check CVSS141 ├── CVSS ≥9.0 → HIGH142 ├── CVSS 7.0-8.9 → Consider asset value143 └── CVSS <7.0 → Schedule for later144```145146---147148## 6. Exceptional Conditions (A10 - New)149150### Fail-Open vs Fail-Closed151152| Scenario | Fail-Open (BAD) | Fail-Closed (GOOD) |153|----------|-----------------|---------------------|154| Auth error | Allow access | Deny access |155| Parsing fails | Accept input | Reject input |156| Timeout | Retry forever | Limit + abort |157158### What to Check159160- Exception handlers that catch-all and ignore161- Missing error handling on security operations162- Race conditions in auth/authz163- Resource exhaustion scenarios164165---166167## 7. Scanning Methodology168169### Phase-Based Approach170171```1721. RECONNAISSANCE173 └── Understand the target174 ├── Technology stack175 ├── Entry points176 └── Data flows1771782. DISCOVERY179 └── Identify potential issues180 ├── Configuration review181 ├── Dependency analysis182 └── Code pattern search1831843. ANALYSIS185 └── Validate and prioritize186 ├── False positive elimination187 ├── Risk scoring188 └── Attack chain mapping1891904. REPORTING191 └── Actionable findings192 ├── Clear reproduction steps193 ├── Business impact194 └── Remediation guidance195```196197---198199## 8. Code Pattern Analysis200201### High-Risk Patterns202203| Pattern | Risk | Look For |204|---------|------|----------|205| **String concat in queries** | Injection | `"SELECT * FROM " + user_input` |206| **Dynamic code execution** | RCE | `eval()`, `exec()`, `Function()` |207| **Unsafe deserialization** | RCE | `pickle.loads()`, `unserialize()` |208| **Path manipulation** | Traversal | User input in file paths |209| **Disabled security** | Various | `verify=False`, `--insecure` |210211### Secret Patterns212213| Type | Indicators |214|------|-----------|215| API Keys | `api_key`, `apikey`, high entropy |216| Tokens | `token`, `bearer`, `jwt` |217| Credentials | `password`, `secret`, `key` |218| Cloud | `AWS_`, `AZURE_`, `GCP_` prefixes |219220---221222## 9. Cloud Security Considerations223224### Shared Responsibility225226| Layer | You Own | Provider Owns |227|-------|---------|---------------|228| Data | ✅ | ❌ |229| Application | ✅ | ❌ |230| OS/Runtime | Depends | Depends |231| Infrastructure | ❌ | ✅ |232233### Cloud-Specific Checks234235- IAM: Least privilege applied?236- Storage: Public buckets?237- Network: Security groups tightened?238- Secrets: Using secrets manager?239240---241242## 10. Anti-Patterns243244| ❌ Don't | ✅ Do |245|----------|-------|246| Scan without understanding | Map attack surface first |247| Alert on every CVE | Prioritize by exploitability + asset |248| Ignore false positives | Maintain verified baseline |249| Fix symptoms only | Address root causes |250| Scan once before deploy | Continuous scanning |251| Trust third-party deps blindly | Verify integrity, audit code |252253---254255## 11. Reporting Principles256257### Finding Structure258259Each finding should answer:2601. **What?** - Clear vulnerability description2612. **Where?** - Exact location (file, line, endpoint)2623. **Why?** - Root cause explanation2634. **Impact?** - Business consequence2645. **How to fix?** - Specific remediation265266### Severity Classification267268| Severity | Criteria |269|----------|----------|270| **Critical** | RCE, auth bypass, mass data exposure |271| **High** | Data exposure, privilege escalation |272| **Medium** | Limited scope, requires conditions |273| **Low** | Informational, best practice |274275---276277> **Remember:** Vulnerability scanning finds issues. Expert thinking prioritizes what matters. Always ask: "What would an attacker do with this?"