Spring Security SpEL Injection RCE, Fixed in 7.1.3 (CVE-2026-59273)
Spring Security's ELRequestMatcher evaluates bound SpEL with type access, allowing RCE where request input reaches a RequestMatcher; fixed in 7.1.3 and 7.0.9.
TL;DR
- Spring Security's
ELRequestMatcherevaluates a SpEL expression in a context that allows type references and static method calls. When an application binds outside input to aRequestMatcherproperty, the bound string becomes that expression. - Spring Security 7.1.0 through 7.1.2 and 7.0.0 through 7.0.8 are affected, along with the 6.5, 6.4, 5.8 and 5.7 lines. The library alone is not reachable; the application must bind external input to a
RequestMatcher. - Spring rates the flaw Critical, CVSS v3.1 9.8. Two public proof-of-concept repositories appeared on 2026-11-20 and 2026-11-21 and show type access, not command execution. No in-the-wild exploitation is known and the CVE is not in CISA KEV as of 2026-11-22.
- Upgrade to Spring Security 7.1.3, 7.0.9 or 7.2.0, or to Spring Boot 4.1.3, 4.0.10 or 4.2.0. The 6.5, 6.4, 5.8 and 5.7 fixes are Enterprise Support Only. If you cannot upgrade, remove any request-data binding to a
RequestMatcherproperty.
Am I affected?
All of these conditions must hold for an application to be exposed:
- It uses an affected Spring Security release: 7.1.0 through 7.1.2, 7.0.0 through 7.0.8, 6.5.0 through 6.5.12, 6.4.0 through 6.4.19, 5.8.0 through 5.8.28, or 5.7.26 and earlier.
- A controller, form object or other bean binds a request value to a property of type
RequestMatcher, so Spring's data binder creates anELRequestMatcherfrom text the attacker controls. - The matcher is evaluated on a request the attacker can reach.
- The bound string is not restricted to the documented
hasIpAddressandhasHeaderoperations.
The class is also used directly in configuration, for example in a DelegatingAuthenticationEntryPoint map. A matcher built from a fixed string in code is not attacker-controlled. The exposure comes from data binding, not from the class by itself.
| Branch | Affected versions | Fixed version |
|---|---|---|
| 7.2.x | None | 7.2.0 (OSS) |
| 7.1.x | 7.1.0 through 7.1.2 | 7.1.3 (OSS) |
| 7.0.x | 7.0.0 through 7.0.8 | 7.0.9 (OSS) |
| 6.5.x | 6.5.0 through 6.5.12 | 6.5.13 (Enterprise Support Only) |
| 6.4.x | 6.4.0 through 6.4.19 | 6.4.20 (Enterprise Support Only) |
| 5.8.x | 5.8.0 through 5.8.28 | 5.8.29 (Enterprise Support Only) |
| 5.7.x and earlier | 5.7.26 and earlier | 5.7.27 (Enterprise Support Only) |
Spring rates the flaw Critical with CVSS v3.1 9.8 (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H). Spring published 7.1.3, 7.0.9 and 7.2.0 to Maven Central on 2026-11-19. The 6.5.13, 6.4.20, 5.8.29 and 5.7.27 artifacts were not on Maven Central when checked on 2026-11-22, and Spring lists them as Enterprise Support Only.
Check the resolved version in the application:
mvn dependency:tree -Dincludes=org.springframework.security:spring-security-web,org.springframework.security:spring-security-core
./gradlew dependencyInsight --dependency spring-security-web --configuration runtimeClasspath
For a packaged application, inspect the jar:
unzip -l app.jar | grep 'spring-security-web'
For a Spring Boot application, print the managed Spring Security version:
./mvnw help:evaluate -Dexpression=spring-security.version -q -DforceStdout
Then look for the binding site in the source:
grep -rn "RequestMatcher" src/main/java
grep -rn "ELRequestMatcher" src/main/java
The dependency check prints the version. The source search finds a RequestMatcher field. Inspect the controller or form object that binds that field, and confirm whether request data can set it. A matcher configured with a fixed string in a @Bean method is not the vulnerable path.
How do I fix it?
Upgrade to a fixed Spring Security release. Spring Boot 4.1.3, 4.0.10 and 4.2.0 manage Spring Security 7.1.3, 7.0.9 and 7.2.0, so upgrading the Boot parent or plugin is the shortest path for a Boot application.
- Change the Spring Boot parent in Maven:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>4.1.3</version>
</parent>
- Or change the Spring Boot plugin in Gradle:
plugins {
id 'org.springframework.boot' version '4.1.3'
}
- For an application that declares Spring Security directly, raise the dependency:
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>7.1.3</version>
</dependency>
implementation 'org.springframework.security:spring-security-web:7.1.3'
- Rebuild, redeploy and restart the application. A running process keeps the old classes until it is restarted.
Applications on the 6.5, 6.4, 5.8 or 5.7 lines need the commercial patch for their branch. The public Maven Central repository does not carry 6.5.13, 6.4.20, 5.8.29 or 5.7.27. Spring Boot 3.5.16, the newest 3.5 release, manages Spring Security 6.5.11, so a Boot 3.5 application has no public fixed artifact without an upgrade to 4.x or a support agreement.
If the upgrade cannot happen now, remove the binding site:
- Find every property of type
RequestMatcherthat Spring binds from request data. - Remove that property from the bindable object, or make it read-only and set it in code.
- If the value must be configurable, accept a fixed name and construct the matcher from a constant.
- Do not try to filter SpEL strings as a long-term fix. The parser accepts many equivalent forms, and the supported fix is the restricted evaluation context.
The advisory lists no configuration switch that keeps the matcher usable and safe. The binding restriction is an application-level workaround, not a vendor-supported setting.
What is the root cause?
ELRequestMatcher stored a SpEL expression and evaluated it in a StandardEvaluationContext, a context that grants type references, constructors, static method calls, bean references and arbitrary property access. The matcher needs only hasIpAddress() and hasHeader() on its root object, but the context did not limit evaluation to those two methods.
The vulnerable code is in web/src/main/java/org/springframework/security/web/util/matcher/ELRequestMatcher.java at tag 7.1.2. The constructor at lines 47-50 parses the string:
public ELRequestMatcher(String el) {
SpelExpressionParser parser = new SpelExpressionParser();
this.expression = parser.parseExpression(el);
}
matches() at lines 53-60 creates the context, and createELContext() at lines 66-68 returns it:
@Override
public boolean matches(HttpServletRequest request) {
EvaluationContext context = createELContext(request);
Boolean result = this.expression.getValue(context, Boolean.class);
Assert.notNull(result,
"The expression " + this.expression.getExpressionString() + " returned null. Expected true|false");
return result;
}
public EvaluationContext createELContext(HttpServletRequest request) {
return new StandardEvaluationContext(new ELRequestMatcherContext(request));
}
The root object exposes the two documented methods:
class ELRequestMatcherContext {
private final HttpServletRequest request;
ELRequestMatcherContext(HttpServletRequest request) {
this.request = request;
}
public boolean hasIpAddress(String ipAddress) {
return (new IpAddressMatcher(ipAddress).matches(this.request));
}
public boolean hasHeader(String headerName, String value) {
String header = this.request.getHeader(headerName);
return StringUtils.hasText(header) && header.contains(value);
}
}
A StandardEvaluationContext does not limit the expression to the root object. An expression such as T(java.lang.Math).abs(-1) == 1 resolves the java.lang.Math type directly, even though ELRequestMatcherContext has no abs method.
The second half is data binding. Spring Security ships a property editor for this type:
public class RequestMatcherEditor extends PropertyEditorSupport {
@Override
public void setAsText(String text) throws IllegalArgumentException {
setValue(new ELRequestMatcher(text));
}
}
Spring's data binder discovers editors by naming convention, so a RequestMatcher property accepts a string and converts it into an ELRequestMatcher. The public harness found that the bind also succeeds through the ELRequestMatcher(String) constructor on a stock classpath, without the editor being registered. Either path turns attacker-controlled text into an expression.
How is it exploited?
An attacker sends a SpEL expression as the value that the application binds to a RequestMatcher property. When the matcher runs, the expression evaluates with the application's privileges.
- The application exposes a request parameter, form field or JSON property that maps to a
RequestMatcherproperty. - The attacker supplies a SpEL expression in that field.
- Spring converts the string into an
ELRequestMatcherand stores it on the object. - A later request reaches the matcher, and
matches()evaluates the expression. - A
T(...)type reference resolves a class, and a static method or constructor runs. - The expression runs code in the application process.
The public harness shows the first half of that chain without running a command:
ELRequestMatcher requestMatcher = new ELRequestMatcher("T(java.lang.Math).abs(-1) == 1");
requestMatcher.matches(new MockHttpServletRequest());
On 7.1.2 the expression matches. On 7.1.3 the same expression throws SpelEvaluationException. The harness uses Math.abs, and its README says it contains no process payload. The advisory describes the impact as remote code execution. The public material demonstrates type access, not a weaponized command chain.
How does the attack flow?
Attacker-controlled text becomes an ELRequestMatcher through data binding. The matcher evaluates it in a context that allows type access, so a SpEL type reference can run code as the application.
a RequestMatcher property"] --> B["Spring data binder converts
the string to ELRequestMatcher"] B --> C["Constructor parses
the SpEL expression"] C --> D["matches builds a context
with no type-reference limit"] D --> E["T(...) resolves a class
and a static method runs"] E --> F["Code runs as
the application process"]
What can an attacker do?
An attacker who controls the bound value can run code in the application process. The advisory rates that impact as remote code execution. The public harness proves the type-reference step and stops before a command.
- Run commands as the application user. The application's file permissions, environment variables and network access become the attacker's starting point.
- Read application secrets. Configuration properties, database credentials and cloud instance credentials are reachable when the process can read them.
- Modify application data. The expression runs inside the request thread and can use the application's classpath and process state.
- Move to other systems. The application's network position and trust relationships decide how far the attacker can go.
Every condition is listed here. The application must use an affected release. It must bind external input to a RequestMatcher property. The attacker must control the bound string. The matcher must be evaluated on a request the attacker can reach. No authentication is needed when the binding endpoint is public. An application that only builds matchers from fixed strings in code is not exposed, even on an affected release.
Why does the fix work?
The fix replaces StandardEvaluationContext with SimpleEvaluationContext, a context that disables type references, constructors, bean references and arbitrary method invocation. The withInstanceMethods() option keeps the two instance methods the matcher documents.
-import org.springframework.expression.spel.support.StandardEvaluationContext;
+import org.springframework.expression.spel.support.SimpleEvaluationContext;
@@
- public EvaluationContext createELContext(HttpServletRequest request) {
- return new StandardEvaluationContext(new ELRequestMatcherContext(request));
- }
+ public EvaluationContext createELContext(HttpServletRequest request) {
+ return SimpleEvaluationContext.forReadOnlyDataBinding()
+ .withInstanceMethods()
+ .withRootObject(new ELRequestMatcherContext(request))
+ .build();
+ }
SimpleEvaluationContext.forReadOnlyDataBinding() allows property reads but not writes. withInstanceMethods() allows calls on the root object, which is what hasIpAddress('10.0.0.0/8') and hasHeader('User-Agent', 'curl') need. The context no longer resolves T(java.lang.System) or calls getClass() on the result of hasIpAddress(). The fix commit adds regression tests for both cases.
The fix is complete for the ELRequestMatcher path. A subclass that overrides createELContext and returns its own StandardEvaluationContext would keep the old behavior, so check for such overrides during the upgrade.
How do I check if I was compromised?
No indicators of compromise are published for this CVE. The expression runs in memory and may leave no application log, so a missing alert is not proof that no attempt happened.
Start with the request logs. The matcher expressions in normal deployments call hasIpAddress or hasHeader. A request parameter that contains T( or its URL-encoded form %54%28 is worth investigating:
grep -Ei 'T\(|%54%28' /var/log/nginx/access.log /var/log/apache2/access.log 2>/dev/null
Check the application log for SpelEvaluationException around unusual requests. An expression that fails may throw before it runs:
grep -i "SpelEvaluationException" /var/log/spring-app.log
Look for child processes started by the Java process and for outbound connections that do not match the application's normal egress:
ps -eo pid,ppid,user,args | grep -E '[j]ava|[b]ash|[c]url|[w]get'
A hit on T( in a request log is a lead, not proof of exploitation. A failed expression may leave no trace. If the application overrides createELContext, review that code separately.
Timeline
- 2026-09-30: The fix commit
5d28474a5cefwas authored in the Spring Security repository. - 2026-10-22: Spring Security 7.1.2 and 7.0.8 were released, the last vulnerable open-source artifacts.
- 2026-11-19: Spring published the advisory and released 7.1.3, 7.0.9 and 7.2.0 to Maven Central.
- 2026-11-20: The first public proof-of-concept repository appeared.
- 2026-11-21: The second public proof-of-concept repository appeared at 21:26 UTC.
FAQ
Does every Spring Security application need to patch?
No. The library alone is not remotely reachable. An application is exposed only when it binds external input to a RequestMatcher property and evaluates that matcher. Applications that build matchers from fixed strings in code should still upgrade, but they do not have the same exposure.
Is there a public exploit?
There are two public proof-of-concept repositories. The substantive one is a differential harness that shows T(java.lang.Math) resolves on 7.1.2 and throws on 7.1.3. It contains no process payload and does not demonstrate command execution.
Is CVE-2026-59273 exploited in the wild?
No in-the-wild exploitation is known as of 2026-11-22, and the CVE is not in CISA KEV. The public material is a lab harness, not an attack report.
Which Spring Boot version fixes it?
Spring Boot 4.1.3 manages Spring Security 7.1.3, Spring Boot 4.0.10 manages 7.0.9, and Spring Boot 4.2.0 manages 7.2.0. Spring Boot 3.5.16 still manages 6.5.11, and the 6.5.13 fix is Enterprise Support Only.
Can I keep using ELRequestMatcher?
Yes, on a fixed release, when the expression comes from trusted code. The fix keeps hasIpAddress and hasHeader working. Do not accept the expression from request data.
Does DelegatingAuthenticationEntryPoint make me vulnerable?
Not by itself. Its matcher map is usually built in configuration from fixed strings. The vulnerable path is a RequestMatcher property that Spring's data binder fills from request input.
References
- Spring Security advisory for CVE-2026-59273, published 2026-11-19 (checked November 22, 2026): https://spring.io/security/cve-2026-59273
- Fix commit 5d28474a5cef, "Fix ELRequestMatcher to use restricted SpEL evaluation context", authored 2026-09-30 (checked November 22, 2026): https://github.com/spring-projects/spring-security/commit/5d28474a5cefab43d41b0da8c487ce40df957855
- Vulnerable
ELRequestMatcherat tag 7.1.2 (checked November 22, 2026): https://github.com/spring-projects/spring-security/blob/7.1.2/web/src/main/java/org/springframework/security/web/util/matcher/ELRequestMatcher.java - Fixed
ELRequestMatcherat tag 7.1.3 (checked November 22, 2026): https://github.com/spring-projects/spring-security/blob/7.1.3/web/src/main/java/org/springframework/security/web/util/matcher/ELRequestMatcher.java RequestMatcherEditorat tag 7.1.2 (checked November 22, 2026): https://github.com/spring-projects/spring-security/blob/7.1.2/web/src/main/java/org/springframework/security/web/util/matcher/RequestMatcherEditor.java- Spring Security 7.1.3 release, published 2026-11-20 (checked November 22, 2026): https://github.com/spring-projects/spring-security/releases/tag/7.1.3
- Spring Security 7.0.9 release, published 2026-11-20 (checked November 22, 2026): https://github.com/spring-projects/spring-security/releases/tag/7.0.9
- Spring Security 7.2.0 release, published 2026-11-20 (checked November 22, 2026): https://github.com/spring-projects/spring-security/releases/tag/7.2.0
- Spring Boot 4.1.3 release, published 2026-11-19 (checked November 22, 2026): https://github.com/spring-projects/spring-boot/releases/tag/v4.1.3
- Spring Boot 4.0.10 release, published 2026-11-19 (checked November 22, 2026): https://github.com/spring-projects/spring-boot/releases/tag/v4.0.10
- Spring Boot 4.2.0 release, published 2026-11-19 (checked November 22, 2026): https://github.com/spring-projects/spring-boot/releases/tag/v4.2.0
- Spring Boot 3.5.16 release, published 2026-06-25 (checked November 22, 2026): https://github.com/spring-projects/spring-boot/releases/tag/v3.5.16
- Spring Boot 3.5.16 dependency management, which pins Spring Security 6.5.11 (checked November 22, 2026): https://repo1.maven.org/maven2/org/springframework/boot/spring-boot-dependencies/3.5.16/spring-boot-dependencies-3.5.16.pom
- Spring Security 7.1.3 artifact on Maven Central (checked November 22, 2026): https://repo1.maven.org/maven2/org/springframework/security/spring-security-core/7.1.3/
- Public harness by Abraxas Labs, created 2026-11-21 (checked November 22, 2026): https://github.com/abraxas/cve-2026-59273-spring-security-elmatcher
- Public proof-of-concept repository by afernandesvigo, created 2026-11-20 (checked November 22, 2026): https://github.com/afernandesvigo/PoC-CVE-2026-59273
- CWE-94, Improper Control of Generation of Code (checked November 22, 2026): https://cwe.mitre.org/data/definitions/94.html
- CWE-95, Improper Neutralization of Directives in Dynamically Evaluated Code (checked November 22, 2026): https://cwe.mitre.org/data/definitions/95.html
- CWE-470, Use of Externally-Controlled Input to Select Classes or Code (checked November 22, 2026): https://cwe.mitre.org/data/definitions/470.html
- CISA Known Exploited Vulnerabilities catalog, checked for CVE-2026-59273 on 2026-11-22: https://www.cisa.gov/known-exploited-vulnerabilities-catalog