SAST Vulnerability Analysis
Purpose
Systematically analyze source code for security vulnerabilities using structured Source→Sink taint tracking,
pattern matching, and vulnerability-class-specific detection heuristics. Produce actionable findings with
severity ratings, affected code locations (file + line number), and remediation guidance.
Scope
This skill covers the following 34 vulnerability classes. Each has a dedicated vulnerability knowledge file loaded on demand:
| Category |
Vulnerabilities |
| Injection |
SQL Injection, XSS, SSTI, NoSQL Injection, GraphQL Injection, XXE, RCE / Command Injection, Expression Language Injection |
| Access Control & Auth |
IDOR, Privilege Escalation, Authentication/JWT, Default Credentials, Brute Force, Business Logic, HTTP Method Tampering, Verification Code Abuse, Session Fixation |
| Data Exposure & Crypto |
Weak Crypto/Hash, Information Disclosure, Insecure Cookie, Trust Boundary |
| Server-Side |
SSRF, Path Traversal/LFI/RFI, Insecure Deserialization, Arbitrary File Upload, JNDI Injection, Race Conditions |
| Protocol & Infrastructure |
CSRF, Open Redirect, HTTP Request Smuggling/Desync, Denial of Service, CVE Patterns |
| Language/Platform |
PHP Security, Mobile Security (Android/iOS) |
Workflow
Step 1: Understand Scope
Determine:
- Target: single file, directory, API endpoint, module, or full repo
- Language(s) and framework(s) in use
- User's goal: quick scan, deep audit, specific vuln class, or full report
Step 2: Load Relevant Knowledge Files
Based on the code being reviewed, load the appropriate vulnerability knowledge files from references/:
references/sql_injection.md — SQL / ORM injection
references/xss.md — Cross-site scripting
references/ssrf.md — Server-side request forgery
references/rce.md — Remote code execution
references/idor.md — Insecure direct object reference
references/authentication_jwt.md — Auth flaws, JWT weaknesses
references/csrf.md — Cross-site request forgery
references/path_traversal_lfi_rfi.md — Path traversal, LFI/RFI
references/ssti.md — Server-side template injection
references/xxe.md — XML external entity
references/insecure_deserialization.md — Insecure deserialization
references/arbitrary_file_upload.md — Arbitrary file upload
references/privilege_escalation.md — Privilege escalation
references/nosql_injection.md — NoSQL injection
references/graphql_injection.md — GraphQL injection
references/weak_crypto_hash.md — Weak cryptography / hash
references/information_disclosure.md — Information disclosure
references/insecure_cookie.md — Insecure cookie attributes
references/open_redirect.md — Open redirect
references/trust_boundary.md — Trust boundary violations
references/race_conditions.md — Race conditions / TOCTOU
references/brute_force.md — Brute force / credential stuffing
references/default_credentials.md — Default / hardcoded credentials
references/verification_code_abuse.md — Verification code abuse
references/business_logic.md — Business logic flaws
references/http_method_tamper.md — HTTP method tampering
references/smuggling_desync.md — HTTP request smuggling / desync
references/cve_patterns.md — Known CVE patterns
references/expression_language_injection.md — Expression language injection (SpEL / OGNL)
references/jndi_injection.md — JNDI injection (Log4Shell class)
references/denial_of_service.md — Denial of service / resource exhaustion
references/php_security.md — PHP-specific security issues
references/mobile_security.md — Mobile security (Android / iOS)
references/session_fixation.md — Session fixation
Loading strategy:
- For a targeted review (e.g., "check for SQL injection"), load only the relevant knowledge file(s).
- For a full audit, load all 34 coverage files and scan systematically.
- Always load knowledge files for the top OWASP risks even if not explicitly requested.
Step 3: Analyze Code — Source→Sink Taint Tracking
For each loaded vulnerability class, perform taint analysis:
Identify Sources — User-controlled input entry points:
- HTTP params, headers, cookies, request body
- File uploads
- WebSocket messages
- Environment variables
- Database reads of user-supplied data, deserialized objects
Trace Data Flow — Follow the data through:
- Variable assignments, function arguments, return values
- Framework helpers, ORM calls, template rendering
- Cross-module/service boundaries
Check Sinks — Dangerous operations receiving tainted data:
- Query execution (SQL, NoSQL, LDAP, XPath)
- Shell/OS command execution
- File system operations
- HTTP client calls
- Template rendering / eval / expression parsing
- Serialization/deserialization
Evaluate Sanitization — Between source and sink, look for:
- Input validation (allowlist vs denylist)
- Context-appropriate encoding/escaping
- Parameterization (prepared statements)
- Framework-native protections
Determine Preliminary Verdict:
- VULN: Taint reaches sink with no effective sanitization
- LIKELY VULN: Sanitization present but bypassable per reference heuristics
- SAFE: Effective sanitization or no taint path
Step 4: Business Logic & Auth Analysis
Beyond taint tracking, check for:
- Missing authentication/authorization on sensitive endpoints
- Insecure state machine transitions
- Race conditions in concurrent operations
- Improper trust boundaries between components
- JWT algorithm confusion, token fixation, session issues
- Default/hardcoded credentials
- Enumeration via timing or response differences
Step 5: Judge — Validity Re-Verification
Before reporting, every preliminary finding (VULN or LIKELY VULN) must pass a Judge review. The Judge acts as an adversarial second opinion to eliminate false positives.
For each candidate finding, answer all of the following:
Reachability Check
Sanitization Re-Evaluation
Exploitability Check
Judge Verdict
| Verdict |
Meaning |
Action |
| CONFIRMED |
All reachability/sanitization/exploitability checks pass |
Include in report |
| LIKELY |
Most checks pass; one uncertainty remains |
Include in report, flag uncertainty |
| NEEDS CONTEXT |
Cannot determine without runtime behavior / config / additional files |
Note as "unverifiable without X" |
| FALSE POSITIVE |
A check definitively fails |
Drop silently |
Only CONFIRMED and LIKELY findings are reported.
Judge Output Format (internal, before reporting)
Finding: VULN-NNN — <class>
Reachability: PASS / FAIL / UNCERTAIN — <reason>
Sanitization: PASS / FAIL / UNCERTAIN — <reason>
Exploitability: PASS / FAIL / UNCERTAIN — <reason>
Judge Verdict: CONFIRMED / LIKELY / NEEDS CONTEXT / FALSE POSITIVE
False Positive Guardrails
- Do not emit
default_credentials unless there is a reachable authentication path that accepts a hardcoded, documented, factory, or seeded credential pair.
- Do not emit
weak_crypto_hash when the evidence only shows a vulnerable third-party component or a generic cryptography import. Require direct use of weak hashes, broken password storage, or unsafe signing.
- Tag clarification:
weak_crypto_hash is the canonical tag for both weak cryptographic algorithms (DES, RC4, ECB mode) and weak hash functions (MD5, SHA-1 for passwords). Do not use weak_crypto as a separate tag unless the benchmark ground truth explicitly requires it; prefer weak_crypto_hash to avoid tag fragmentation.
- Do not emit generic
rce when the code shows direct shell/process execution — prefer command_injection.
- Do not replace
spel_injection with command_injection or rce when the exploit primitive is Spring EL expression parsing.
- Do not emit
jndi_injection for component demos unless the JNDI sink itself is the primary exploit path.
- Do not emit broad tags (
trust_boundary, authentication, privilege_escalation) when a narrower precise tag is supported (xff_spoofing, session_fixation, verification_code).
- Do not emit
open_redirect for infrastructure/parser misconfiguration unless attacker-controlled redirect response is the primary exploit.
- Do not emit
denial_of_service merely because a path lacks size/rate limits — require explicit evidence that resource exhaustion is the primary impact.
- Do not emit
brute_force merely because a login endpoint lacks visible rate limiting — rate limiting may exist at infrastructure level. Require explicit evidence of unlimited attempt processing.
- Do not emit
csrf for stateless APIs using Bearer-token-only authentication with SessionCreationPolicy.STATELESS.
- Do not emit
insecure_deserialization when the same sink is already covered by component_vulnerability (e.g., Fastjson autoType) unless a separate deserialization path exists.
- Do not emit
arbitrary_file_upload for profile/avatar image upload with type restrictions and non-webroot storage.
- Do not emit
session_fixation when Spring Security default session management is active (migrateSession is the default).
- Do not emit
information_disclosure for database credentials in application config files — these are deployment issues, not application-level disclosure.
Step 6: Report Findings
Severity Classification
| Severity |
Criteria |
| Critical |
Direct RCE, authentication bypass, unauthenticated data exposure |
| High |
SQLi, SSRF, IDOR with sensitive data, stored XSS, privilege escalation |
| Medium |
Reflected XSS, CSRF, path traversal, insecure deserialization |
| Low |
Information disclosure, open redirect, weak crypto, insecure cookie |
| Info |
Missing security headers, verbose errors, defense-in-depth gaps |
Finding Format
[SEVERITY] VULN-NNN — <Vulnerability Class> [CONFIRMED | LIKELY]
File: <path>:<line_number>
Description: <one sentence — what the vulnerability is>
Impact: <what an attacker can achieve>
Evidence:
<relevant code snippet>
Judge: <one sentence — why this passed re-verification>
Remediation: <specific fix — not generic advice>
For NEEDS CONTEXT findings:
[UNVERIFIABLE] VULN-NNN — <Vulnerability Class>
File: <path>:<line_number>
Blocked by: <what additional context is needed>
Report Structure
When producing a full report, write to sast_report.md (or user-specified path):
# SAST Security Report — <target>
Date: <date>
Analyzer: eresus-sast-scanner v1.3
## Executive Summary
<2-3 sentences: total findings by severity, most critical issue>
## Critical Findings
## High Findings
## Medium Findings
## Low Findings
## Informational
## Unverifiable Findings
## Remediation Priority
<ordered fix list>
Key Principles
- Evidence over assertion: always show the vulnerable code path, not just the pattern name
- Context matters: a finding is only valid if the sink is reachable with user-controlled data
- Avoid false positives: if sanitization exists, verify it is bypassable before marking VULN
- Be precise: include exact file paths and line numbers — never approximate
- Fix > flag: always provide a concrete remediation, not just a problem statement
- Language-aware: adapt sink/source patterns to the specific language and framework in use
1---
2name: eresus-sast-scanner
3description: >
4 General-purpose Static Application Security Testing (SAST) skill for code vulnerability analysis.
5 Trigger when the user asks to: "analyze code for vulnerabilities", "review code security", "find security bugs",
6 "do a SAST scan", "check for [vulnerability type] in code", "audit source code", or requests a security
7 code review of any language or framework. Covers 34 vulnerability classes across web, API, auth, mobile, and logic layers.
8metadata:
9 source: https://skillmd.com/skills/aibot88/eresus-sast-scanner
10 version: "1.3"
11 domain: application-security
12 coverage: 34 vulnerability knowledge bases
13---
14
15# SAST Vulnerability Analysis
16
17## Purpose
18
19Systematically analyze source code for security vulnerabilities using structured Source→Sink taint tracking,
20pattern matching, and vulnerability-class-specific detection heuristics. Produce actionable findings with
21severity ratings, affected code locations (file + line number), and remediation guidance.
22
23## Scope
24
25This skill covers the following 34 vulnerability classes. Each has a dedicated vulnerability knowledge file loaded on demand:
26
27| Category | Vulnerabilities |
28|----------|----------------|
29| **Injection** | SQL Injection, XSS, SSTI, NoSQL Injection, GraphQL Injection, XXE, RCE / Command Injection, Expression Language Injection |
30| **Access Control & Auth** | IDOR, Privilege Escalation, Authentication/JWT, Default Credentials, Brute Force, Business Logic, HTTP Method Tampering, Verification Code Abuse, Session Fixation |
31| **Data Exposure & Crypto** | Weak Crypto/Hash, Information Disclosure, Insecure Cookie, Trust Boundary |
32| **Server-Side** | SSRF, Path Traversal/LFI/RFI, Insecure Deserialization, Arbitrary File Upload, JNDI Injection, Race Conditions |
33| **Protocol & Infrastructure** | CSRF, Open Redirect, HTTP Request Smuggling/Desync, Denial of Service, CVE Patterns |
34| **Language/Platform** | PHP Security, Mobile Security (Android/iOS) |
35
36---
37
38## Workflow
39
40### Step 1: Understand Scope
41
42Determine:
43- Target: single file, directory, API endpoint, module, or full repo
44- Language(s) and framework(s) in use
45- User's goal: quick scan, deep audit, specific vuln class, or full report
46
47### Step 2: Load Relevant Knowledge Files
48
49Based on the code being reviewed, load the appropriate vulnerability knowledge files from `references/`:
50
51```
52references/sql_injection.md — SQL / ORM injection
53references/xss.md — Cross-site scripting
54references/ssrf.md — Server-side request forgery
55references/rce.md — Remote code execution
56references/idor.md — Insecure direct object reference
57references/authentication_jwt.md — Auth flaws, JWT weaknesses
58references/csrf.md — Cross-site request forgery
59references/path_traversal_lfi_rfi.md — Path traversal, LFI/RFI
60references/ssti.md — Server-side template injection
61references/xxe.md — XML external entity
62references/insecure_deserialization.md — Insecure deserialization
63references/arbitrary_file_upload.md — Arbitrary file upload
64references/privilege_escalation.md — Privilege escalation
65references/nosql_injection.md — NoSQL injection
66references/graphql_injection.md — GraphQL injection
67references/weak_crypto_hash.md — Weak cryptography / hash
68references/information_disclosure.md — Information disclosure
69references/insecure_cookie.md — Insecure cookie attributes
70references/open_redirect.md — Open redirect
71references/trust_boundary.md — Trust boundary violations
72references/race_conditions.md — Race conditions / TOCTOU
73references/brute_force.md — Brute force / credential stuffing
74references/default_credentials.md — Default / hardcoded credentials
75references/verification_code_abuse.md — Verification code abuse
76references/business_logic.md — Business logic flaws
77references/http_method_tamper.md — HTTP method tampering
78references/smuggling_desync.md — HTTP request smuggling / desync
79references/cve_patterns.md — Known CVE patterns
80references/expression_language_injection.md — Expression language injection (SpEL / OGNL)
81references/jndi_injection.md — JNDI injection (Log4Shell class)
82references/denial_of_service.md — Denial of service / resource exhaustion
83references/php_security.md — PHP-specific security issues
84references/mobile_security.md — Mobile security (Android / iOS)
85references/session_fixation.md — Session fixation
86```
87
88**Loading strategy:**
89- For a targeted review (e.g., "check for SQL injection"), load only the relevant knowledge file(s).
90- For a full audit, load all 34 coverage files and scan systematically.
91- Always load knowledge files for the top OWASP risks even if not explicitly requested.
92
93---
94
95### Step 3: Analyze Code — Source→Sink Taint Tracking
96
97For each loaded vulnerability class, perform taint analysis:
98
991. **Identify Sources** — User-controlled input entry points:
100 - HTTP params, headers, cookies, request body
101 - File uploads
102 - WebSocket messages
103 - Environment variables
104 - Database reads of user-supplied data, deserialized objects
105
1062. **Trace Data Flow** — Follow the data through:
107 - Variable assignments, function arguments, return values
108 - Framework helpers, ORM calls, template rendering
109 - Cross-module/service boundaries
110
1113. **Check Sinks** — Dangerous operations receiving tainted data:
112 - Query execution (SQL, NoSQL, LDAP, XPath)
113 - Shell/OS command execution
114 - File system operations
115 - HTTP client calls
116 - Template rendering / eval / expression parsing
117 - Serialization/deserialization
118
1194. **Evaluate Sanitization** — Between source and sink, look for:
120 - Input validation (allowlist vs denylist)
121 - Context-appropriate encoding/escaping
122 - Parameterization (prepared statements)
123 - Framework-native protections
124
1255. **Determine Preliminary Verdict**:
126 - **VULN**: Taint reaches sink with no effective sanitization
127 - **LIKELY VULN**: Sanitization present but bypassable per reference heuristics
128 - **SAFE**: Effective sanitization or no taint path
129
130---
131
132### Step 4: Business Logic & Auth Analysis
133
134Beyond taint tracking, check for:
135- Missing authentication/authorization on sensitive endpoints
136- Insecure state machine transitions
137- Race conditions in concurrent operations
138- Improper trust boundaries between components
139- JWT algorithm confusion, token fixation, session issues
140- Default/hardcoded credentials
141- Enumeration via timing or response differences
142
143---
144
145### Step 5: Judge — Validity Re-Verification
146
147Before reporting, every preliminary finding (VULN or LIKELY VULN) **must pass a Judge review**. The Judge acts as an adversarial second opinion to eliminate false positives.
148
149For each candidate finding, answer all of the following:
150
151#### Reachability Check
152- [ ] Is the source actually user-controlled, or is it internal/trusted data?
153- [ ] Is the vulnerable code path reachable from an HTTP endpoint / entry point, or is it dead code / internal-only?
154- [ ] Are there upstream guards (auth middleware, input filters) that block the path before it reaches the sink?
155
156#### Sanitization Re-Evaluation
157- [ ] Is there sanitization that was missed in Step 3? (Check parent functions, middleware, framework internals)
158- [ ] Is the sanitization method sufficient for this specific sink and context?
159- [ ] Does the framework provide implicit protection for this pattern?
160
161#### Exploitability Check
162- [ ] Can the tainted value actually reach the sink in a form that triggers the vulnerability?
163- [ ] Is exploitation conditional on a specific environment, config, or privilege level?
164- [ ] For logic bugs: is the business impact real, or hypothetical?
165- [ ] Is the chosen tag the most precise valid label for this finding?
166
167#### Judge Verdict
168
169| Verdict | Meaning | Action |
170|---------|---------|--------|
171| **CONFIRMED** | All reachability/sanitization/exploitability checks pass | Include in report |
172| **LIKELY** | Most checks pass; one uncertainty remains | Include in report, flag uncertainty |
173| **NEEDS CONTEXT** | Cannot determine without runtime behavior / config / additional files | Note as "unverifiable without X" |
174| **FALSE POSITIVE** | A check definitively fails | Drop silently |
175
176**Only CONFIRMED and LIKELY findings are reported.**
177
178#### Judge Output Format (internal, before reporting)
179
180```
181Finding: VULN-NNN — <class>
182Reachability: PASS / FAIL / UNCERTAIN — <reason>
183Sanitization: PASS / FAIL / UNCERTAIN — <reason>
184Exploitability: PASS / FAIL / UNCERTAIN — <reason>
185Judge Verdict: CONFIRMED / LIKELY / NEEDS CONTEXT / FALSE POSITIVE
186```
187
188#### False Positive Guardrails
189
190- Do not emit `default_credentials` unless there is a reachable authentication path that accepts a hardcoded, documented, factory, or seeded credential pair.
191- Do not emit `weak_crypto_hash` when the evidence only shows a vulnerable third-party component or a generic cryptography import. Require direct use of weak hashes, broken password storage, or unsafe signing.
192- **Tag clarification**: `weak_crypto_hash` is the canonical tag for both weak cryptographic algorithms (DES, RC4, ECB mode) and weak hash functions (MD5, SHA-1 for passwords). Do not use `weak_crypto` as a separate tag unless the benchmark ground truth explicitly requires it; prefer `weak_crypto_hash` to avoid tag fragmentation.
193- Do not emit generic `rce` when the code shows direct shell/process execution — prefer `command_injection`.
194- Do not replace `spel_injection` with `command_injection` or `rce` when the exploit primitive is Spring EL expression parsing.
195- Do not emit `jndi_injection` for component demos unless the JNDI sink itself is the primary exploit path.
196- Do not emit broad tags (`trust_boundary`, `authentication`, `privilege_escalation`) when a narrower precise tag is supported (`xff_spoofing`, `session_fixation`, `verification_code`).
197- Do not emit `open_redirect` for infrastructure/parser misconfiguration unless attacker-controlled redirect response is the primary exploit.
198- Do not emit `denial_of_service` merely because a path lacks size/rate limits — require explicit evidence that resource exhaustion is the primary impact.
199- Do not emit `brute_force` merely because a login endpoint lacks visible rate limiting — rate limiting may exist at infrastructure level. Require explicit evidence of unlimited attempt processing.
200- Do not emit `csrf` for stateless APIs using Bearer-token-only authentication with `SessionCreationPolicy.STATELESS`.
201- Do not emit `insecure_deserialization` when the same sink is already covered by `component_vulnerability` (e.g., Fastjson autoType) unless a separate deserialization path exists.
202- Do not emit `arbitrary_file_upload` for profile/avatar image upload with type restrictions and non-webroot storage.
203- Do not emit `session_fixation` when Spring Security default session management is active (migrateSession is the default).
204- Do not emit `information_disclosure` for database credentials in application config files — these are deployment issues, not application-level disclosure.
205
206---
207
208### Step 6: Report Findings
209
210#### Severity Classification
211
212| Severity | Criteria |
213|----------|----------|
214| **Critical** | Direct RCE, authentication bypass, unauthenticated data exposure |
215| **High** | SQLi, SSRF, IDOR with sensitive data, stored XSS, privilege escalation |
216| **Medium** | Reflected XSS, CSRF, path traversal, insecure deserialization |
217| **Low** | Information disclosure, open redirect, weak crypto, insecure cookie |
218| **Info** | Missing security headers, verbose errors, defense-in-depth gaps |
219
220#### Finding Format
221
222```
223[SEVERITY] VULN-NNN — <Vulnerability Class> [CONFIRMED | LIKELY]
224File: <path>:<line_number>
225Description: <one sentence — what the vulnerability is>
226Impact: <what an attacker can achieve>
227Evidence:
228 <relevant code snippet>
229Judge: <one sentence — why this passed re-verification>
230Remediation: <specific fix — not generic advice>
231```
232
233For NEEDS CONTEXT findings:
234
235```
236[UNVERIFIABLE] VULN-NNN — <Vulnerability Class>
237File: <path>:<line_number>
238Blocked by: <what additional context is needed>
239```
240
241#### Report Structure
242
243When producing a full report, write to `sast_report.md` (or user-specified path):
244
245```markdown
246# SAST Security Report — <target>
247Date: <date>
248Analyzer: eresus-sast-scanner v1.3
249
250## Executive Summary
251<2-3 sentences: total findings by severity, most critical issue>
252
253## Critical Findings
254## High Findings
255## Medium Findings
256## Low Findings
257## Informational
258## Unverifiable Findings
259
260## Remediation Priority
261<ordered fix list>
262```
263
264---
265
266## Key Principles
267
268- **Evidence over assertion**: always show the vulnerable code path, not just the pattern name
269- **Context matters**: a finding is only valid if the sink is reachable with user-controlled data
270- **Avoid false positives**: if sanitization exists, verify it is bypassable before marking VULN
271- **Be precise**: include exact file paths and line numbers — never approximate
272- **Fix > flag**: always provide a concrete remediation, not just a problem statement
273- **Language-aware**: adapt sink/source patterns to the specific language and framework in use