1

I was wondering about the security of TOTP codes.

Is there any cryptographic security around the secret to stop a user being able to guess the secret after capturing a variety of TOTP codes. For example:

Attacker sniffs creds on a targets network where SSO is over HTTP using User:Pwd:TOTP . After some time can the attacker make a reasonable guess as to what the TOTP secret is by looking at what secrets produce each TOTP code and narrowing down the results?

3

Yes, TOTP is cryptographically secure. TOTP is HMAC of current timestamp using a shared secret [1]. HMAC is secure. TOTP produces only 6 digits (20 bits), while protocols like TLS prefer longer MACs (128 bits), but there is no way to predict the next TOTP code (with better than 1 in 10^6 odds) by seeing all previous TOTP codes, without knowing the shared secret.

1 - https://en.wikipedia.org/wiki/Time-based_One-time_Password_Algorithm

2

The algorithm is weak, because it assumes that local timestamp cannot be manipulated, but it can under the right conditions.

Being predictable is one of the worst mistakes that can be made when security is a true concern. Counting on facts that you cannot verify is also naive design.

One great weakness of TOTP is that the combination of secret key and timestamp generates always exactly the same token result. Allowing internal clock manipulation weakens the entire concept, possibly leading security problems.

Secret Seed + Time = Token

ntpd daemon allows clock manipulation. It accepts anything coming from the upstream NTP service. So you could give a false timestamp and ntpdate would accept it without concerns.

Is a common pratice to use ntpdate as a replacement for ntpd(both of them are vulnerable to MITM attacks). ntpdate hostname should be avoided.

NTP vulnerabilities: https://www.cvedetails.com/vulnerability-list/vendor_id-2153/NTP.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.