Skip to content
Account takeover Disclosed report Intermediate

TOTP Authenticator implementation Accepts Expired Codes

The TOTP authenticator on hackerone.com accepted codes that were more than one minute old, instead of rejecting them after the usual 30-second window. An attacker who obtained a user's password and an old TOTP code could potentially reuse that expired code to complete two-factor authentication.

noob_but_cut3 Follow

Originally disclosed on HackerOne

High 7.2 View original
  • Disclosed after 4 days

Summary by the program

This report describes a vulnerability in the TOTP (Time-Based One-Time Password) authenticator implementation on hackerone.com. The researcher found that the system accepts expired TOTP codes, which reduces the effectiveness of the two-factor authentication mechanism. Specifically, the system allows using TOTP codes that are over 1 minute old, which is considered an insecure window of acceptance.

By accepting expired codes, an attacker could potentially reuse old TOTP codes to bypass the 2FA authentication, leading to unauthorized access. The researcher provided steps to reproduce the issue and suggested reducing the acceptance window to 30 seconds and implementing a more robust TOTP algorithm that rejects expired codes.

While the HackerOne team acknowledged the report, they stated that there doesn't appear to be a significant security risk or impact, as an attacker would still need the user's credentials and wouldn't be able to brute force the 6-digit TOTP code within 1 minute.

The report

Summary: Hi,

During testing hackerone.com, I discovered that the TOTP authenticator implementation accepts expired codes, allowing attackers to bypass authentication. This is a security vulnerability that reduces the effectiveness of the TOTP authentication mechanism.

Description:

TOTP (Time-Based One-Time Password) is a widely used authentication mechanism that generates a new password every 30 seconds. The password is valid for a short period, typically 30 seconds, before a new password is generated. This mechanism is designed to prevent attackers from using previously generated passwords.

During testing, I discovered that the TOTP authenticator implementation accepts expired codes, allowing attackers to bypass authentication. Specifically, I found that the authenticator accepts codes that are more than 1 minute old, which is considered a large window of acceptance. This vulnerability reduces the security benefits of TOTP, allowing attackers to reuse expired codes. This can lead to unauthorized access to the system, which can result in data breaches, financial losses, and reputational damage.

Steps To Reproduce

  1. Enable TOTP authentication for the account at hackerone.com with google authenticator.
  2. Log in to the tfa enabled account with correct password.
  3. When it comes to tfa state, save the current totp code from authenticator app.
  4. Wait for the code to expire (e.g., 1 minute).
  5. Submit the expired code to the authentication endpoint.
  6. Observe that the authentication is successful despite using an expired code.

Suggest Fix

  1. Reduce the window of acceptance to a more secure value (e.g., 30 seconds).
  2. Implement a more robust TOTP algorithm that rejects expired codes.

Optional: Supporting Material/References (Screenshots)

I have attached a POC video via google drive link cause it is over 250 mb.

https://drive.google.com/file/d/1onGsQvF-mmPXisjmxhkBbQUB4sbvoXz5/view?usp=sharing

Impact

The attacker can bypass the two factor authentication by using expired otp code.

The original report as published on HackerOne, by noob_but_cut3. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the TOTP verification allowed a time window larger than the standard 30 seconds, so codes remained valid after their normal expiry.

Impact

An attacker could bypass two-factor authentication by reusing an expired TOTP code, but only if they already had the user's credentials and obtained the old code; the site owners noted the code could not be brute-forced within one minute.

What the attacker needed

Attacker has the user's password; attacker has an old TOTP code; TOTP 2FA is enabled on the account

The fix

The acceptance window should be reduced to 30 seconds and the TOTP algorithm should reject expired codes; the text does not state that a fix was applied.

How it was found

  1. Enable TOTP authentication for the account with Google Authenticator.
  2. Log in with the correct password.
  3. At the two-factor prompt, save the current TOTP code.
  4. Wait for the code to expire (e.g., 1 minute).
  5. Submit the expired code to the authentication endpoint.
  6. Observe that authentication succeeds despite the expired code.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

Two-factor authentication (2FA) adds a second step to login, often a six-digit code from an app that changes every 30 seconds. This report says the site still accepted a code after it should have expired, so someone who saw an old code might be able to use it later. The site owners replied that an attacker would still need the password and could not guess the code in time, so they did not treat it as a serious risk.

What is Account takeover?

Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.

More by noob_but_cut3

View all

1 more disclosed report, best first.

More from HackerOne

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Account takeover

The lesson behind this report.

Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.