Skip to content
Access control Write-up Intermediate

When 72 Characters Is All It Takes: Unpacking Spring Security’s

Spring Security's BCrypt password encoder only compared the first 72 characters of a password, so two passwords that matched in their first 72 characters were treated as the same. An attacker who knew the first 72 characters of a victim's longer password could authenticate without knowing the rest.

Hayden Baillio Follow

Published on medium.com

Spring Security’s crypto module has been letting passwords slide if they’re longer than 72 characters but match in the first 72. That’s like a bouncer checking only the first name on your ID and waving you through.

Hayden Baillio, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the BCrypt implementation did not enforce the algorithm's 72-byte input limit, so passwords longer than 72 characters were silently truncated before hashing and comparison.

Impact

An attacker who knew the first 72 characters of a victim's longer password could authenticate as that victim, bypassing the need for the remaining characters.

What the attacker needed

Victim's password longer than 72 characters; attacker knows first 72 characters

The fix

Upgrade to a supported Spring Security version that enforces the 72-character limit, and reset any passwords longer than 72 characters.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

When a website stores your password, it usually saves a scrambled version called a hash, not the password itself. This bug meant that if your password was longer than 72 characters, the system only looked at the first 72 when checking your login. So anyone who knew those first 72 characters could log in as you, even without knowing the rest.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

More by Hayden Baillio

View all

2 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.