CVE-2025-22228: Spring Security BCryptPasswordEncoder does not enforce maximum password length
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
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
maven/org.springframework.security:spring-security-cryptoto a version that resolves this vulnerability.Fixed in 5.7.16 - Upgrade
Upgrade
maven/org.springframework.security:spring-security-cryptoto a version that resolves this vulnerability.Fixed in 5.8.18 - Upgrade
Upgrade
maven/org.springframework.security:spring-security-cryptoto a version that resolves this vulnerability.Fixed in 6.0.16 - Upgrade
Upgrade
maven/org.springframework.security:spring-security-cryptoto a version that resolves this vulnerability.Fixed in 6.1.14 - Upgrade
Upgrade
maven/org.springframework.security:spring-security-cryptoto a version that resolves this vulnerability.Fixed in 6.2.10 - Upgrade
Upgrade
maven/org.springframework.security:spring-security-cryptoto a version that resolves this vulnerability.Fixed in 6.4.4 - Upgrade
Upgrade
maven/org.springframework.security:spring-security-cryptoto a version that resolves this vulnerability.Fixed in 6.3.8
Event History
Frequently Asked Questions
What is the severity of CVE-2025-22228?
CVE-2025-22228 is considered a high-severity vulnerability due to its impact on password validation.
How do I fix CVE-2025-22228?
To fix CVE-2025-22228, update to the latest version of Spring Security that addresses this vulnerability.
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.
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.
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.