Security Test Scanner
Overview
Automate security vulnerability detection covering OWASP Top 10 categories including SQL injection, XSS, CSRF, broken authentication, and sensitive data exposure. Combines static analysis (source code scanning with Semgrep, Bandit, ESLint security plugins) with dynamic testing patterns (input fuzzing, header validation, authentication bypass checks).
Prerequisites
- Static analysis tools installed (Semgrep, ESLint with
eslint-plugin-security, Bandit for Python, or SpotBugs for Java)
- Application running in a test environment (never scan production without explicit authorization)
- Written authorization to perform security testing on the target system
npm audit, pip-audit, or trivy for dependency vulnerability scanning
- OWASP ZAP or Burp Suite for dynamic application security testing (optional)
Instructions
- Run dependency vulnerability scanning to identify known CVEs:
- Execute
npm audit --json or pip-audit --format json or trivy fs ..
- Parse results and flag critical/high severity vulnerabilities.
- Check if vulnerable dependencies have available patches.
- Perform static application security testing (SAST) on source code:
- Run Semgrep with OWASP rulesets:
semgrep --config=p/owasp-top-ten.
- Execute language-specific scanners (Bandit for Python, ESLint security for JS).
- Scan for hardcoded secrets using
gitleaks or trufflehog.
- Analyze code for injection vulnerabilities:
- Search for string concatenation in SQL queries (use Grep for patterns like
"SELECT.*" +).
- Identify unsanitized user input flowing into
innerHTML, eval(), or exec().
- Check for command injection via
child_process.exec() or os.system() with user input.
- Validate authentication and authorization:
- Verify password hashing uses bcrypt, scrypt, or Argon2 (not MD5/SHA1).
- Check JWT token validation includes expiration, issuer, and audience claims.
- Ensure authorization checks exist on every protected endpoint.
- Test for common web vulnerabilities:
- CSRF: Verify anti-CSRF tokens on state-changing endpoints.
- CORS: Check
Access-Control-Allow-Origin is not set to * on authenticated endpoints.
- Security headers: Validate presence of
Content-Security-Policy, X-Frame-Options, Strict-Transport-Security.
- Generate a prioritized findings report with:
- CVSS score for each vulnerability.
- Affected file, line number, and code snippet.
- Specific remediation steps with code examples.
- Create regression tests for each finding to prevent reintroduction.
Output
- Security scan report in Markdown with findings sorted by severity
- Dependency vulnerability list with CVE IDs and available patches
- SAST findings with file paths, line numbers, and code context
- Remediation checklist with specific code fixes for each finding
- Security regression test file to prevent reintroduction of fixed vulnerabilities
Error Handling
| Error |
Cause |
Solution |
| False positive on SQL injection |
ORM parameterized queries flagged as concatenation |
Add Semgrep nosemgrep comments on verified safe patterns; tune rules to recognize the ORM |
| Secret scanner flags test fixtures |
Test files contain example API keys or tokens |
Add test directories to .gitleaksignore; use obviously fake values like test-key-000 |
| Dependency audit returns hundreds of results |
Transitive dependencies with low-severity issues |
Filter to direct dependencies first; focus on critical/high only; use npm audit --omit=dev |
| Scanner cannot reach application |
Application not running or port mismatch |
Start the application before dynamic scans; verify the base URL and port configuration |
| Rate limiting blocks scan |
Too many requests from the scanner |
Configure scan throttling; use authenticated sessions with higher rate limits |
Examples
Semgrep scan for OWASP Top 10:
semgrep --config=p/owasp-top-ten --json --output=security-results.json .
Checking for hardcoded secrets:
gitleaks detect --source=. --report-format=json --report-path=secrets-report.json
Security regression test (Jest):
describe('Security: XSS Prevention', () => {
it('escapes HTML entities in user-generated content', () => {
const input = '<script>alert("xss")</script>';
const rendered = renderUserComment(input);
expect(rendered).not.toContain('<script>');
expect(rendered).toContain('<script>');
});
it('rejects SQL injection in search parameter', async () => {
const response = await request(app)
.get('/api/search?q='; DROP TABLE users; --')
.expect(200); # HTTP 200 OK
expect(response.body.results).toBeDefined();
// Verify users table still exists
const users = await db.query('SELECT count(*) FROM users');
expect(users.rows[0].count).toBeGreaterThan(0);
});
});
Resources
Source: jeremylongshore/claude-code-plugins-plus-skills → skills/.curated/performing-security-testing/SKILL.md
Also appears in: jeremylongshore/claude-code-plugins-plus-skills/plugins/testing/security-test-scanner/skills/performing-security-testing/SKILL.md
1---
2name: performing-security-testing
3description: "'Test automate security vulnerability testing covering OWASP Top 10, SQL injection, XSS, CSRF, and authentication issues. Use when performing security assessments, penetration tests, or vulnerability scans. Trigger with phrases like \"scan for vulnerabilities\", \"test security\", or \"run penetration test\". '"
4allowed-tools: "Read, Write, Edit, Grep, Glob, Bash(test:security-*)"
5category: security-and-compliance
6source_repo: jeremylongshore/claude-code-plugins-plus-skills
7source_path: "skills/.curated/performing-security-testing/SKILL.md"
8source_url: https://github.com/jeremylongshore/claude-code-plugins-plus-skills/blob/HEAD/skills/.curated/performing-security-testing/SKILL.md
9metadata:
10 source: https://skillmd.com/skills/thedixitjain/performing-security-testing
11---
12
13# Security Test Scanner
14
15## Overview
16
17Automate security vulnerability detection covering OWASP Top 10 categories including SQL injection, XSS, CSRF, broken authentication, and sensitive data exposure. Combines static analysis (source code scanning with Semgrep, Bandit, ESLint security plugins) with dynamic testing patterns (input fuzzing, header validation, authentication bypass checks).
18
19## Prerequisites
20
21- Static analysis tools installed (Semgrep, ESLint with `eslint-plugin-security`, Bandit for Python, or SpotBugs for Java)
22- Application running in a test environment (never scan production without explicit authorization)
23- Written authorization to perform security testing on the target system
24- `npm audit`, `pip-audit`, or `trivy` for dependency vulnerability scanning
25- OWASP ZAP or Burp Suite for dynamic application security testing (optional)
26
27## Instructions
28
291. Run dependency vulnerability scanning to identify known CVEs:
30 - Execute `npm audit --json` or `pip-audit --format json` or `trivy fs .`.
31 - Parse results and flag critical/high severity vulnerabilities.
32 - Check if vulnerable dependencies have available patches.
332. Perform static application security testing (SAST) on source code:
34 - Run Semgrep with OWASP rulesets: `semgrep --config=p/owasp-top-ten`.
35 - Execute language-specific scanners (Bandit for Python, ESLint security for JS).
36 - Scan for hardcoded secrets using `gitleaks` or `trufflehog`.
373. Analyze code for injection vulnerabilities:
38 - Search for string concatenation in SQL queries (use Grep for patterns like `"SELECT.*" +`).
39 - Identify unsanitized user input flowing into `innerHTML`, `eval()`, or `exec()`.
40 - Check for command injection via `child_process.exec()` or `os.system()` with user input.
414. Validate authentication and authorization:
42 - Verify password hashing uses bcrypt, scrypt, or Argon2 (not MD5/SHA1).
43 - Check JWT token validation includes expiration, issuer, and audience claims.
44 - Ensure authorization checks exist on every protected endpoint.
455. Test for common web vulnerabilities:
46 - CSRF: Verify anti-CSRF tokens on state-changing endpoints.
47 - CORS: Check `Access-Control-Allow-Origin` is not set to `*` on authenticated endpoints.
48 - Security headers: Validate presence of `Content-Security-Policy`, `X-Frame-Options`, `Strict-Transport-Security`.
496. Generate a prioritized findings report with:
50 - CVSS score for each vulnerability.
51 - Affected file, line number, and code snippet.
52 - Specific remediation steps with code examples.
537. Create regression tests for each finding to prevent reintroduction.
54
55## Output
56
57- Security scan report in Markdown with findings sorted by severity
58- Dependency vulnerability list with CVE IDs and available patches
59- SAST findings with file paths, line numbers, and code context
60- Remediation checklist with specific code fixes for each finding
61- Security regression test file to prevent reintroduction of fixed vulnerabilities
62
63## Error Handling
64
65| Error | Cause | Solution |
66|-------|-------|---------|
67| False positive on SQL injection | ORM parameterized queries flagged as concatenation | Add Semgrep `nosemgrep` comments on verified safe patterns; tune rules to recognize the ORM |
68| Secret scanner flags test fixtures | Test files contain example API keys or tokens | Add test directories to `.gitleaksignore`; use obviously fake values like `test-key-000` |
69| Dependency audit returns hundreds of results | Transitive dependencies with low-severity issues | Filter to direct dependencies first; focus on critical/high only; use `npm audit --omit=dev` |
70| Scanner cannot reach application | Application not running or port mismatch | Start the application before dynamic scans; verify the base URL and port configuration |
71| Rate limiting blocks scan | Too many requests from the scanner | Configure scan throttling; use authenticated sessions with higher rate limits |
72
73## Examples
74
75**Semgrep scan for OWASP Top 10:**
76
77```bash
78semgrep --config=p/owasp-top-ten --json --output=security-results.json .
79```
80
81**Checking for hardcoded secrets:**
82
83```bash
84gitleaks detect --source=. --report-format=json --report-path=secrets-report.json
85```
86
87**Security regression test (Jest):**
88
89```typescript
90describe('Security: XSS Prevention', () => {
91 it('escapes HTML entities in user-generated content', () => {
92 const input = '<script>alert("xss")</script>';
93 const rendered = renderUserComment(input);
94 expect(rendered).not.toContain('<script>');
95 expect(rendered).toContain('<script>');
96 });
97
98 it('rejects SQL injection in search parameter', async () => {
99 const response = await request(app)
100 .get('/api/search?q='; DROP TABLE users; --')
101 .expect(200); # HTTP 200 OK
102 expect(response.body.results).toBeDefined();
103 // Verify users table still exists
104 const users = await db.query('SELECT count(*) FROM users');
105 expect(users.rows[0].count).toBeGreaterThan(0);
106 });
107});
108```
109
110## Resources
111
112- OWASP Top 10: https://owasp.org/www-project-top-ten/
113- Semgrep rules registry: https://semgrep.dev/explore
114- Bandit (Python SAST): https://bandit.readthedocs.io/
115- Gitleaks secret detection: https://github.com/gitleaks/gitleaks
116- npm audit documentation: https://docs.npmjs.com/cli/commands/npm-audit
117- OWASP ASVS (Application Security Verification Standard): https://owasp.org/www-project-application-security-verification-standard/
118
119---
120
121**Source:** [`jeremylongshore/claude-code-plugins-plus-skills`](https://github.com/jeremylongshore/claude-code-plugins-plus-skills) → `skills/.curated/performing-security-testing/SKILL.md`
122
123**Also appears in:** `jeremylongshore/claude-code-plugins-plus-skills/plugins/testing/security-test-scanner/skills/performing-security-testing/SKILL.md`