CyberAR | Blog

0-Click Account Takeover via Reset Password

Written by Abdelrahman Khaled | Oct 2, 2024 11:30:00 AM

During a pentesting engagement at Cyber AR, our team identified a critical vulnerability in a password reset flow that allowed an attacker to hijack any user’s account without needing the victim's interaction.

In today’s digital age, account security is paramount, but sometimes even simple flaws in password reset mechanisms can lead to devastating account takeovers. This 0-click exploit targets weak validation in password reset requests, allowing an attacker to manipulate data mid-process.

In this blog, we’ll walk through how this vulnerability works and how it can be exploited.

The Problem

On many platforms, when you forget your password, you’re prompted to reset it by receiving an email. This process typically involves securely linking the user requesting the reset with their account using tokens or other identifiers. However, when this process is poorly implemented, it opens the door to exploitation.

How the Exploit Works

Imagine the typical flow:

  1. Victim Request: The victim requests a password reset using their email. The server sends a request to reset their password, containing a UserId associated with their account.
  2. Attacker Request: Meanwhile, the attacker is resetting their own password, following the same flow and receiving an OTP (One-Time Password) to change their password.

Here’s where things get sneaky. The attacker intercepts their own password reset request and modifies it—changing the UserId and email in the payload to match the victim’s account. When the attacker submits this modified request, the system happily resets the victim’s password without any further verification.

This flaw happens because the server does not correctly validate who initiated the password reset request. It assumes that if the UserId matches, it’s legitimate, making it vulnerable to manipulation.

Step-by-Step Breakdown

Here’s a simplified view of how an attacker can hijack an account using this vulnerability:

  1. Victim’s Password Reset: The attacker begins by initiating a password reset for the victim’s account, capturing the UserId associated with the victim in the reset request.
  2. Attacker’s Password Reset: The attacker follows the normal password reset process for their own account and intercepts the request before it’s sent to the server.
  3. Modify the Request: The attacker modifies their intercepted request by swapping their UserId and email for the victim’s. This tricks the server into thinking that the password change is meant for the victim’s account.
  4. Password Change Complete: The server processes the request, resets the victim’s password to a new value set by the attacker, and the victim’s account is now compromised.

Impact

This is where things get serious. The attacker now has full access to the victim’s account, including any sensitive data or services linked to it. All of this happens without the victim’s knowledge. They could wake up one day, try to log in, and realize their password no longer works—and by then, it may be too late.

Preventing This Type of Attack

Now that you understand the mechanics of the exploit, the question becomes: how can platforms avoid this? The most straightforward solution is to ensure that password reset requests are strictly tied to the account that initiated them. Here are a few practices that can prevent this:

  1. Token-Based Validation: Instead of relying on UserId or email fields, password resets should be linked to unique, temporary tokens generated when the reset is requested.
  2. Account-Specific OTPs: OTPs should be tied to both the user requesting the reset and the device they’re using, making it much harder for an attacker to hijack the process.
  3. Strong Backend Validation: The server should validate that the email and UserId in the reset request correspond to the user who originally requested the reset.
  4. Monitoring: Alerting systems should be in place to flag multiple password reset requests or suspicious modifications during the process.

Conclusion

This 0-click account takeover vulnerability serves as a reminder that even seemingly minor flaws in user account security can have far-reaching consequences. By exploiting improper validation during the password reset flow, attackers can gain full control of accounts without needing the victim’s interaction. It highlights the need for strong, carefully designed security mechanisms around sensitive operations like password resets.

As always, it’s crucial to keep your systems up-to-date, perform regular security audits, and adopt best practices to safeguard user accounts from such vulnerabilities.