CVE-2026-59400
Patch Available.
This Vulnerability has been fixed in the Never-Ending Support (NES) version offered by HeroDevs.
Overview
Spring Security is a highly customizable authentication and access-control framework for Java applications, and its OAuth2 Client support lets applications sign in users and call protected resources through OAuth 2.0 and OpenID Connect providers.
An information exposure vulnerability (CVE-2026-59400) has been identified in the ClientRegistration class of Spring Security's OAuth2 Client module, which allows attackers who can read application logs, error messages or other diagnostic output to obtain the confidential OAuth2 client secret. With the secret, an attacker can authenticate to the authorization server as the application's registered client.
Per OWASP: Access control enforces policy such that users cannot act outside of their intended permissions. Failures typically lead to unauthorized information disclosure, modification, or destruction of all data or performing a business function outside the user's limits.
This issue affects multiple versions of Spring Security.
Details
Module Info
- Product: Spring Security
- Affected packages:
org.springframework.security:spring-security-oauth2-client - Affected versions: <=5.7.26, >=5.8.0 <=5.8.28, >=6.4.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-oauth2-client
- Package manager: Maven
- Fixed in:
- OSS Spring Security 7.0.9, 7.1.3
- NES for Spring Security
Vulnerability Info
This Medium-severity vulnerability is found in the org.springframework.security:spring-security-oauth2-client package in multiple versions of Spring Security.
ClientRegistration is Spring Security's representation of an OAuth2 or OpenID Connect client registration. It holds the client ID, the client secret, the client authentication method, the authorization grant type, the redirect URI, the scopes and the provider details. Its toString() method writes the client secret into its output in plain text:
@Override
public String toString() {
// @formatter:off
return "ClientRegistration{"
+ "registrationId='" + this.registrationId + '\''
+ ", clientId='" + this.clientId + '\''
+ ", clientSecret='" + this.clientSecret + '\''
+ ", clientAuthenticationMethod=" + this.clientAuthenticationMethod
+ ", authorizationGrantType=" + this.authorizationGrantType
+ ", redirectUri='" + this.redirectUri
+ '\'' + ", scopes=" + this.scopes
+ ", providerDetails=" + this.providerDetails
+ ", clientName='" + this.clientName + '\''
+ ", clientSettings='" + this.clientSettings + '\''
+ '}';
// @formatter:on
}Java calls toString() implicitly in many common situations: parameterized logging such as log.debug("Using {}", registration), string concatenation, exception message construction, and debugging or monitoring tools that render objects. Any of these code paths, in the application or in a library it uses, sends the client secret to a destination that was never meant to hold client credentials, such as log files, log aggregation services or error reports. The vulnerability is rated CVSS 3.1 6.5 (AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N): an attacker with low-privileged access to such output can read the secret and use it to impersonate the client at the authorization server.
Steps to Reproduce
- Add
org.springframework.security:spring-security-oauth2-clientat an affected version to a Java project. - Build a
ClientRegistrationwith a client secret and print it:
ClientRegistration registration = ClientRegistration.withRegistrationId("demo")
.clientId("demo-client")
.clientSecret("client-secret-value")
.clientAuthenticationMethod(ClientAuthenticationMethod.CLIENT_SECRET_BASIC)
.authorizationGrantType(AuthorizationGrantType.AUTHORIZATION_CODE)
.redirectUri("{baseUrl}/login/oauth2/code/{registrationId}")
.authorizationUri("https://provider.example.com/oauth2/authorize")
.tokenUri("https://provider.example.com/oauth2/token")
.build();
System.out.println(registration);- Observe that the output contains
clientSecret='client-secret-value'.
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
Yu Bao from PayPal Cybersecurity Team (finder)