The one thing I am interested in is the reset-token value, since that allows me to reset the password of any user. The only thing that accepts user input is the username parameter when resetting the password.
Setting to administrator&1=1 results in this error:
If I just modify the username, then it will tell me its invalid.
So the & character is not parsed properly, and it is interpreted as including another POST parameter. Notice that there's a type of variable, meaning there's probably a parameter that IS supported and I can use to enumerate the types stored within this.
Fuzzing reveals that field is the parameter:
This returns a different response. Using this, I input the field as reset-token and reset_token. The latter returned a reset_token type:
Visiting the forget-password directory with the correct token lets me reset the password:
I can then login and solve the lab.
Lab 3: Undocumented API Endpoint
To solve this lab, buy the jacket. When viewing products, I noticed usage of an API:
The first lab used PATCH to change values, and I tried this here and it worked:
I can then reset the price of the first product to 0.
The jacket is then 'free'.
Lab 4: Mass Assignment
To solve this lab, buy the jacket. When trying to checkout to buy any product, there is a GET and POST request to /api/checkout proxied:
The POST request just has the chosen_products variable:
Since there's a chosen_discount variable, I just added that to the POST request:
To solve this lab, delete carlos as the administrator. There's a Forget Password feature for this lab:
As usual, there's a Javascript files used to process this:
Altering the username parameter with a # character results in a unique error:
'Invalid route' is interesting, and it may mean that the username parameter is a path used by the API. Playing around with this and ../ eventually results in this unique error:
So using 4 ../ means I have exited the API root. It keeps referring me to 'API documentation', and Portswigger academy does give me a few examples:
/api
/swagger/index.html
/openapi.json
Visiting ../../../../openapi.json reveals a new error:
There is one path variable which directs me to /api/internal/v1/users/{username}/field/{field}.
This is the same field variable as above. Additionally, the forgotpassword.js file uses a passwordResetToken variable. Attempting to visit /api using my browser doesn't work, meaning it might only be accessible on the backend via the username parameter.
Setting the username as ../../../../api/internal/v1/users/administrator/field/passwordResetToken works in retrieving the token:
Using the above, I can reset the password, login, and delete carlos.