HomeTopicsA06 Insecure Design
Lesson 6 / 10

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

1

Missing or inadequate threat modeling during design phase

2

Business logic flaws that cannot be fixed by secure coding alone

3

Missing rate limiting on sensitive operations

4

Not following secure design patterns and principles

5

Insufficient security requirements gathering

6

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

Vulnerable Code
// 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 Code
// 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
});