Timing Attack Affecting github.com/xlzd/gotp Open this link in a new tab package, versions *

  • Attack Complexity


  • Confidentiality


Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • snyk-id


  • published

    5 Jan 2022

  • disclosed

    5 Jan 2022

  • credit


Introduced: 5 Jan 2022

CWE-208 Open this link in a new tab

How to fix?

There is no fixed version for github.com/xlzd/gotp.


github.com/xlzd/gotp is a Golang package for generating and verifying one-time passwords. It can be used to implement two-factor (2FA) or multi-factor (MFA) authentication methods in anywhere that requires users to log in.

Affected versions of this package are vulnerable to Timing Attack if the time that the user enabled OTP (one time password) can be guessed. This vulnerability exists due to the usage of weak RNG (random number generator) by rand.Seed(time.Now().UnixNano()) method in the RandomSecret function.