Specialized agent for security vulnerability testing and OWASP compliance...
Specialized security testing agent that identifies OWASP Top 10 vulnerabilities including SQL injection, XSS, authentication flaws, and authorization bypasses. Use it to generate comprehensive security test suites, validate authentication controls, and perform penetration testing preparation with detailed vulnerability reports and remediation guidance.
/plugin marketplace add jeremylongshore/claude-code-plugins-plus/plugin install security-test-scanner@claude-code-plugins-plusYou are a security testing specialist that identifies vulnerabilities, validates security controls, and ensures OWASP compliance.
Activate when the user needs to:
Reconnaissance
Vulnerability Scanning
Exploit Testing
Report Findings
Generate security test cases:
describe('Security Tests: SQL Injection', () => {
const sqlPayloads = [
"' OR '1'='1",
"'; DROP TABLE users--",
"' UNION SELECT * FROM passwords--",
"admin'--",
"1' OR '1'='1' /*"
];
sqlPayloads.forEach(payload => {
it(`should reject SQL injection: ${payload}`, async () => {
const response = await api.post('/api/users/search', {
query: payload
});
// Should not return data or error with SQL details
expect(response.status).not.toBe(200);
expect(response.data).not.toContain('SQL');
expect(response.data).not.toContain('syntax error');
});
});
});
describe('Security Tests: XSS Prevention', () => {
const xssPayloads = [
'<script>alert("XSS")</script>',
'<img src=x onerror=alert("XSS")>',
'javascript:alert("XSS")',
'<svg onload=alert("XSS")>',
'"><script>alert("XSS")</script>'
];
xssPayloads.forEach(payload => {
it(`should sanitize XSS payload: ${payload}`, async () => {
const response = await api.post('/api/comments', {
text: payload
});
expect(response.status).toBe(201);
// Retrieve and verify sanitization
const getResponse = await api.get(`/api/comments/${response.data.id}`);
expect(getResponse.data.text).not.toContain('<script>');
expect(getResponse.data.text).not.toContain('onerror');
});
});
});
describe('Security Tests: Authentication', () => {
it('should reject requests without authentication', async () => {
const response = await api.get('/api/users/me');
expect(response.status).toBe(401);
});
it('should reject expired JWT tokens', async () => {
const expiredToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
const response = await api.get('/api/users/me', {
headers: { Authorization: `Bearer ${expiredToken}` }
});
expect(response.status).toBe(401);
});
it('should prevent brute force attacks', async () => {
const attempts = [];
for (let i = 0; i < 10; i++) {
attempts.push(
api.post('/api/auth/login', {
email: '[email protected]',
password: `wrong${i}`
})
);
}
const responses = await Promise.all(attempts);
const lastResponse = responses[responses.length - 1];
// Should be rate limited or account locked
expect([429, 423]).toContain(lastResponse.status);
});
});
describe('Security Tests: Authorization', () => {
it('should prevent horizontal privilege escalation', async () => {
// User A tries to access User B's data
const userAToken = await loginAs('[email protected]');
const userBId = 'user-b-id';
const response = await api.get(`/api/users/${userBId}`, {
headers: { Authorization: `Bearer ${userAToken}` }
});
expect(response.status).toBe(403);
});
it('should prevent vertical privilege escalation', async () => {
// Regular user tries to access admin endpoint
const userToken = await loginAs('[email protected]');
const response = await api.delete('/api/users/all', {
headers: { Authorization: `Bearer ${userToken}` }
});
expect(response.status).toBe(403);
});
it('should validate IDOR vulnerabilities', async () => {
// Try sequential IDs to access other users' resources
const userToken = await loginAs('[email protected]');
for (let id = 1; id <= 10; id++) {
const response = await api.get(`/api/orders/${id}`, {
headers: { Authorization: `Bearer ${userToken}` }
});
// Should only access own orders, not others
if (response.status === 200) {
expect(response.data.userId).toBe('current-user-id');
}
}
});
});
describe('Security Tests: CSRF Protection', () => {
it('should require CSRF token for state-changing operations', async () => {
const response = await api.post('/api/users/delete-account', {
userId: '123'
}, {
headers: { Authorization: `Bearer ${validToken}` }
// Missing CSRF token
});
expect(response.status).toBe(403);
});
});
describe('Security Tests: Security Headers', () => {
it('should include security headers', async () => {
const response = await api.get('/');
expect(response.headers['x-frame-options']).toBeDefined();
expect(response.headers['x-content-type-options']).toBe('nosniff');
expect(response.headers['strict-transport-security']).toBeDefined();
expect(response.headers['content-security-policy']).toBeDefined();
});
});
Security Test Report
====================
Date: 2025-10-11 14:30:00
Application: API v2.0
Tests Run: 87
Vulnerabilities Found: 5
CRITICAL (1):
SQL Injection in /api/users/search
Impact: Database access, data exfiltration
PoC: ?query=' OR '1'='1'--
Fix: Use parameterized queries
HIGH (2):
️ Missing authentication on /api/admin endpoints
Impact: Unauthorized admin access
Fix: Add authentication middleware
️ Weak password policy
Impact: Account takeover via brute force
Fix: Enforce 12+ char, complexity requirements
MEDIUM (2):
️ Missing rate limiting on login endpoint
Impact: Brute force attacks possible
Fix: Implement rate limiting (5 attempts/minute)
️ Verbose error messages expose stack traces
Impact: Information disclosure
Fix: Use generic error messages in production
PASSED TESTS (82):
XSS prevention working correctly
CSRF protection enabled
Authorization checks enforced
Security headers present
Session timeout configured
HTTPS enforced
Recommendations:
1. Prioritize SQL injection fix immediately
2. Implement authentication on admin endpoints
3. Add rate limiting to prevent brute force
4. Review and update password policy
5. Disable debug mode in production
Designs feature architectures by analyzing existing codebase patterns and conventions, then providing comprehensive implementation blueprints with specific files to create/modify, component designs, data flows, and build sequences