Vulnerability Scanner
Selective Reading Rule
Start with:
references/senior-master-standard.md
references/usage-routing.md
references/quality-checklist.md
Then load only the inherited docs, scripts, assets, or examples that match the user's actual task.
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: ALWAYS use this when the request matches Vulnerability Scanner: Advanced vulnerability analysis principles.4---56# Vulnerability Scanner78## Selective Reading Rule910Start with:1112- `references/senior-master-standard.md`13- `references/usage-routing.md`14- `references/quality-checklist.md`1516Then load only the inherited docs, scripts, assets, or examples that match the user's actual task.1718> Think like an attacker, defend like an expert. 2025 threat landscape awareness.1920## 🔧 Runtime Scripts2122**Execute for automated validation:**2324| Script | Purpose | Usage |25|--------|---------|-------|26| `scripts/security_scan.py` | Validate security principles applied | `python scripts/security_scan.py <project_path>` |2728## 📋 Reference Files2930| File | Purpose |31|------|---------|32| [checklists.md](references/legacy-checklists.md) | OWASP Top 10, Auth, API, Data protection checklists |3334---3536## 1. Security Expert Mindset3738### Core Principles3940| Principle | Application |41|-----------|-------------|42| **Assume Breach** | Design as if attacker already inside |43| **Zero Trust** | Never trust, always verify |44| **Defense in Depth** | Multiple layers, no single point |45| **Least Privilege** | Minimum required access only |46| **Fail Secure** | On error, deny access |4748### Threat Modeling Questions4950Before scanning, ask:511. What are we protecting? (Assets)522. Who would attack? (Threat actors)533. How would they attack? (Attack vectors)544. What's the impact? (Business risk)5556---5758## 2. OWASP Top 10:20255960### Risk Categories6162| Rank | Category | Think About |63|------|----------|-------------|64| **A01** | Broken Access Control | Who can access what? IDOR, SSRF |65| **A02** | Security Misconfiguration | Defaults, headers, exposed services |66| **A03** | Software Supply Chain 🆕 | Dependencies, CI/CD, build integrity |67| **A04** | Cryptographic Failures | Weak crypto, exposed secrets |68| **A05** | Injection | User input → system commands |69| **A06** | Insecure Design | Flawed architecture |70| **A07** | Authentication Failures | Session, credential management |71| **A08** | Integrity Failures | Unsigned updates, tampered data |72| **A09** | Logging & Alerting | Blind spots, no monitoring |73| **A10** | Exceptional Conditions 🆕 | Error handling, fail-open states |7475### 2025 Key Changes7677```782021 → 2025 Shifts:79├── SSRF merged into A01 (Access Control)80├── A02 elevated (Cloud/Container configs)81├── A03 NEW: Supply Chain (major focus)82├── A10 NEW: Exceptional Conditions83└── Focus shift: Root causes > Symptoms84```8586---8788## 3. Supply Chain Security (A03)8990### Attack Surface9192| Vector | Risk | Question to Ask |93|--------|------|-----------------|94| **Dependencies** | Malicious packages | Do we audit new deps? |95| **Lock files** | Integrity attacks | Are they committed? |96| **Build pipeline** | CI/CD compromise | Who can modify? |97| **Registry** | Typosquatting | Verified sources? |9899### Defense Principles100101- Verify package integrity (checksums)102- Pin versions, audit updates103- Use private registries for critical deps104- Sign and verify artifacts105106---107108## 4. Attack Surface Mapping109110### What to Map111112| Category | Elements |113|----------|----------|114| **Entry Points** | APIs, forms, file uploads |115| **Data Flows** | Input → Process → Output |116| **Trust Boundaries** | Where auth/authz checked |117| **Assets** | Secrets, PII, business data |118119### Prioritization Matrix120121```122Risk = Likelihood × Impact123124High Impact + High Likelihood → CRITICAL125High Impact + Low Likelihood → HIGH126Low Impact + High Likelihood → MEDIUM127Low Impact + Low Likelihood → LOW128```129130---131132## 5. Risk Prioritization133134### CVSS + Context135136| Factor | Weight | Question |137|--------|--------|----------|138| **CVSS Score** | Base severity | How severe is the vuln? |139| **EPSS Score** | Exploit likelihood | Is it being exploited? |140| **Asset Value** | Business context | What's at risk? |141| **Exposure** | Attack surface | Internet-facing? |142143### Prioritization Decision Tree144145```146Is it actively exploited (EPSS >0.5)?147├── YES → CRITICAL: Immediate action148└── NO → Check CVSS149 ├── CVSS ≥9.0 → HIGH150 ├── CVSS 7.0-8.9 → Consider asset value151 └── CVSS <7.0 → Schedule for later152```153154---155156## 6. Exceptional Conditions (A10 - New)157158### Fail-Open vs Fail-Closed159160| Scenario | Fail-Open (BAD) | Fail-Closed (GOOD) |161|----------|-----------------|---------------------|162| Auth error | Allow access | Deny access |163| Parsing fails | Accept input | Reject input |164| Timeout | Retry forever | Limit + abort |165166### What to Check167168- Exception handlers that catch-all and ignore169- Missing error handling on security operations170- Race conditions in auth/authz171- Resource exhaustion scenarios172173---174175## 7. Scanning Methodology176177### Phase-Based Approach178179```1801. RECONNAISSANCE181 └── Understand the target182 ├── Technology stack183 ├── Entry points184 └── Data flows1851862. DISCOVERY187 └── Identify potential issues188 ├── Configuration review189 ├── Dependency analysis190 └── Code pattern search1911923. ANALYSIS193 └── Validate and prioritize194 ├── False positive elimination195 ├── Risk scoring196 └── Attack chain mapping1971984. REPORTING199 └── Actionable findings200 ├── Clear reproduction steps201 ├── Business impact202 └── Remediation guidance203```204205---206207## 8. Code Pattern Analysis208209### High-Risk Patterns210211| Pattern | Risk | Look For |212|---------|------|----------|213| **String concat in queries** | Injection | `"SELECT * FROM " + user_input` |214| **Dynamic code execution** | RCE | `eval()`, `exec()`, `Function()` |215| **Unsafe deserialization** | RCE | `pickle.loads()`, `unserialize()` |216| **Path manipulation** | Traversal | User input in file paths |217| **Disabled security** | Various | `verify=False`, `--insecure` |218219### Secret Patterns220221| Type | Indicators |222|------|-----------|223| API Keys | `api_key`, `apikey`, high entropy |224| Tokens | `token`, `bearer`, `jwt` |225| Credentials | `password`, `secret`, `key` |226| Cloud | `AWS_`, `AZURE_`, `GCP_` prefixes |227228---229230## 9. Cloud Security Considerations231232### Shared Responsibility233234| Layer | You Own | Provider Owns |235|-------|---------|---------------|236| Data | ✅ | ❌ |237| Application | ✅ | ❌ |238| OS/Runtime | Depends | Depends |239| Infrastructure | ❌ | ✅ |240241### Cloud-Specific Checks242243- IAM: Least privilege applied?244- Storage: Public buckets?245- Network: Security groups tightened?246- Secrets: Using secrets manager?247248---249250## 10. Anti-Patterns251252| ❌ Don't | ✅ Do |253|----------|-------|254| Scan without understanding | Map attack surface first |255| Alert on every CVE | Prioritize by exploitability + asset |256| Ignore false positives | Maintain verified baseline |257| Fix symptoms only | Address root causes |258| Scan once before deploy | Continuous scanning |259| Trust third-party deps blindly | Verify integrity, audit code |260261---262263## 11. Reporting Principles264265### Finding Structure266267Each finding should answer:2681. **What?** - Clear vulnerability description2692. **Where?** - Exact location (file, line, endpoint)2703. **Why?** - Root cause explanation2714. **Impact?** - Business consequence2725. **How to fix?** - Specific remediation273274### Severity Classification275276| Severity | Criteria |277|----------|----------|278| **Critical** | RCE, auth bypass, mass data exposure |279| **High** | Data exposure, privilege escalation |280| **Medium** | Limited scope, requires conditions |281| **Low** | Informational, best practice |282283---284285> **Remember:** Vulnerability scanning finds issues. Expert thinking prioritizes what matters. Always ask: "What would an attacker do with this?"