1. Lab: CORS vulnerability with basic origin reflection
This website has an insecure CORS configuration in that it trusts all origins.
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
If we check the requests while login, we will see it is getting the API Key from /accountDetails.

Now, changing Origin to example.com will reflect in response, that means, it is vulnerable to CORS. So, we will try a exploit script, there it will send the response to our server, in this case, exploit server.
|
|

Solution: after sending this exploit to victim, you will get the key in “Access Logs” page, and lastly, in order to solve the lab, you have to submit the key.
2. Lab: CORS vulnerability with trusted null origin
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
Let’s check the it the origin is reflected in response.

It doesn’t. Let’s check if null value is reflected or not in response.

Yes, it does. Alright, so we will use iframe payload in order to solve this lab.
|
|
solution: send this payload and get API key in logs, by submitting API key, it will solve the lab.
3. Lab: CORS vulnerability with trusted insecure protocols
This website has an insecure CORS configuration in that it trusts all subdomains regardless of the protocol.
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
Firstly, I have checked if https://example.com or null is getting reflected in response, but it doesn’t. Next thing I have tried is to send subdomain, it worked actually. So I have tried to find the other subdomain by checking the functionality of the website. In stock of product page, we can see it is having stock as subdomain. Let’s see what happens if we tweak the value.

We can see we are getting XSS. We can leverage this XSS to get sensitive info using CORS.
|
|
making the payload one liner and encode necessary characters like + sign and < of ending script in order to make it work.
|
|
Solution: Submit the payload, get the api key and submit the key in order to solve the lab.