CVE-2025-22228: Spring Security BCryptPasswordEncoder does not enforce maximum password length

Published Mar 20, 2025
·
Updated

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 Software

9 affected componentsFixes available
Spring Spring Security
maven/org.springframework.security:spring-security-crypto<=5.7.15
5.7.16
maven/org.springframework.security:spring-security-crypto>=5.8.0<=5.8.17
5.8.18
maven/org.springframework.security:spring-security-crypto>=6.0.0<=6.0.15
6.0.16
maven/org.springframework.security:spring-security-crypto>=6.1.0<=6.1.13
6.1.14
maven/org.springframework.security:spring-security-crypto>=6.2.0<=6.2.9
6.2.10
maven/org.springframework.security:spring-security-crypto>=6.4.0<6.4.4
6.4.4
maven/org.springframework.security:spring-security-crypto>=6.3.0<6.3.8
6.3.8
IBM API Connect V12 OnPrem<=All

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade maven/org.springframework.security:spring-security-crypto to a version that resolves this vulnerability.

    Fixed in 5.7.16
  2. Upgrade

    Upgrade maven/org.springframework.security:spring-security-crypto to a version that resolves this vulnerability.

    Fixed in 5.8.18
  3. Upgrade

    Upgrade maven/org.springframework.security:spring-security-crypto to a version that resolves this vulnerability.

    Fixed in 6.0.16
  4. Upgrade

    Upgrade maven/org.springframework.security:spring-security-crypto to a version that resolves this vulnerability.

    Fixed in 6.1.14
  5. Upgrade

    Upgrade maven/org.springframework.security:spring-security-crypto to a version that resolves this vulnerability.

    Fixed in 6.2.10
  6. Upgrade

    Upgrade maven/org.springframework.security:spring-security-crypto to a version that resolves this vulnerability.

    Fixed in 6.4.4
  7. Upgrade

    Upgrade maven/org.springframework.security:spring-security-crypto to a version that resolves this vulnerability.

    Fixed in 6.3.8

Event History

Mar 20, 2025
CVE Published
via MITRE·05:49 AM
Data Sourced
via MITRE·05:49 AM
DescriptionSeverity
Data Sourced
via Red Hat·06:01 AM
DescriptionSeverityAffected Software
Data Sourced
via NVD·06:15 AM
DescriptionSeverityWeakness
Advisory Published
via GitHub·06:31 AM
Jul 7, 2026
Data Sourced
via IBM·12:00 AM
DescriptionAffected Software

Parent advisories

This vulnerability appears in the following advisories.

Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2025-22228?

CVE-2025-22228 is considered a high-severity vulnerability due to its impact on password validation.

2

How do I fix CVE-2025-22228?

To fix CVE-2025-22228, update to the latest version of Spring Security that addresses this vulnerability.

3

What impact does CVE-2025-22228 have on password security?

CVE-2025-22228 can allow unauthorized access as it may incorrectly validate long passwords that share the same first 72 characters.

4

Which versions of Spring Security are affected by CVE-2025-22228?

CVE-2025-22228 affects all versions of Spring Security that do not include the fix for this vulnerability.

5

Is CVE-2025-22228 exploitable in any application?

CVE-2025-22228 is exploitable in applications that use BCryptPasswordEncoder for password validation, particularly with long passwords.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203