CVE-2025-22228: 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:

  • 5.7.0 - 5.7.15
  • 5.8.0 - 5.8.17
  • 6.0.0 - 6.0.15
  • 6.1.0 - 6.1.13
  • 6.2.0 - 6.2.9
  • 6.3.0 - 6.3.7
  • 6.4.0 - 6.4.3
  • Older, unsupported versions are also affected

Mitigation

Users of affected versions should upgrade to the corresponding fixed version.

Affected version(s) Fix version Availability
5.7.x 5.7.16 Enterprise Support Only
5.8.x 5.8.18 Enterprise Support Only
6.0.x 6.0.16 Enterprise Support Only
6.1.x 6.1.14 Enterprise Support Only
6.2.x 6.2.10 Enterprise Support Only
6.3.x 6.3.8 OSS
6.4.x 6.4.4 OSS

Credit

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

References

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