Security Architecture and Engineering

A web service checks an HMAC tag with a routine that returns at the first mismatched byte. An attacker measures response times to forge a valid tag one byte at a time. Which fix best stops this?

Show the answer

Correct answerD. Compare tags with a constant-time routine

AWhy not this: A stronger hash does not change how long the early-exit comparison takes, so the leak remains.

BWhy not this: Key length resists brute force, but the leak comes from comparison timing, not from a guessable key.

CWhy not this: Shielding blocks emission-based side channels; this attack uses network response times, which shielding does not alter.

DWhy this is right: Equal execution time for every input removes the timing signal the attacker uses to confirm each byte.

A constant-time comparison takes the same time whatever the mismatch position, so response times reveal nothing about correct bytes. A longer key or stronger hash does not change the timing leak, because the flaw is in the comparison routine.