Thanks a lot for the help! It looks like I'll have to do more research into how csrf tokens are usually used.
Here's the solution in case anyone else runs into the problem:
- After you find out the 2FA code, the server will no longer accept any more requests with the csrf you have been using.
- Log back in to the website wit the provided credentials (user: wiener, pass: peter)
- Turn on "Set break on all requests and responses"
- Type in the 2FA code you found earlier and submit
- Change the verify header to "carlos"
- Click "Submit and continue to next breakpoint"
- (To finish the lab, go to your browser and click on My Account)
Why I think this works (may be wrong):
When the GET request is sent to the login2 endpoint, the server responds with the HTML for the 2FA webpage (which is where you enter the 4 digit code). On the webpage is a hidden input field for the csrf token (which has a value provided by the server in the response). This token gets invalidated when the correct 2FA code is sent to the server in a POST request on the login2 endpoint. Logging in again as wiener/peter sends a GET request to the login2 endpoint, providing you with a new, valid csrf token that you can then use to send in the 2FA code to log in to carlos' account.
I also imagine that instead of logging in again, I could have just resent the initial GET request (to login2) that was sent when I initially logged in, which would also provide me with a new csrf token to use (if i just Ctrl + F for "csrf" in the response and find the value), and then modified the csrf token in the request (from the Fuzzer) that initially found the right 2FA code and sent that.
Big thanks, Simon!
- Merrick