CVE-2024-57155: Spring Handler Interceptor Auth Bypass Returns True On Null User

This Spring HandlerInterceptor.preHandle method returns true when the authenticated principal (e.g. session user / token subject) is null, so unauthenticated requests are allowed to proceed to the controller. preHandle must return false or throw on missing credentials, otherwise the interceptor is a no-op authentication stub (CVE-2024-57155, CWE-284: Imprope

Provally CuratedPublic repositoryHighHigh confidenceVerifiedApache-2.0Java
greprules fetch cve-2024-57155-spring-handler-interceptor-auth-bypass-returns-true-on-null-user --engine opengrep

Description

This Spring HandlerInterceptor.preHandle method returns true when the authenticated principal (e.g. session user / token subject) is null, so unauthenticated requests are allowed to proceed to the controller. preHandle must return false or throw on missing credentials, otherwise the interceptor is a no-op authentication stub (CVE-2024-57155, CWE-284: Imprope