Let’s say I use my Yubikey OTP to login to multiple servers, and it one becomes compromised. I go to login the that compromised server, and enter my OTP. Obviously, once that’s password is verified it can’t be reused, but whose to say the server has to verify it? The malware could than go on to replicate itself by attempting to login to another server with that Yubikey OTP and so on and so one throughout more servers. Is this possible, or am I missing something?

  • Yubikey devices support a number of different OTP mechanisms. Do you mean the Yubikey default OTP where you press the button and a long string of characters is inserted?
    – David
    Dec 26, 2020 at 15:03
  • @David yes sorry Dec 27, 2020 at 19:04

1 Answer 1


Yes, if the compromised server does not validate the OTP for the purpose you expect, it can use it to attempt to connect to other of the services that work with the same Yubikey. This would be a man in the middle attack with the particularity that the "man in the middle" happens to be one of your servers (the compromised server). The Yubikey OTP scheme itself does not protect against such attacks.

This assumes that the compromised server is not a Yubikey validation server. If this is the case, you should assume the attacker can generate OTPs of any sequence number. In other words, the attacker virtually possesses a copy of the Yubikey. This is because validation servers know the secret that is stored on the Yubikey if the key is registered with them.

  • 1
    This sounds like a good reason to use FIDO2 / U2F instead of OTP... I believe the challenge/response used in both those protocols are specific to the requesting site, and can't be passed to another site. People say to use Yubikeys to prevent phishing, but it sounds like OTPs don't actually prevent it if the server is malicious.
    – CBHacking
    May 28, 2021 at 6:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .