Module 6: Cross-Site Scripting Exploitation and Case Study
Cross-Site Scripting - Exploitation
Accessing The Sandbox
Start your VPN, the VM, and add the VM's IP to your hosts file.
Moving the Payload to an External Resource
Serving xss.js
kali@kali:~$ mkdir xss
kali@kali:~$ cd xss
kali@kali:~/xss$ echo "alert(1)" > xss.js
kali@kali:~/xss$ python3 -m http.server 80
Serving HTTP on 0.0.0.0 port 80 (http://0.0.0.0:80/) ...


HTTP Server Logs
Stealing Session Cookies
Updating xss.js to exfiltrate the user's cookie

Empty data parameter in log

Cookie in HTTP log (Use Non-HttpOnly Cookie selected)
No Cookie in HTTP Log (Use HTTPOnly Cookie selected)
Stealing Local Secrets
Local storage is accessed by using the window.localStorage property, while session storage can be accessed with window.sessionStorage.
Exfiltrating storage

Contents of the localStorage
Keylogging
Keylogging payload in xss.js
Key Logging Search Application
Stealing Saved Passwords
Modifyin xss.js to steal passwords

Saved credentials exfiltrated

Phishing Users


Payload to Phish with Login Form

User Credentials in HTTP Logs
Creating xss.js as a login page due to no login page present
Exploiting innerHTML to execute our script
Case Study: Shopizer Reflected XSS
Getting Started
Start VPN, VMs, and add IP to hosts file. Register an account.
Discovering the Vulnerability


The loadCategoryProducts() function


JavaScript error message due to our single quote


Loading Remote Scripts


Creating a simple JS file

Base64-encoded payload



Updated Base64-encoded payload

Exploiting Reflected XSS


Sample POST request to add or update an address

Sample fetch() payload
Serving the JS file




HTTP Log Showing xss.js was Loaded


Last updated