Python - XSS-DOM-2
Running the app on Docker
Now that the app is running let's go hacking!
Reconnaissance
Step 1
The application shows no input field or anything else we can interact with. Let's inspect the source code.
Inspecting the source code of the application.
We notice the application imports javascript files into the application using this function.
Declaring endpoint variable which takes the url, whatever is after the hash(#) and using slice to remove the first 4 characters after that. If the endpoint exists it will load the js file from there.
Exploitation
We can start building our malicious server and server the application with our malicious js file.
Save the snippet above to > evil_server.py and run the commands below to install some dependencies. Of course you can also run your app on whatever service you want it does not have to be python flask.
Now we need to create our malicous js file, save the following snippet code into /static/js/welcome.js
We are ready to start our server:
Now we can serve our malicious js file to the application
Additional sources
Please refer to the OWASP testing guide for a full complete description about cross site scripting!
Last updated