A06: Insecure Design
Insecure design focuses on risks related to design and architectural flaws. A secure implementation cannot fix an insecure design. This includes missing threat modeling, insecure design patterns, and insufficient security requirements.
Key Vulnerabilities
Missing or inadequate threat modeling during design phase
Business logic flaws that cannot be fixed by secure coding alone
Missing rate limiting on sensitive operations
Not following secure design patterns and principles
Insufficient security requirements gathering
Trust boundaries not properly defined
Prevention Strategies
Establish a secure development lifecycle with AppSec professionals
Use threat modeling for authentication, access control, and business logic
Write unit and integration tests for security requirements
Use design patterns from trusted libraries
Limit resource consumption per user or service
Separate tiers based on exposure and protection needs
Real-World Example
A cinema chain allowed bulk ticket booking with no rate limiting. Scalpers wrote bots to buy all tickets within seconds of release, denying legitimate customers access.
Code Comparison
// INSECURE DESIGN: No rate limit on password reset
app.post('/api/reset-password', (req, res) => {
const { email } = req.body;
sendResetEmail(email); // Can be called unlimited times
res.json({ success: true });
});
// Attacker can flood any email with reset requests// SECURE DESIGN: Rate limited + verification
const rateLimit = require('express-rate-limit');
const resetLimiter = rateLimit({
windowMs: 15 * 60 * 1000, // 15 minutes
max: 3, // max 3 requests per window
message: 'Too many reset attempts'
});
app.post('/api/reset-password', resetLimiter, (req, res) => {
// Additional: verify CAPTCHA, log attempts
});