![]() |
| Ethical Hacking |
🛡️ Ethical Hacking — Day 33
Web Application Security Testing Basics
⚠️ LEARNING PURPOSE ONLY: This tutorial is strictly for educational and defensive cybersecurity learning. Perform all practical exercises only on applications you own, intentionally vulnerable training applications, or systems where you have explicit authorization to test. Never test, exploit, or access another person's application or data without permission.
Welcome to Day 33 of the Ethical Hacking learning series.
After learning networking, authentication, access control, logging, and vulnerability assessment, we now begin a deeper look at web application security.
🎯 Day 33 Learning Objectives
By the end of today's tutorial, you will understand:
What a web application attack surface is
HTTP requests and responses
HTTP methods
URL parameters
Headers
Cookies
Sessions
Authentication
Authorization
Input validation
Output encoding
Security headers
Common OWASP security concepts
Burp Suite basics
Browser Developer Tools
Safe
curltestingLinux practical session
Windows practical session
macOS practical session
Laravel security considerations
Spring Boot security considerations
Professional web security testing methodology
1. What Is a Web Application?
A web application is software accessed through a web browser or HTTP client.
Examples include:
ERP systems
CRM systems
Banking applications
E-commerce applications
Dashboards
Social platforms
APIs
A basic architecture looks like:
┌─────────────┐
│ BROWSER │
└──────┬──────┘
│
│ HTTPS
▼
┌─────────────┐
│ WEB SERVER │
└──────┬──────┘
│
▼
┌─────────────┐
│ APPLICATION │
└──────┬──────┘
│
▼
┌─────────────┐
│ DATABASE │
└─────────────┘
Every layer needs appropriate security controls.
2. What Is the Web Application Attack Surface?
The attack surface is the collection of components that users or external systems can interact with.
Examples:
Login
Registration
Search
File Upload
API Endpoints
Profile
Payments
Admin Panel
Password Reset
Reports
Conceptually:
WEB APP
│
┌────────────┼────────────┐
▼ ▼ ▼
LOGIN SEARCH API
│ │ │
▼ ▼ ▼
SESSION INPUT DATA
The more functionality an application exposes, the more carefully its security should be designed.
3. HTTP Basics
HTTP is the protocol commonly used for web communication.
A simplified interaction:
CLIENT
│
│ HTTP REQUEST
▼
SERVER
│
│ HTTP RESPONSE
▼
CLIENT
Example request:
GET / HTTP/1.1
Host: localhost:8000
Example response:
HTTP/1.1 200 OK
Content-Type: text/html
4. HTTP Request Structure
A request may contain:
Method
URL / Path
Headers
Cookies
Body
Example:
POST /login HTTP/1.1
Host: localhost:8000
Content-Type: application/x-www-form-urlencoded
username=test
Understanding requests is fundamental to web security testing.
5. HTTP Response Structure
A response may contain:
Status Code
Headers
Cookies
Response Body
Example:
HTTP/1.1 200 OK
Content-Type: text/html
The response body may contain:
HTML
JSON
JavaScript
Images
Other resources
6. HTTP Methods
Common HTTP methods include:
| Method | Common Purpose |
|---|---|
GET | Retrieve information |
POST | Submit/create data |
PUT | Replace/update data |
PATCH | Partially update data |
DELETE | Delete a resource |
HEAD | Retrieve response headers |
The actual behavior should be determined by the application's API design.
7. GET Request
Example:
GET /products HTTP/1.1
Conceptually:
CLIENT
│
│ GET
▼
SERVER
│
▼
PRODUCT LIST
GET requests should generally be used for retrieval rather than state-changing operations.
8. POST Request
Example:
POST /users HTTP/1.1
A request body may contain data.
Conceptually:
CLIENT
│
│ POST DATA
▼
SERVER
│
▼
PROCESS DATA
Applications should validate and authorize submitted data.
9. HTTP Status Codes
Common status codes include:
200 → Success
201 → Created
301/302 → Redirect
400 → Bad Request
401 → Authentication required
403 → Forbidden
404 → Not Found
429 → Too Many Requests
500 → Server Error
Status codes provide useful information during testing.
10. URL Parameters
A URL can contain parameters.
Example:
/products?id=100
Here:
id=100
is a query parameter.
Applications should never assume that a supplied identifier automatically grants access.
Remember the lesson from Day 29:
IDENTIFIER
≠
AUTHORIZATION
11. Request Headers
Headers provide additional information about a request.
Examples include:
Host
User-Agent
Accept
Content-Type
Authorization
Cookie
Security testing often involves understanding how these values affect application behavior.
12. Response Headers
Important response headers may include:
Content-Type
Content-Security-Policy
Strict-Transport-Security
Set-Cookie
Referrer-Policy
X-Content-Type-Options
Reviewing headers can reveal configuration information and security controls.
13. Cookies
Cookies allow web applications to maintain information between requests.
Example:
Set-Cookie: session=example
Cookies may be used for:
Sessions
Preferences
Authentication state
Application settings
Sensitive cookies should be appropriately protected.
14. Secure Cookie Attributes
Important attributes include:
Secure
HttpOnly
SameSite
Conceptually:
SESSION COOKIE
│
├── Secure
├── HttpOnly
└── SameSite
The correct configuration depends on the application's architecture.
15. Sessions
A session connects multiple requests to an authenticated user.
Conceptually:
LOGIN
│
▼
SESSION CREATED
│
▼
SESSION IDENTIFIER
│
├── Request 1
├── Request 2
├── Request 3
└── Request 4
Session security is therefore extremely important.
16. Authentication
Authentication answers:
Who are you?
Examples:
Username + Password
MFA
Passkey
Security Key
But authentication alone is not enough.
17. Authorization
Authorization answers:
What are you allowed to do?
Example:
ADMIN
├── Manage Users
├── Manage Settings
└── View Reports
EMPLOYEE
└── View Own Data
A web application should enforce these rules on the server.
18. Input Validation
Applications receive input from users.
Examples:
Username
Email
Search query
Phone number
Address
File
API parameter
Never assume input is safe.
Conceptually:
USER INPUT
│
▼
VALIDATION
│
┌──┴──┐
▼ ▼
VALID INVALID
│ │
▼ ▼
PROCESS REJECT
19. Input Validation vs Output Encoding
These are related but different.
Input Validation
Ask:
Is this input acceptable for this field?
Example:
Age → Numeric range
Email → Valid email format
Output Encoding
Ask:
How should this data be safely displayed in this context?
Both are important security practices.
20. Never Trust Client Input
A browser can send requests directly.
Therefore:
Browser
│
▼
UNTRUSTED INPUT
│
▼
SERVER VALIDATION
│
▼
AUTHORIZED PROCESSING
Do not rely on:
Hidden HTML fields
Disabled buttons
JavaScript validation alone
Client-side role values
for security enforcement.
21. Server-Side Validation
Client-side validation is useful for user experience.
But the server must perform its own validation.
Example:
Browser Validation
+
Server Validation
=
Better Protection
Never assume the browser will always behave as expected.
22. OWASP Security Concepts
OWASP provides widely used guidance for web application security.
Important areas include:
Broken Access Control
Cryptographic Failures
Injection
Security Misconfiguration
Authentication Failures
Security Logging & Monitoring
These concepts should be understood as categories of risk rather than a checklist guaranteeing that an application is secure.
23. Injection — High-Level Concept
Injection vulnerabilities can occur when untrusted data is interpreted as instructions by another system.
Conceptually:
UNTRUSTED INPUT
│
▼
APPLICATION
│
▼
INTERPRETED AS CODE / QUERY
│
▼
UNEXPECTED BEHAVIOR
Defenses include:
Parameterized queries
Input validation
Output encoding
Safe APIs
Least privilege
For today's lab, we will focus on understanding the request flow rather than exploiting injection vulnerabilities.
24. Cross-Site Scripting — High-Level Concept
XSS is a class of web vulnerability involving unintended script execution in a user's browser.
Conceptually:
UNTRUSTED DATA
│
▼
WEB APPLICATION
│
▼
UNSAFE OUTPUT
│
▼
BROWSER
Defenses include:
Output encoding
Input handling
Content Security Policy
Safe templating
Use intentionally vulnerable training applications if you want to study exploitation techniques in a controlled environment.
25. CSRF — High-Level Concept
CSRF stands for:
Cross-Site Request Forgery
It can occur when a browser is induced to send an unwanted state-changing request while authenticated.
Conceptually:
USER
│
▼
AUTHENTICATED SESSION
│
▼
UNEXPECTED REQUEST
│
▼
APPLICATION
Common defenses include:
CSRF tokens
SameSite cookies
Origin / Referer checks where appropriate
26. File Upload Security
File uploads can create significant security risks.
An application should consider:
File type
File size
Filename
Storage location
Content validation
Permissions
Access controls
A secure architecture may look like:
UPLOAD
│
▼
VALIDATE
│
▼
SANITIZE
│
▼
STORE SAFELY
│
▼
CONTROL ACCESS
Do not test malicious file uploads against real systems without explicit authorization.
27. Security Headers
Review headers such as:
Content-Security-Policy
Strict-Transport-Security
X-Content-Type-Options
Referrer-Policy
Permissions-Policy
Security headers provide additional browser-level protections.
They do not replace secure application development.
28. Browser Developer Tools
Modern browsers provide Developer Tools.
Common sections include:
Elements
Console
Network
Application / Storage
Security
The Network panel is particularly useful for learning web application behavior.
Conceptually:
BROWSER
│
▼
NETWORK TAB
│
├── Request
├── Response
├── Headers
├── Cookies
└── Timing
29. Safe Browser Exercise
Use your own local application.
Open:
Developer Tools
→ Network
Then load:
http://127.0.0.1:8000
Observe:
Request URL
Method
Status
Response Headers
Request Headers
Timing
Do not inspect private sessions belonging to other users.
30. Linux Practical Session
Create a simple local web application.
mkdir -p ~/web-security-lab
cd ~/web-security-lab
Create a test page:
echo "<h1>Web Security Lab</h1>" > index.html
Start the server:
python3 -m http.server 8000
31. Linux — Inspect the Local Application
Open another terminal:
curl -I http://127.0.0.1:8000
Then:
curl -v http://127.0.0.1:8000/
Observe:
HTTP version
Status code
Response headers
Content type
Server behavior
32. Linux — Test Different HTTP Methods
You can safely inspect your local server's behavior.
For example:
curl -X GET -I http://127.0.0.1:8000/
And:
curl -X HEAD -I http://127.0.0.1:8000/
The objective is to understand HTTP methods.
Do not send destructive requests to systems you do not own.
33. Windows Practical Session
Create a lab directory:
mkdir "$HOME\web-security-lab"
cd "$HOME\web-security-lab"
Create a page:
"<h1>Web Security Lab</h1>" | Out-File index.html
Start the local server:
python -m http.server 8000
34. Windows — Inspect Headers
Open another PowerShell window:
curl.exe -I http://127.0.0.1:8000
For verbose output:
curl.exe -v http://127.0.0.1:8000/
Observe:
Status
Headers
Content-Type
Connection behavior
35. macOS Practical Session
Create the lab:
mkdir -p ~/web-security-lab
cd ~/web-security-lab
Create a page:
echo "<h1>Web Security Lab</h1>" > index.html
Start the server:
python3 -m http.server 8000
36. macOS — Inspect Headers
Open another Terminal window:
curl -I http://127.0.0.1:8000
Verbose:
curl -v http://127.0.0.1:8000/
Record the response.
37. Cross-Platform Comparison
| Task | Linux | Windows | macOS |
|---|---|---|---|
| Start local server | python3 -m http.server 8000 | python -m http.server 8000 | python3 -m http.server 8000 |
| Check headers | curl -I | curl.exe -I | curl -I |
| Verbose request | curl -v | curl.exe -v | curl -v |
The security concepts remain the same across platforms.
38. Burp Suite Basics
Burp Suite is commonly used for authorized web security testing.
A simplified workflow:
BROWSER
│
▼
BURP PROXY
│
▼
WEB APPLICATION
Burp can help you inspect:
Requests
Responses
Headers
Cookies
Parameters
HTTP methods
39. Safe Burp Lab
Use your local application:
http://127.0.0.1:8000
Configure your browser to use Burp as a proxy.
Then:
Open Proxy
↓
HTTP History
↓
Select Request
↓
Inspect Request
↓
Inspect Response
Your goal is to understand the HTTP conversation.
40. Burp Request Analysis
For each request, identify:
METHOD:
GET / POST / etc.
PATH:
________________
HOST:
________________
PARAMETERS:
________________
HEADERS:
________________
COOKIES:
________________
RESPONSE:
________________
Do not replay or modify requests against unauthorized targets.
41. Safe Parameter Exercise
Create a local test URL:
http://127.0.0.1:8000/?name=test
Use:
curl "http://127.0.0.1:8000/?name=test"
Now inspect the request in Burp or browser Developer Tools.
The goal is to understand:
URL
↓
QUERY PARAMETER
↓
SERVER
↓
RESPONSE
42. Understanding Request Modification
In an authorized local lab, changing a harmless parameter can help you understand how applications process input.
Example:
name=test
to:
name=student
Observe how the request changes.
Do not use this technique to bypass authorization or manipulate another user's data.
43. Laravel Web Security
For Laravel applications, review:
Authentication
Authorization
CSRF protection
Validation
Mass assignment protection
Secure sessions
Rate limiting
File uploads
Error handling
Security headers
Laravel's framework security features should be used rather than reinvented.
44. Laravel Validation
A typical Laravel application should validate incoming data before processing it.
Conceptually:
REQUEST
│
▼
VALIDATION
│
┌─┴─┐
▼ ▼
VALID INVALID
│ │
▼ ▼
PROCESS REJECT
Validation rules should match the application's business requirements.
45. Laravel Mass Assignment
When accepting structured user input, developers must carefully control which model attributes can be assigned.
Do not blindly trust:
All request fields
Instead, explicitly define which fields are allowed.
This is an important application-level access control consideration.
46. Spring Boot Web Security
For Spring Boot applications, review:
Spring Security
Authentication
Authorization
CSRF
Input validation
Session management
CORS
Security headers
Error handling
API security
Each setting should be configured according to the application's architecture.
47. CORS — High-Level Concept
CORS stands for:
Cross-Origin Resource Sharing
It controls which browser origins may interact with certain resources.
Conceptually:
ORIGIN A
│
│ Request
▼
SERVER
│
▼
CORS POLICY
│
┌──┴──┐
▼ ▼
ALLOW DENY
Avoid configuring permissive cross-origin access without understanding the security implications.
48. API Security
Modern web applications often expose APIs.
Example:
GET /api/users
POST /api/orders
GET /api/reports
API security should include:
Authentication
Authorization
Input validation
Rate limiting
Secure transport
Error handling
Logging
Never assume that because an API is not visible in the user interface, it is protected.
49. Web Application Testing Methodology
A professional workflow is:
1. GET AUTHORIZATION
↓
2. DEFINE SCOPE
↓
3. MAP APPLICATION
↓
4. IDENTIFY ENDPOINTS
↓
5. UNDERSTAND AUTHENTICATION
↓
6. REVIEW AUTHORIZATION
↓
7. REVIEW INPUT HANDLING
↓
8. REVIEW SESSION SECURITY
↓
9. REVIEW CONFIGURATION
↓
10. DOCUMENT FINDINGS
↓
11. REMEDIATE
↓
12. VERIFY
50. Web Application Security Checklist
☐ HTTPS configured
☐ Authentication protected
☐ Authorization enforced server-side
☐ Session cookies protected
☐ CSRF protections reviewed
☐ Input validated
☐ Output safely encoded
☐ File uploads restricted
☐ API endpoints protected
☐ Rate limiting considered
☐ Security headers reviewed
☐ Error messages controlled
☐ Sensitive data protected
☐ Logging configured
☐ Dependencies updated
51. Common Web Security Mistakes
❌ Mistake 1 — Trusting the Browser
The browser is controlled by the user.
Always validate important data server-side.
❌ Mistake 2 — Hiding Sensitive Functions
Hiding an admin button does not protect the underlying endpoint.
❌ Mistake 3 — Missing Authorization Checks
Every sensitive resource and action should have appropriate authorization.
❌ Mistake 4 — Poor Session Security
Authentication sessions must be appropriately protected.
❌ Mistake 5 — Accepting Unlimited Input
Applications should define reasonable validation and size limits.
❌ Mistake 6 — Overly Permissive CORS
Allow only the origins and methods required by the application.
❌ Mistake 7 — Trusting Scanner Results Blindly
Tools help identify potential issues, but findings require human review.
52. Day 33 Main Practical Challenge
Use your own local web server.
Step 1 — Start Your Lab
Linux/macOS
python3 -m http.server 8000
Windows
python -m http.server 8000
Step 2 — Inspect the Response
curl -I http://127.0.0.1:8000
Step 3 — Open Browser Developer Tools
Go to:
Network
Visit:
http://127.0.0.1:8000
Record:
Request Method
Request URL
Status Code
Response Headers
Content-Type
Step 4 — Use Burp Suite
Capture the same request in your local lab.
Compare:
Browser
↓
Burp
↓
Local Server
Step 5 — Document
Create:
APPLICATION:
Web Security Lab
HOST:
127.0.0.1
PORT:
8000
METHOD:
________________
STATUS:
________________
CONTENT-TYPE:
________________
SECURITY HEADERS:
________________
COOKIES:
________________
OBSERVATIONS:
________________
53. Day 33 Professional Challenge
Create a basic security review for your own web application.
Review these areas:
1. Authentication
2. Authorization
3. Sessions
4. Input validation
5. File uploads
6. API endpoints
7. Security headers
8. Error handling
9. Logging
10. Dependencies
For each item, record:
CURRENT STATE
↓
POTENTIAL RISK
↓
RECOMMENDED IMPROVEMENT
📝 Day 33 Assignment
Answer the following questions:
What is a web application?
What is a web application's attack surface?
What is HTTP?
What is an HTTP request?
What is an HTTP response?
What are HTTP methods?
What is the purpose of GET?
What is the purpose of POST?
What are HTTP status codes?
What are request headers?
What are response headers?
What are cookies?
What is session management?
What is authentication?
What is authorization?
Why should server-side validation be used?
What is output encoding?
What is CSRF?
What is XSS at a high level?
What is CORS?
Why is file upload security important?
What is Burp Suite used for?
How can browser Developer Tools help security learning?
Why should APIs be protected?
Why should web security testing be performed only with authorization?
🏆 Day 33 Golden Rules
Rule 1
The browser is untrusted.
Rule 2
Validate important data on the server.
Rule 3
Authentication does not automatically provide authorization.
Rule 4
Protect sessions and authentication cookies.
Rule 5
Every sensitive endpoint needs appropriate authorization.
Rule 6
Security headers are defense-in-depth controls.
Rule 7
APIs require the same security attention as web pages.
Rule 8
Always test web applications only within your authorized scope.
📚 Day 33 Summary
Today you learned:
Web application fundamentals
Web application attack surface
HTTP requests and responses
HTTP methods
Status codes
Headers
Cookies
Sessions
Authentication
Authorization
Input validation
Output encoding
OWASP security concepts
Injection concepts
XSS concepts
CSRF concepts
File upload security
CORS
API security
Browser Developer Tools
Burp Suite basics
Linux practical session
Windows practical session
macOS practical session
Laravel security considerations
Spring Boot security considerations
Professional web application testing methodology
🔑 Most Important Lesson
Web application security is not about finding one magic vulnerability.
Think about the entire request lifecycle:
USER
↓
BROWSER
↓
HTTP REQUEST
↓
WEB SERVER
↓
APPLICATION
↓
AUTHENTICATION
↓
AUTHORIZATION
↓
INPUT VALIDATION
↓
BUSINESS LOGIC
↓
DATABASE
↓
HTTP RESPONSE
↓
BROWSER
Every step should be designed and tested securely.
🛡️ LEARN → MAP → TEST SAFELY → VERIFY → FIX → DEFEND
🔜 Day 34 — OWASP Injection & Secure Input Handling
Next we will study:
What injection vulnerabilities are
SQL injection concepts
Command injection concepts
LDAP injection concepts
Why injection happens
Parameterized queries
Input validation
Output encoding
Safe SQL examples
Laravel Eloquent/query builder protections
Spring Data/JPA protections
Linux practical session
Windows practical session
macOS practical session
Safe localhost testing
⚠️ LEARNING PURPOSE ONLY: Day 34 practical exercises will use safe, local examples and intentionally vulnerable training environments. Do not test injection techniques against real systems without explicit authorization.

No comments:
Post a Comment