Menu

1 / 3

Preventing Timing Attacks in Axion's Login Route with Dummy Hashes

DEV Community: authenticationΒ·Seif EidΒ·2 days ago
#6yPjeuVF
#devtoauthentication#devto#dev#username#password
Long article (424 words) β€” no AI summary yet.
Reading 0:00
15s threshold

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.…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.