Welcome to the Architectural Crime Scene
Imagine you're a burglar (ethically, of course) trying to break into a building. You wouldn't just start kicking random walls - you'd study the blueprints, find the ventilation shafts, locate the security room, and map out escape routes. Web application architecture is your blueprint.
Understanding how web applications are built isn't just nice to have - it's essential. Every vulnerability exists because of an architectural decision. SQL injection? That's the database layer. XSS? That's the frontend. SSRF? That's the server making requests. Know the architecture, know where to attack.
How HTTP Works
Cookies and Sessions
The Three-Tier Architecture
Most web applications follow a three-tier (or three-layer) architecture. Think of it like a restaurant:
- Presentation Tier (Frontend) - The dining room where customers interact. This is what users see: HTML, CSS, JavaScript, React, Angular, etc.
- Application Tier (Backend) - The kitchen where orders are processed. This is where business logic lives: Python/Django, Node.js, PHP, Java, etc.
- Data Tier (Database) - The pantry/storage room. Where all the ingredients (data) are kept: MySQL, PostgreSQL, MongoDB, etc.
The Presentation Tier: Where XSS Lives
The frontend is everything that runs in the user's browser. It's responsible for displaying information and capturing user input. From a security perspective, it's both a target and a weapon.
Traditional vs Modern Frontends
Frontend Security Concerns
- XSS (Cross-Site Scripting) - Injecting malicious scripts that execute in users' browsers. See Related
XSS Fundamentals
- DOM Manipulation - Attackers can modify what users see or steal data through JavaScript
- Sensitive Data Exposure - API keys, credentials, or internal URLs hardcoded in JavaScript
- Client-Side Validation Bypass - Any validation in JavaScript can be bypassed by sending requests directly to the API
Finding Secrets in JavaScript
Modern web apps ship massive JavaScript bundles. These often contain secrets developers forgot to remove:
The Application Tier: Where the Magic (and Mayhem) Happens
The backend is the brain of the operation. It handles authentication, processes business logic, talks to databases, and integrates with external services. It's also where most critical vulnerabilities live.
Common Backend Technologies
Authentication & Session Management
The backend decides who you are (authentication) and what you can do (authorization). Common patterns include:
Authentication Attacks
Backend Attack Surfaces
- SQL Injection - When user input reaches database queries unsanitized
- Command Injection - When user input reaches shell commands
- SSRF - When the server can be tricked into making requests to internal resources
- XXE - When XML input is parsed with external entity processing enabled
- Deserialization - When untrusted data is deserialized
- SSTI - When user input reaches template engines
APIs: The New Attack Surface
Modern applications are API-driven. Instead of servers generating HTML, they expose APIs that frontends consume. This creates new opportunities for attackers.
REST APIs
RESTful APIs use standard HTTP methods to perform CRUD operations:
GraphQL APIs
GraphQL is a query language for APIs that lets clients request exactly what they need. It's powerful... and often misconfigured:
/graphql?query={__schema{types{name}}}API Documentation Discovery
Common API documentation endpoints to check:
The Data Tier: Where Your Prizes Live
The database holds everything valuable: user credentials, personal information, financial data, business secrets. It's the ultimate target, and it's protected by the application layer... hopefully.
Database Types and Their Vulnerabilities
SQL Injection Fundamentals
Infrastructure Components
Beyond the three tiers, modern applications have supporting infrastructure that can be exploited:
Reverse Proxies & Load Balancers
Caching Layers
Cloud Services
Mapping the Attack Surface
Before you start testing, map out what you're dealing with. Here's a systematic approach:
Attack Surface Discovery
- Check HTTP headers (Server, X-Powered-By)
- Look at cookies (PHPSESSID = PHP, JSESSIONID = Java)
- View page source for framework signatures
- Use Wappalyzer browser extension
- Spider the application with Burp Suite
- Check robots.txt, sitemap.xml
- Directory brute force (gobuster, dirsearch)
- Analyze JavaScript for API endpoints
- Look for API documentation (swagger, graphql)
- URL parameters (?id=123)
- POST body data
- HTTP headers (Host, Cookie, User-Agent, Referer)
- File uploads
- WebSocket messages
- Where does user input go?
- What processing happens?
- Where is data stored?
- Where is data reflected back?
- Authenticated vs unauthenticated areas
- Admin vs user functionality
- Internal vs external services
- Same-origin vs cross-origin
Practice Challenges
Knowledge Check
Key Takeaways
- Three-tier architecture (presentation, application, data) defines where different vulnerabilities occur
- Frontend security focuses on XSS and client-side data exposure; never trust client-side validation
- Backend security is where most critical vulns live: SQLi, command injection, SSRF, SSTI, deserialization
- APIs are the new attack surface - check for authentication, authorization, and exposed documentation
- Technology identification guides your testing - HTTP headers, cookies, and error messages reveal the stack
- Map the attack surface before testing: endpoints, input points, data flow, and trust boundaries