Spring Security BCryptPasswordEncoder does not enforce maximum password length

HIGH | MARCH 19, 2025 | CVE-2025-22228

Description

BCryptPasswordEncoder.matches(CharSequence,String) will incorrectly return true for passwords larger than 72 characters as long as the first 72 characters are the same.

Affected Spring Products and Versions

Spring Security:

  • 6.4.0 - 6.4.3
  • 6.3.0 - 6.3.7
  • 6.2.0 - 6.2.9
  • 6.1.0 - 6.1.13
  • 6.0.0 - 6.0.15
  • 5.8.0 - 5.8.17
  • 5.7.15 and earlier

Mitigation

Users of affected versions should upgrade to the corresponding fixed version.
Fix versionAvailability
6.4.4OSS
6.3.8OSS
6.2.10Enterprise Support Only
6.1.14Enterprise Support Only
6.0.16Enterprise Support Only
5.8.18Enterprise Support Only
5.7.16Enterprise Support Only

No further mitigation steps are necessary.

Credit

The issue was identified and responsibly reported by Lars Bruun-Hansen ([email protected]).

History

  • 2025-03-19: Initial vulnerability report published.

Get ahead

VMware offers training and certification to turbo-charge your progress.

Learn more

Get support

Tanzu Spring offers support and binaries for OpenJDK™, Spring, and Apache Tomcat® in one simple subscription.

Learn more

Upcoming events

Check out all the upcoming events in the Spring community.

View all