Get ahead
VMware offers training and certification to turbo-charge your progress.
Learn moreApplications which accept user-supplied Spring Expression Language (SpEL) expressions
and evaluate them with a SimpleEvaluationContext may be vulnerable to the invocation of
constructors or methods through implicit type conversion, bypassing the restrictions on
constructor and method invocations.
Specifically, an application is vulnerable when all the following conditions are met:
SimpleEvaluationContext.SimpleEvaluationContext uses its default type converter, or it is configured with a
TypeConverter or ConversionService that includes the default converters of
DefaultConversionService — for example, a DefaultConversionService or a
ConversionService populated via DefaultConversionService.addDefaultConverters().Spring Framework:
| Fix version | Availability |
|---|---|
| 7.0.11 | OSS |
| 7.0.10.1 | Enterprise Support Only |
| 6.2.21 | Enterprise Support Only |
| 6.1.30 | Enterprise Support Only |
| 6.0.33 | Enterprise Support Only |
| 5.3.51 | Enterprise Support Only |
| 5.2.27.RELEASE | Enterprise Support Only |
Fixed versions of Spring Framework configure SimpleEvaluationContext with a restricted
ConversionService by default, which does not convert values by reflectively invoking
constructors or methods. Conversions for common types remain supported, and applications
that require an additional conversion can register a dedicated converter via the
withConverter() method of the SimpleEvaluationContext builder.
A custom TypeConverter or ConversionService registered via the SimpleEvaluationContext
builder is used as-is. Applications that register a DefaultConversionService or a
ConversionService populated via DefaultConversionService.addDefaultConverters() should
upgrade and register dedicated converters via withConverter() instead.
The previous behavior can be restored globally by setting the
spring.expression.reflectiveConversion JVM system property or Spring property to true.
Care should be taken when doing so, as it removes the protection provided by the restricted
ConversionService.
Applications that cannot upgrade immediately can configure each SimpleEvaluationContext
with a custom ConversionService that only supports the conversions required by the
application — for example, a GenericConversionService with explicitly registered
converters — via the withConversionService() method of the SimpleEvaluationContext
builder.
This issue was reported by WangYuhui.
To report a security vulnerability for a project within the Spring portfolio, see the Security Policy