Opening Framing: The Web's Trust Problem
Web applications are built on a fundamental architectural challenge: the client cannot be trusted. Browsers, HTTP requests, cookies, form data—all of it can be manipulated by attackers. Yet applications must accept input to function.
This tension between usability and security creates vulnerabilities. SQL injection happens because user input becomes part of database queries. XSS happens because user input becomes part of web pages. The root cause is always the same: trusting untrusted data.
This week establishes the foundation for web application security testing. You'll understand how web applications work at a deep level, learn the security testing methodology, and set up your testing environment.
Key insight: Most web vulnerabilities exist because developers didn't fully understand what attackers could control.
1) Web Application Architecture
Understanding how web apps work is essential for testing them:
Three-Tier Architecture:
┌─────────────────┐
│ Presentation │ ← Browser, HTML, CSS, JavaScript
│ (Client) │ Attacker controls this entirely
└────────┬────────┘
│ HTTP/HTTPS
▼
┌─────────────────┐
│ Application │ ← Web server, application logic
│ (Server) │ Processes requests, enforces rules
└────────┬────────┘
│ SQL, API calls
▼
┌─────────────────┐
│ Data │ ← Databases, file systems
│ (Backend) │ Stores sensitive information
└─────────────────┘
Client-Side vs Server-Side:
Client-Side (Browser):
- HTML rendering
- CSS styling
- JavaScript execution
- Cookie storage
- Form validation (easily bypassed!)
- Local storage
⚠️ Everything client-side can be manipulated!
Server-Side (Web Server):
- Request processing
- Authentication/authorization
- Business logic
- Database queries
- Session management
- Input validation (this is where it matters)
Security controls MUST be server-side.
Modern Web Application Components:
Frontend:
- Single Page Applications (SPA)
- React, Angular, Vue.js
- Mobile apps using same backend
Backend:
- REST APIs
- GraphQL
- Microservices
- Serverless functions
Data Storage:
- Relational databases (MySQL, PostgreSQL)
- NoSQL (MongoDB, Redis)
- Object storage (S3)
- Caching layers
Infrastructure:
- Load balancers
- CDNs
- Web Application Firewalls (WAF)
- API Gateways
Key insight: Modern applications are complex, with many components that can be vulnerable. Testing requires understanding the entire stack.
2) HTTP Protocol Deep Dive
HTTP is the language of web applications:
HTTP Request Structure:
POST /api/login HTTP/1.1 ← Method, Path, Version
Host: example.com ← Required header
User-Agent: Mozilla/5.0... ← Browser identification
Content-Type: application/json ← Body format
Content-Length: 42 ← Body size
Cookie: session=abc123 ← Session data
Authorization: Bearer xyz ← Auth credentials
{"username":"admin","password":"secret"} ← Request body
HTTP Methods:
GET - Retrieve data (parameters in URL)
POST - Submit data (parameters in body)
PUT - Update/replace resource
PATCH - Partial update
DELETE - Remove resource
OPTIONS- Check allowed methods (CORS preflight)
HEAD - GET without body (metadata only)
TRACE - Echo request (often disabled, XST attacks)
Security implications:
- GET requests logged in URLs, browser history
- POST can still be intercepted
- PUT/DELETE often not protected
- OPTIONS reveals allowed methods
HTTP Response Structure:
HTTP/1.1 200 OK ← Status code
Server: nginx/1.19 ← Server info (fingerprint!)
Content-Type: text/html; charset=utf-8
Set-Cookie: session=xyz; HttpOnly; Secure
X-Frame-Options: DENY ← Security header
Content-Security-Policy: default-src 'self'
<!DOCTYPE html>... ← Response body
Important Status Codes:
200 OK - Success
201 Created - Resource created
301/302 - Redirect (follow for open redirect vulns)
400 Bad Request - Client error
401 Unauthorized - Authentication required
403 Forbidden - Authorization denied (but resource exists!)
404 Not Found - Resource doesn't exist (or hidden)
405 Method Not Allowed
500 Internal Server Error - Server-side bug (interesting!)
502/503 - Backend issues
Security testing tip:
- 403 vs 404 can reveal resource existence
- 500 errors often leak information
- Different responses = enumeration opportunity
Security Headers:
Content-Security-Policy (CSP):
- Controls what content can load
- Mitigates XSS
X-Frame-Options:
- Prevents clickjacking
- DENY or SAMEORIGIN
X-Content-Type-Options: nosniff
- Prevents MIME sniffing
Strict-Transport-Security (HSTS):
- Forces HTTPS
- Prevents downgrade attacks
X-XSS-Protection:
- Legacy XSS filter (mostly deprecated)
Referrer-Policy:
- Controls Referer header leakage
Missing headers = potential vulnerabilities!
Key insight: Every part of an HTTP request can be manipulated by an attacker. Every part of a response can leak information.
3) The OWASP Top 10
The industry standard for web application risks:
OWASP Top 10 (2021):
A01: Broken Access Control (moved up from #5)
- IDOR, privilege escalation
- Missing function-level access control
- 94% of applications tested had some form
A02: Cryptographic Failures (was Sensitive Data Exposure)
- Weak encryption, missing encryption
- Exposed credentials, keys
A03: Injection
- SQL, NoSQL, OS command, LDAP
- Still prevalent despite being well-known
A04: Insecure Design (NEW)
- Design flaws, not implementation bugs
- Threat modeling failures
A05: Security Misconfiguration
- Default configs, verbose errors
- Missing hardening, unnecessary features
A06: Vulnerable and Outdated Components
- Known CVEs in libraries
- Unmaintained dependencies
A07: Identification and Authentication Failures
- Weak passwords, credential stuffing
- Session management issues
A08: Software and Data Integrity Failures (NEW)
- Insecure deserialization
- CI/CD pipeline attacks
A09: Security Logging and Monitoring Failures
- Insufficient logging
- No alerting on attacks
A10: Server-Side Request Forgery (NEW)
- SSRF attacks
- Cloud metadata access
Testing Each Category:
This course covers testing for all OWASP Top 10:
Week 3-4: A07 (Authentication/Sessions)
Week 5: A03 (SQL Injection)
Week 6: A03 (XSS)
Week 7: A01 (Access Control), A04 (Insecure Design)
Week 8: A03 (Other Injection)
Week 9: A08, A10 (Deserialization, SSRF)
Week 10: A01, A03 (API-specific)
Week 11: A06 (Components)
A02, A05, A09 covered throughout.
Key insight: The OWASP Top 10 isn't a checklist—it's a prioritized awareness document. Real testing goes deeper.
4) Web Application Security Testing Methodology
A systematic approach to finding vulnerabilities:
OWASP Testing Guide Methodology:
Phase 1: Information Gathering
├── Passive reconnaissance
├── Application mapping
├── Technology fingerprinting
└── Entry point identification
Phase 2: Configuration Testing
├── Network configuration
├── Platform configuration
├── File extension handling
├── Backup files
└── HTTP methods
Phase 3: Identity Management
├── User registration
├── Account provisioning
├── Account enumeration
└── Password policies
Phase 4: Authentication Testing
├── Credential transport
├── Default credentials
├── Lockout mechanisms
├── Bypass methods
└── Password recovery
Phase 5: Authorization Testing
├── Directory traversal
├── Access control bypass
├── Privilege escalation
└── IDOR
Phase 6: Session Management
├── Session token analysis
├── Cookie attributes
├── Session fixation
├── CSRF
Phase 7: Input Validation
├── XSS
├── SQL injection
├── Other injection
├── File upload
└── HTTP splitting
Phase 8: Error Handling
├── Error codes
├── Stack traces
└── Information leakage
Phase 9: Cryptography
├── Weak SSL/TLS
├── Sensitive data transmission
└── Weak algorithms
Phase 10: Business Logic
├── Workflow bypass
├── Data validation
└── Trust boundaries
Phase 11: Client-Side
├── DOM-based XSS
├── JavaScript analysis
├── HTML5 security
└── Clickjacking
Testing Mindset:
Think like an attacker:
1. What does this application do?
2. What data does it handle?
3. Who are the users?
4. What could go wrong?
For every feature, ask:
- What input does this accept?
- Where does that input go?
- What happens if I change it?
- What happens if I break it?
For every request, consider:
- Can I change the method?
- Can I modify parameters?
- Can I access other users' data?
- Can I bypass controls?
Key insight: Methodology ensures comprehensive coverage. Without it, you'll miss vulnerabilities.
5) Burp Suite Mastery Setup
Burp Suite is your primary testing tool:
Burp Suite Configuration:
1. Proxy Setup
- Proxy → Options → Proxy Listeners
- Default: 127.0.0.1:8080
- Install CA certificate in browser
2. Scope Configuration
- Target → Scope → Add target
- Filter proxy history to scope
- Prevents testing out-of-scope sites
3. Project Options
- Save project for continuity
- Configure session handling
- Set up macros for auth
Essential Burp Features:
Proxy:
- Intercept and modify requests
- History of all traffic
- WebSocket support
Target:
- Site map visualization
- Scope management
- Issue tracking
Intruder:
- Automated attacks
- Parameter fuzzing
- Brute forcing
- Credential stuffing
Repeater:
- Manual request modification
- Rapid testing
- Response comparison
Scanner (Pro):
- Automated vulnerability detection
- Crawling
- Active and passive scanning
Decoder:
- Encode/decode data
- Hash recognition
- Smart decode
Comparer:
- Response diff
- Find subtle changes
Sequencer:
- Token randomness analysis
- Session token quality
Extender:
- BApp Store plugins
- Custom extensions
Essential Extensions:
Install from BApp Store:
Authentication:
- AuthMatrix - Authorization testing
- Auth Analyzer - Session analysis
Detection:
- Param Miner - Hidden parameter discovery
- Backslash Powered Scanner - Edge cases
- Software Vulnerability Scanner
Productivity:
- Logger++ - Enhanced logging
- Turbo Intruder - Fast fuzzing
- Copy As Python-Requests
- JSON Beautifier
- Hackvertor - Encoding/decoding
Specialized:
- JWT Editor - Token manipulation
- GraphQL Raider - GraphQL testing
- SAML Raider - SAML testing
- Autorize - Access control testing
Key insight: Master your tools. Efficiency in Burp Suite multiplies your testing effectiveness.
Real-World Context: Web App Security Today
The web application threat landscape:
Attack Trends: Web applications remain the primary attack vector. API attacks are increasing rapidly. Client-side attacks (XSS, prototype pollution) are evolving. Supply chain attacks target JavaScript dependencies.
Defense Evolution: WAFs are more sophisticated but bypassable. Content Security Policy adoption is growing but often misconfigured. Modern frameworks have built-in protections that developers sometimes disable.
Bug Bounty Impact: Bug bounty programs have raised the bar. Low-hanging fruit is often found quickly. Valuable findings require deep understanding and creativity.
MITRE ATT&CK Mapping:
- T1190 - Exploit Public-Facing Application: Web exploitation
- T1059.007 - JavaScript: Client-side attacks
- T1071.001 - Web Protocols: C2 via HTTP
Key insight: Web security is an arms race. Attackers and defenders constantly evolve. Staying current is essential.
Guided Lab: Environment Setup
Set up your web application testing environment.