CVE-2026-59331
Patch Available.
This Vulnerability has been fixed in the Never-Ending Support (NES) version offered by HeroDevs.
Overview
Spring Security is a framework that provides authentication, authorization, and protection against common attacks for Java applications, including reactive RSocket applications through its spring-security-rsocket module.
A denial of service vulnerability (CVE-2026-59331) has been identified in Spring Security's RSocket Basic Authentication support, which allows unauthenticated attackers to exhaust server memory with a single crafted authentication frame.
Per OWASP: The Denial of Service (DoS) attack is focused on making a resource (site, application, server) unavailable for the purpose it was designed.
This issue affects multiple versions of Spring Security.
Details
Module Info
- Product: Spring Security
- Affected packages:
org.springframework.security:spring-security-rsocket - Affected versions: >=5.7.0 <=5.7.26, >=5.8.0 <=5.8.28, >=6.0.0 <=6.4.19, >=6.5.0 <=6.5.12, >=7.0.0 <=7.0.8, >=7.1.0 <=7.1.2
- GitHub repository: https://github.com/spring-projects/spring-security
- Published packages: https://central.sonatype.com/artifact/org.springframework.security/spring-security-rsocket
- Package manager: Maven
- Fixed in:
- OSS Spring Security 7.0.9, 7.1.3
- NES for Spring Security
Vulnerability Info
This High-severity vulnerability is found in the spring-security-rsocket package in multiple versions of Spring Security. Its CVSS 3.1 base score is 7.5 (AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H).
BasicAuthenticationPayloadExchangeConverter extracts the message/x.rsocket.authentication.basic.v0 entry from an RSocket frame's composite metadata and decodes it with BasicAuthenticationDecoder. The metadata is encoded as a 4-byte big-endian username length, followed by the username bytes and then the password bytes. The decoder trusts the length field and uses it directly to size an allocation:
return Mono.from(input).map(DataBuffer::asByteBuffer).map((byteBuffer) -> {
int usernameSize = byteBuffer.getInt();
byte[] usernameBytes = new byte[usernameSize];
byteBuffer.get(usernameBytes);
byte[] passwordBytes = new byte[byteBuffer.remaining()];
byteBuffer.get(passwordBytes);
...
});
The value is never checked against the number of bytes actually present in the metadata, or for being negative. A frame whose length field is set to a value close to Integer.MAX_VALUE makes the server attempt an allocation of nearly 2 GB before it reads a single username byte, so a single crafted frame can exhaust available memory.
The converter runs before authentication. It is in effect whenever an AuthenticationPayloadInterceptor keeps its default authentication converter, for example with the deprecated RSocketSecurity#basicAuthentication configuration. Any client that can open a connection to the RSocket endpoint can therefore trigger the allocation without credentials, resulting in a denial of service.
Mitigation
Only recent versions of Spring Security receive community support. Older lines are End-of-Life and will not receive public updates to address this issue.
Users of the affected components should apply one of the following mitigations:
- Upgrade to a currently supported version of Spring Security.
- Leverage a commercial support partner like HeroDevs for post-EOL security support.
Credits
- h1ei1 (finder)
- Daehyun Kang (finder)