highVulnerability

GHSA-2c85-rfcc-g74j

### Summary Karate Mock Server can execute embedded expressions found in attacker-controlled HTTP request data when a Mock Server feature assigns request-derived values such as `request`, `requestHeaders`, or `requestParams` to variables. In affected scenarios, an unauthenticated remote attacker can place a Karate embedded expression such as `#(Java.type(...))` in the HTTP body, headers, or query parameters. The Mock Server then recursively processes that untrusted data as embedded expressions and evaluates it server-side, which can lead to arbitrary command execution under the privileges of the Karate Mock Server process. This issue does not require the attacker to control the feature file. The vulnerable precondition is that the Mock Server feature uses request-derived data in a way that passes through Karate expression evaluation, for example: ```karate * def body = request * def hdrs = requestHeaders * def params = requestParams ``` ### Details The issue is caused by a missing trust boundary between HTTP request-derived data and Karate feature-authored embedded expressions. In `MockHandler`, the current HTTP request is stored and request-derived values are exposed to the Karate runtime. For example, the request body is made available through the `request` binding: ```java // MockHandler.java this.currentRequest = request; request.processBody(); engine.put("request", (JsLazy) () -> currentRequest != null ? currentRequest.getBodyConverted() : null); ``` `HttpRequest.getBodyConverted()` converts attacker-controlled JSON request bodies into Java objects such as `Map<String, Object>`: ```java // HttpRequest.java public Object getBodyConverted() { ResourceType rt = getResourceType(); if (rt != null && rt.isBinary()) { return body; } return HttpUtils.fromBytes(body, false, rt); } ``` When a Mock Server feature contains a step such as: ```karate * def body = request ``` the expression `request` is evaluated by `StepExecutor.executeDef()` th

Properties

ghsa_id
GHSA-2c85-rfcc-g74j
summary
Karate Mock Server RCE via embedded expression evaluation of request-derived data
severity
high
cve_id
GHSA-2c85-rfcc-g74j
is_ghsa_only
true
ghsa_published
2026-06-18T13:06:46Z
source_url
https://github.com/advisories/GHSA-2c85-rfcc-g74j
ghsa_updated
2026-06-18T13:06:49Z

Related Entities (4)

REPORTED_BY (1)

[Source]GitHub Advisory Database

VULNERABLE_TO (1)

[Software]maven/io.karatelabs:karate-core

AFFECTS (1)

[Software]maven/io.karatelabs:karate-core

HAS_WEAKNESS (1)

[Weakness]Improper Neutralization of Directives in Dynamically Evaluated Code ('Eval Injection')

Explore deeper with Ninja Signal's threat intelligence graph