As I understand, modern phishing is kind of like a man-in-the-middle attack. Let's say, for example that User u has an account in Domain d where he has an SMS based 2FA enabled. This is what the phishing mechanism is like:
- Attacker presents a login page on a domain d' which looks similar to the login page of the domain d.
- User u does not recognize this and he enters his credentials to this page on d'.
- Attacker turns around and uses these credentials to login into Domain d.
- Domain d sends u an OTP on his phone.
- Attacker presents u an OTP verification page on domain d'.
- User u enters this OTP on d'.
- Attacker turns around and uses this OTP to authenticate himself on Domain d.
Now, if the user u had a hardware key, the last few steps would be very similar.
- Domain d sends attacker a challenge.
- Attacker reelays the challenge to the fake page on domain d'.
- User uses his hardware key to sign the challenge.
- Attacker turns around and submits the signed challenge to domain d, pretending to be u.
So, in what way is a hardware based authentication mechanism like yubikey better than SMS based OTP, or TOTP codes?