CVE-2025-22223: Spring Security authorization bypass for method security annotations on parameterized types

MEDIUM | MARCH 19, 2025 | CVE-2025-22223

Description

Spring Security may not correctly locate method security annotations on parameterized types or methods. This may cause an authorization bypass.

Your application may be affected by this if the following are true:

  1. You are using @EnableMethodSecurity, and
  2. You have a method security annotation on a parameterized superclass, interface, or overridden method and no annotation on the target method

In that case, the target method may be able to be invoked without proper authorization.

You are not affected if:

  1. You are not using @EnableMethodSecurity, or
  2. You do not have method security annotations on parameterized types or methods, or
  3. All method security annotations are attached to target methods

Affected Spring Products and Versions

Spring Security:

  • 6.4.0 - 6.4.3

Mitigation

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

Affected version(s) Fix version Availability
6.4.x 6.4.4 OSS

No other mitigation steps are necessary.

If you cannot upgrade, then you can either:

  1. Ensure the target method has the annotations instead of its parameterized ancestor, or
  2. Publish an AuthorizationManagerBeforeMethodInterceptor that correctly looks for annotations on parameterized types (please see a sample in the Spring Security issue log)

Credit

This vulnerability was discovered and responsibly reported independently by Vasil Ilchev and Neale Upstone.

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