Detects OWASP A02 broken authentication vulnerabilities in login, session, password, JWT, OAuth, and MFA implementations. Flags weak password policies, session fixation, predictable tokens, and insecure storage.
Ships in owasp-guardian. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
OWASP numbering: "A02" is the OWASP Top 10:2017 category number. In the current OWASP Top 10:2025, this topic falls under A07:2025 Authentication Failures.
Identify and fix authentication vulnerabilities including weak passwords, session hijacking, and credential stuffing.
| Vulnerability | Risk | Impact |
|---|---|---|
| Weak password policy | HIGH | Easy brute force |
| No rate limiting | HIGH | Credential stuffing |
| Session fixation | HIGH | Account takeover |
| Insecure password storage | CRITICAL | Mass credential theft |
| Missing MFA | MEDIUM | Single point of failure |
| Predictable tokens | CRITICAL | Session hijacking |
// VULNERABLE - Plain text password storage
user.password = req.body.password;
await user.save();
// VULNERABLE - Weak hashing
const hash = md5(password);
const hash = sha1(password);
// VULNERABLE - No salt
const hash = bcrypt.hashSync(password); // Missing salt rounds
// VULNERABLE - Weak password policy
if (password.length >= 4) { // Too short!
// accept password
}
// VULNERABLE - Predictable session ID
const sessionId = `session_${Date.now()}`;
const sessionId = `user_${userId}`;
// VULNERABLE - Session in URL
res.redirect(`/dashboard?sessionId=${sessionId}`);
// VULNERABLE - No session expiry
req.session.cookie.maxAge = null; // Never expires
// VULNERABLE - Session not invalidated on logout
app.post('/logout', (req, res) => {
res.redirect('/login'); // Session still valid!
});
// VULNERABLE - No algorithm verification
const decoded = jwt.decode(token); // Doesn't verify!
// VULNERABLE - Weak secret
const token = jwt.sign(payload, 'secret123');
// VULNERABLE - Algorithm confusion
const decoded = jwt.verify(token, secret); // Accepts 'none' algorithm
// VULNERABLE - No expiration
const token = jwt.sign({ userId }, secret); // No exp claim
const bcrypt = require('bcrypt');
const SALT_ROUNDS = 12;
// Hash password
async function hashPassword(password) {
return bcrypt.hash(password, SALT_ROUNDS);
}
// Verify password
async function verifyPassword(password, hash) {
return bcrypt.compare(password, hash);
}
// Usage
const hashedPassword = await hashPassword(req.body.password);
user.password = hashedPassword;
await user.save();
# Python with argon2 (recommended)
from argon2 import PasswordHasher
ph = PasswordHasher()
# Hash
hashed = ph.hash(password)
# Verify
try:
ph.verify(hashed, password)
except VerifyMismatchError:
raise InvalidCredentials()
const passwordPolicy = {
minLength: 12,
requireUppercase: true,
requireLowercase: true,
requireNumbers: true,
requireSpecial: true,
preventCommon: true,
preventUserInfo: true
};
function validatePassword(password, userInfo = {}) {
const errors = [];
if (password.length < 12) {
errors.push('Password must be at least 12 characters');
}
if (!/[A-Z]/.test(password)) {
errors.push('Password must contain uppercase letter');
}
if (!/[a-z]/.test(password)) {
errors.push('Password must contain lowercase letter');
}
if (!/[0-9]/.test(password)) {
errors.push('Password must contain a number');
}
if (!/[!@#$%^&*(),.?":{}|<>]/.test(password)) {
errors.push('Password must contain a special character');
}
// Check against common passwords
if (COMMON_PASSWORDS.includes(password.toLowerCase())) {
errors.push('Password is too common');
}
// Check if contains user info
const userValues = Object.values(userInfo).map(v => v?.toLowerCase());
if (userValues.some(v => password.toLowerCase().includes(v))) {
errors.push('Password cannot contain personal information');
}
return { valid: errors.length === 0, errors };
}
const session = require('express-session');
const RedisStore = require('connect-redis').default;
app.use(session({
store: new RedisStore({ client: redisClient }),
secret: process.env.SESSION_SECRET, // Strong, random secret
name: '__Host-sessionId', // Secure cookie prefix
resave: false,
saveUninitialized: false,
cookie: {
secure: true, // HTTPS only
httpOnly: true, // No JavaScript access
sameSite: 'strict', // CSRF protection
maxAge: 3600000, // 1 hour
domain: 'example.com',
path: '/'
},
genid: () => crypto.randomUUID() // Cryptographically random
}));
// Regenerate session on login
app.post('/login', async (req, res) => {
const user = await authenticateUser(req.body);
// Regenerate session ID to prevent fixation
req.session.regenerate((err) => {
req.session.userId = user.id;
req.session.loginTime = Date.now();
res.redirect('/dashboard');
});
});
// Destroy session on logout
app.post('/logout', (req, res) => {
req.session.destroy((err) => {
res.clearCookie('__Host-sessionId');
res.redirect('/login');
});
});
const jwt = require('jsonwebtoken');
const JWT_CONFIG = {
secret: process.env.JWT_SECRET, // 256+ bit random string
algorithm: 'HS256',
expiresIn: '15m', // Short-lived access tokens
issuer: 'your-app',
audience: 'your-app-users'
};
// Generate token
function generateAccessToken(user) {
return jwt.sign(
{
sub: user.id,
email: user.email,
role: user.role
},
JWT_CONFIG.secret,
{
algorithm: JWT_CONFIG.algorithm,
expiresIn: JWT_CONFIG.expiresIn,
issuer: JWT_CONFIG.issuer,
audience: JWT_CONFIG.audience
}
);
}
// Verify token (with algorithm enforcement)
function verifyToken(token) {
return jwt.verify(token, JWT_CONFIG.secret, {
algorithms: [JWT_CONFIG.algorithm], // IMPORTANT: Whitelist algorithms
issuer: JWT_CONFIG.issuer,
audience: JWT_CONFIG.audience
});
}
// Refresh token (longer-lived, stored securely)
function generateRefreshToken(user) {
const token = crypto.randomBytes(64).toString('hex');
// Store in database with user association and expiry
return token;
}
const rateLimit = require('express-rate-limit');
// Login rate limiting
const loginLimiter = rateLimit({
windowMs: 15 * 60 * 1000, // 15 minutes
max: 5, // 5 attempts per window
message: 'Too many login attempts, please try again later',
standardHeaders: true,
legacyHeaders: false,
keyGenerator: (req) => req.body.email || req.ip, // Rate limit by email
handler: (req, res) => {
// Log failed attempts for monitoring
logger.warn('Rate limit exceeded', {
ip: req.ip,
email: req.body.email
});
res.status(429).json({ error: 'Too many attempts' });
}
});
app.post('/login', loginLimiter, loginHandler);
// Account lockout after repeated failures
async function handleFailedLogin(email) {
const key = `failed_login:${email}`;
const attempts = await redis.incr(key);
await redis.expire(key, 900); // 15 minutes
if (attempts >= 5) {
await lockAccount(email);
await sendLockoutNotification(email);
}
}
const speakeasy = require('speakeasy');
const qrcode = require('qrcode');
// Setup MFA
async function setupMFA(user) {
const secret = speakeasy.generateSecret({
name: `YourApp:${user.email}`,
length: 32
});
// Store secret (encrypted) in database
user.mfaSecret = encrypt(secret.base32);
user.mfaEnabled = false; // Enable after verification
await user.save();
// Generate QR code
const qrCodeUrl = await qrcode.toDataURL(secret.otpauth_url);
return { qrCodeUrl, manualKey: secret.base32 };
}
// Verify MFA token
function verifyMFA(user, token) {
const secret = decrypt(user.mfaSecret);
return speakeasy.totp.verify({
secret: secret,
encoding: 'base32',
token: token,
window: 1 // Allow 1 step tolerance
});
}
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
owasp, authentication, session-management, jwt, password-security, mfa
/owasp-guardian:broken-auth-detectorfrom owasp-guardian
npx claudepluginhub latestaiagents/agent-skills --plugin owasp-guardian4 plugins in one repository ship this exact skill · first indexed Nov 5, 2026
Other plugins' skills for the same job
10 skills in this plugin
/access-control-auditOWASP A05 - Broken Access Control Detection. Use this skill when implementing
authorization, checking permissions, or auditing who can access what resources.
Activate when: authorization, permissions, access control, RBAC, ABAC, admin access,
privilege escalation, IDOR, direct object reference, role check, can user access.
/dependency-vulnerabilityOWASP A09 - Using Components with Known Vulnerabilities. Use this skill when auditing
dependencies, updating packages, or reviewing security advisories. Activate when:
npm audit, dependency check, vulnerable package, CVE, security advisory, outdated
packages, supply chain, package vulnerability, Dependabot, Snyk.
/