Password reset poisoning via middleware
Last updated
Was this helpful?
Last updated
Was this helpful?
After logging in with our account (wiener:peter
), we navigate to the password reset functionality. By entering our username or email,
Visiting our Email client, we receive an email containing a link with a temp-forgot-password-token
parameter. We find a password reset email. The reset link contains a temp-forgot-password-token
that appears to be unique for each request. Observing this behavior confirms that we need to manipulate this token.
We inspect the POST
request sent when initiating a password reset. In this request, the server generates a link using the Host header. We hypothesize that using the X-Forwarded-Host
header will allow us to overwrite the default host with our exploit server's address.
Upon sending this modified request, we receive a 200 OK
response, indicating that the server accepted our header.
Return to the email client. You will now see a password reset link that includes your exploit server URL instead of the original application URL.
After clicking on the reset link, returning to our exploit server logs, we see a GET
request containing the reset link directed to our exploit server. This proves that the server has been successfully manipulated.
Now our next step is to request a token for carlos, to do that we just need to change our username with his
Next, we repeat the process but change the username in the request body to carlos
. This modification causes the server to generate a reset link for Carlos, which is redirected to our exploit server.
We extract Carlos's temp-forgot-password-token
from the logs.
Using the password reset link, we enter a new password for Carlos.
Intercepting the request in Burp Suite, we replace the original token with Carlos's token and send the modified request.
The server processes the request successfully, updating Carlos's password.
We use Carlos's username and the newly set password to log into his account. Once logged in, we verify our success by viewing his account details.