TL;DR
Yes, counter-based One-Time Passwords (OTPs) can be instantly reused at multiple services if the seed is compromised or shared. This is a significant security risk. Services should independently manage seeds and enforce rate limiting to mitigate this.
Understanding Counter-Based OTPs
Counter-based OTPs (like those generated by TOTP – Time-based One-Time Password algorithms) rely on a shared secret (the ‘seed’) and a counter. The counter increases with each password generated. Both the service provider and your authenticator app use the same seed to calculate the same OTP at roughly the same time.
Why Reuse is Possible
- Shared Seed: If multiple services use the same seed for a user, they will generate identical OTPs.
- Instant Generation: Authenticator apps can generate OTPs very quickly. If a service doesn’t properly limit how often an OTP is accepted, it’s possible to try many codes in rapid succession.
Step-by-Step Mitigation Guide
- Independent Seed Management: Each service must generate and store its own unique seed for each user. Do not share seeds between services. This is the most important step. When a user adds an account to a new service, that service should create a new secret key specifically for that account.
- Rate Limiting: Implement strict rate limiting on OTP acceptance.
- Limit the number of attempts per user within a short timeframe (e.g., 5 attempts in 1 minute).
- Consider IP-based rate limiting as an additional layer, but be aware this can affect legitimate users sharing IPs.
- Time Drift Tolerance: Account for slight time differences between the server and the user’s device.
# Example Python (using a library like pyotp) import pyotp secret = 'YOUR_SECRET_KEY' totp = pyotp.TOTP(secret) # Allow OTPs generated within a small window around the current time drift_window = 30 # Seconds for i in range(-drift_window, drift_window + 1): time_offset = i otp = totp.now(time_offset) print(f"OTP for offset {time_offset}: {otp}") - Server-Side Validation: Always validate the OTP on the server-side. Never rely solely on client-side validation, as this can be easily bypassed.
- Seed Storage Security: Protect user seeds with strong encryption and access controls.
- Use a robust key management system (KMS).
- Avoid storing seeds in plain text.
- Regular Audits: Regularly audit your OTP implementation for vulnerabilities, including seed sharing and rate limiting effectiveness.
Detecting Potential Reuse
Monitor logs for:
- Multiple successful logins from the same user within a very short period.
- Failed login attempts followed by immediate success (suggests someone is trying multiple codes).
Impact of Compromised Seed
If a seed is compromised, an attacker can generate valid OTPs for that account indefinitely until the service revokes the seed. This highlights the importance of secure seed storage and independent management.

