Automated Threat Modeling

Spring Cloud Gateway CVE-2025-41253: Brief Summary of Environment Variable Exposure via SpEL Injection

A brief summary of CVE-2025-41253, a high-severity vulnerability in Spring Cloud Gateway Server Webflux that can expose environment variables and system properties through SpEL injection when actuator endpoints are misconfigured. It covers affected versions, technical details, and official patch guidance.

CVE Analysis

12 min read

ZeroPath CVE Analysis
ZeroPath CVE Analysis

2025-10-16

Spring Cloud Gateway CVE-2025-41253: Brief Summary of Environment Variable Exposure via SpEL Injection
Experimental AI-Generated Content

This CVE analysis is an experimental publication that is completely AI-generated. The content may contain errors or inaccuracies and is subject to change as more information becomes available. We are continuously refining our process.

If you have feedback, questions, or notice any errors, please reach out to us.

[email protected]

Introduction

A misconfigured Spring Cloud Gateway Server Webflux application can expose sensitive credentials and configuration secrets to attackers. In CVE-2025-41253, an exposed actuator endpoint combined with permissive Spring Expression Language (SpEL) evaluation can let an attacker exfiltrate environment variables and system properties. That matters most in cloud-native environments, where environment variables often hold critical secrets and operational parameters.

Spring Cloud Gateway is a core part of the Spring ecosystem, maintained by VMware, and widely used as an API gateway in Java-based microservices architectures. Because it is so popular and sits at the center of routing and securing service traffic, a flaw in it hits enterprises and cloud providers especially hard.

Technical information

CVE-2025-41253 applies when a Spring Cloud Gateway Server Webflux application has the actuator web endpoint enabled (specifically the gateway endpoint) and that endpoint is reachable without authentication. The Spring Cloud Gateway Server MVC variant is not affected. The root cause is that the gateway evaluates untrusted SpEL expressions in route definitions submitted through the actuator API. An attacker who can create or modify routes through the actuator endpoint may inject SpEL expressions that reach sensitive beans such as @systemProperties and @systemEnvironment. From there they can enumerate and extract environment variables and system properties, which often include database credentials, API keys, and other secrets.

The attack works only when all three of these conditions hold:

  • The application uses Spring Cloud Gateway Server Webflux (not MVC)
  • The actuator web endpoint is enabled with management.endpoints.web.exposure.include=gateway and management.endpoint.gateway.enabled=true or management.endpoint.gateway.access=unrestricted
  • The actuator endpoints are reachable by attackers and are not secured by authentication

The actuator route management API uses a permissive SpEL evaluation context that does not restrict access to sensitive beans. Attackers can therefore write expressions that reference system properties and environment variables directly, which leads to information disclosure.

Patch information

The Spring team has released fixes for CVE-2025-41253 across several Spring Cloud Gateway release lines. The updates are meant to stop unauthorized access to environment variables and system properties through misused SpEL in route configurations.

Fixed versions

Release lineUpgrade toNote
4.3.x4.3.2
4.2.x4.2.6
4.1.x4.1.12Commercial release
4.0.x4.1.12Out of support
3.1.x3.1.12Commercial release

Changes in the patch

  1. Stricter validation of SpEL expressions in route configurations. Only authorized, safe expressions are evaluated, which lowers the risk of exposing sensitive system properties.

  2. Restricted access to actuator endpoints by default. The gateway actuator endpoint is no longer exposed unless the administrator explicitly configures it. This reduces the attack surface, because unauthorized users can no longer create or modify routes that could exploit SpEL vulnerabilities.

  3. Updated security documentation that stresses securing actuator endpoints. It advises administrators to:

    • Remove gateway from the management.endpoints.web.exposure.include property if it is not in use.
    • Secure actuator endpoints with proper authentication and authorization so that unauthorized users cannot reach them.

Code snippet illustrating the change

# Previous configuration (vulnerable) management.endpoints.web.exposure.include=gateway # Updated configuration (secure by default) # The 'gateway' endpoint is not exposed unless explicitly included management.endpoints.web.exposure.include=health,info

Patch source: https://spring.io/security/cve-2025-41253

Affected systems and versions

CVE-2025-41253 affects only the Spring Cloud Gateway Server Webflux variant. These versions are vulnerable:

  • 4.3.x versions prior to 4.3.2
  • 4.2.x versions prior to 4.2.6
  • 4.1.x versions prior to 4.1.12 (commercial support)
  • 4.0.x versions prior to 4.1.12 (out of support)
  • 3.1.x versions prior to 3.1.12 (commercial support)

Even on those versions, only configurations where the actuator web endpoint is enabled and exposed without authentication are vulnerable. Systems using the Spring Cloud Gateway Server MVC variant are not affected.

Vendor security history

The Spring team at VMware has fixed similar SpEL injection and actuator endpoint misconfiguration issues before, including CVE-2022-22947 and CVE-2025-41243. It has a record of shipping patches promptly and updating its documentation to reflect security best practices. Still, SpEL and actuator-related vulnerabilities keep recurring, which indicates that balancing flexible dynamic configuration against strong security controls in cloud-native Java applications remains an ongoing problem.

References

Detect & fix
what others miss

Works with
  • GitHub
  • GitLab
  • Bitbucket
  • Azure DevOps Services
  • Gerrit
  • CVS
  • Jira
  • Linear
  • Slack
  • Security Compass
Explore integrations
Security magnifying glass visualization