# GHSA-9MPQ-M32X-4Q7P: Eclipse Ditto JavaScript payload mapper sandbox escape allows arbitrary code execution in the connectivity service

- Database: GitHub
- Severity: CVSS 9.4 (Critical)
- Published: 2026-11-25
- Modified: 2026-11-25

## Tracked as

- [CVE-2026-135203](https://cve.now/CVE-2026-135203.md): Eclipse Ditto remote code execution in payload mapper

## Description

### Summary

Connections of the Ditto connectivity service can use the `JavaScript` payload mapper, which runs the user-supplied
`incomingScript` / `outgoingScript` of a connection in a [Mozilla Rhino](https://github.com/mozilla/rhino) JavaScript
engine. The documentation describes this engine as sandboxed and states that mapping scripts have no access to Java
packages or classes.

This restriction does not hold. The Rhino engine is configured without a `ClassShutter`, which is the mechanism Rhino
relies on to keep Java classes out of reach of scripts. When a script catches an error raised by the engine itself (for
example a property access on `null`), Rhino attaches the underlying Java exception object to the caught JavaScript error.
Without a `ClassShutter`, the script can call methods on that Java object and use Java reflection to load and invoke
**arbitrary Java classes and methods** in the connectivity service.

A user who may create or modify connections can therefore execute arbitrary code in the connectivity service process.
In the default configuration this requires credentials of the Ditto DevOps realm. Code executed this way has access to
everything the connectivity service has access to, e.g. its environment and configuration (including MongoDB
credentials and the credentials of all connections), the Pekko cluster of the other Ditto services and the network of
the deployment.

Severity: **Critical** (CWE-693, CWE-94).

### Details

[`JavaScriptMessageMapperRhino.doConfigure`](https://github.com/eclipse-ditto/ditto/blob/3.9.9/connectivity/service/src/main/java/org/eclipse/ditto/connectivity/service/mapping/javascript/JavaScriptMessageMapperRhino.java#L127-L138)
creates a `SandboxingContextFactory` and initializes the script scope with `initSafeStandardObjects()` (default,
`allowUnsafeStandardObjects = false`) or `initStandardObjects()` (`allowUnsafeStandardObjects = true`).
[`SandboxingContextFactory.makeContext`](https://github.com/eclipse-ditto/ditto/blob/3.9.9/connectivity/service/src/main/java/org/eclipse/ditto/connectivity/service/mapping/javascript/SandboxingContextFactory.java#L54-L61)
only configures interpreter mode, an instruction observer limiting the execution time and the maximum stack depth. It
installs no `ClassShutter` and no restrictive `WrapFactory`.

`initSafeStandardObjects()` omits the LiveConnect entry points (`Packages`, `java`, `getClass`, `JavaAdapter`, ...), so
at first glance no Java object is reachable from a script. However, when a script catches an `EcmaError`, `EvaluatorException`
or wrapped Java exception, Rhino's `ScriptRuntime.newCatchScope` defines the properties `rhinoException` (and
`javaException` for wrapped Java exceptions) on the caught error object, containing the wrapped Java exception. Rhino
only omits these properties if a configured `ClassShutter` hides the exception class from scripts:

```java
private static boolean isVisible(Context cx, Object obj) {
    ClassShutter shutter = cx.getClassShutter();
    return shutter == null || shutter.visibleToScripts(obj.getClass().getName());
}
```

As no `ClassShutter` is configured, the script receives a live Java object. Via `getClass()` it obtains a
`java.lang.Class` instance and from there, using the public reflection API of `java.base`, any class and method of the
JVM. Neither the execution time limit, the stack depth limit nor the script size limit prevent this, and Java 25 has no
`SecurityManager` which could restrict reflection.

The mapping script is evaluated with
[`Context.evaluateString`](https://github.com/eclipse-ditto/ditto/blob/3.9.9/connectivity/service/src/main/java/org/eclipse/ditto/connectivity/service/mapping/javascript/JavaScriptMessageMapperRhino.java#L210-L223)
when the payload mapper is configured, i.e. top-level code of the script runs when the connection is opened, and code
inside the mapping functions runs for each mapped message.

The `JavaScript` mapper is enabled by default
([`connectivity.conf`](https://github.com/eclipse-ditto/ditto/blob/3.9.9/connectivity/service/src/main/resources/connectivity.conf#L86)).
Connections are managed via `/api/2/connections` and DevOps piggyback commands, which require authentication in the
DevOps realm
([`ConnectionsRoute.java#L110`](https://github.com/eclipse-ditto/ditto/blob/3.9.9/gateway/service/src/main/java/org/eclipse/ditto/gateway/service/endpoints/routes/connections/ConnectionsRoute.java#L110)).

The sandbox restriction is documented in the
[payload mapping documentation](https://eclipse.dev/ditto/connectivity-mapping.html) ("No access to Java packages or
classes"). The vulnerability affects all Ditto versions since the JavaScript payload mapper was introduced in 0.3.0-M1,
independent of the bundled Rhino version.

### Impact

A user with permission to create or modify connections can execute arbitrary code in the Ditto connectivity service:

- read the configuration and environment of the connectivity service, including database credentials and the
  credentials of all connections,
- send arbitrary messages within the Pekko cluster to the other Ditto services, bypassing authorization,
- access the network of the deployment, the file system of the container and, in Kubernetes, the service account of
  the connectivity pod,
- disrupt or take over the connectivity service.

In a default deployment, connection management requires DevOps credentials. The vulnerability turns these into code
execution in the connectivity service and access to resources outside of Ditto's permission model. Deployments which
delegate the management of connections or of mapping scripts to less trusted users (e.g. per-tenant connection
management on top of Ditto) are affected the most.

### Patches

The fix installs a deny-by-default `ClassShutter` for all JavaScript mapping executions, independent of the
`allowUnsafeStandardObjects` setting, so that no Java object becomes visible to mapping scripts.

Patched versions: 3.9.10 and 3.8.16.

### Workarounds

- Disable the `JavaScript` payload mapper by removing
  `org.eclipse.ditto.connectivity.service.mapping.javascript.JavaScriptMessageMapperRhino` from
  `ditto.connectivity.mapping.message-mapper-provider.extension-config.message-mappers` in the connectivity
  configuration. Connections using JavaScript payload mapping can then no longer be opened.
- Restrict access to the DevOps realm (`/api/2/connections`, `/devops`) to fully trusted administrators, and review the
  `incomingScript` / `outgoingScript` of existing connections.

### Credits

Ditto thanks Jiwoo Kim ([@arpe1618](https://github.com/arpe1618)) for reporting this vulnerability.

### References

- CVE-2026-135203
- [Rhino `ClassShutter`](https://javadoc.io/doc/org.mozilla/rhino/latest/org/mozilla/javascript/ClassShutter.html)

## References

- https://github.com/eclipse-ditto/ditto/security/advisories/GHSA-9mpq-m32x-4q7p

Page: https://cve.now/GHSA-9MPQ-M32X-4Q7P

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
