Hey guys! ππ»
I wanted to share a good security fix I applied to my microforum, Axion. It's about stopping attackers from finding out which usernames exist through timing attacks.
Why Timing Attacks Happen in Login Routes. When you're building a login route for a platform like Axion, the normal flow looks simple: find the user by their username, and if they exist, compare the password they typed with their saved hash.
The problem is that password hashing takes heavy CPU work. Because of that, an attacker can measure how long each login request takes to finish, and two different things happen:
Wrong username: There is no hash to compare, so the server uses less CPU time. This gives a faster response, which tells the attacker the username doesn't exist.
Right username: There is a password hash to compare, so the server uses more CPU time.β¦