Xem phiên bản tiếng Việt tại đây / Read the Vietnamese version
| Information | Details |
|---|---|
| CyStack Advisory ID | CSA-2026-SYNCOPE-01 |
| CVE IDs | CVE-2026-42782 |
| Severity | High |
| CVSS v3.1 Score (NVD) | 7.2 |
| Affected versions | Apache Syncope 3.0 through 3.0.16, 4.0 through 4.0.5, and 4.1.0 |
| Fixed versions | Apache Syncope 4.0.6 / 4.1.1 |
| Vendor advisory | https://lists.apache.org/thread/b869ms0ofrd129f7tgsn9flxgv9ztg2r |
| NVD | https://nvd.nist.gov/vuln/detail/CVE-2026-42782 |
Summary
Apache Syncope is an open-source Identity Management platform, commonly used to manage users, groups, roles, entitlements, and account provisioning flows in enterprise environments.
While reviewing the sandbox mechanism that Apache Syncope applies to Groovy code, I found a post-authentication Remote Code Execution (RCE) flaw. The bug lets an administrator, or any user holding sufficient privileges to create an Implementation, load a malicious Groovy class and execute commands directly inside the Syncope process.
What makes the bug interesting is a very small gap in execution order: Syncope instantiates the object from the Groovy class first, and only attaches the sandbox protection layer afterwards. If the payload (the attacker’s code) is placed inside a static {} block, the Java Virtual Machine (JVM) runs it while the class is being loaded and initialized, that is, before the sandbox is ever in place.
This is not an isolated bug: it is a bypass of the fix for CVE-2025-57738. That earlier fix had introduced a sandbox for Groovy but missed the time window during which the class is initialized. The vulnerability was published by Apache as CVE-2026-42782 and fixed in Apache Syncope 4.0.6 / 4.1.1.
Remote Code Execution via Groovy
Background
Syncope lets administrators write extension logic in Groovy through an entity called an Implementation. This is a powerful feature, because a Groovy Implementation can participate in many internal processing flows such as workflows, propagation, macro actions, and correlation rules.
But precisely because it is powerful, it must be tightly controlled. A user-supplied Groovy snippet should not be allowed to freely call ProcessBuilder, Runtime.exec, read/write arbitrary files, or touch other dangerous APIs.
To address this, the CVE-2025-57738 fix (shipped in 3.0.14 / 4.0.2) introduced a Groovy sandbox layer based on Jenkins’ script-security library. The mechanism has two parts:
- At compile time: a source transformer (
SandboxTransformer) rewrites every method call and constructor call into controlled calls of the formChecker.checkedCall(...)/Checker.checkedConstructor(...). - At runtime: an intermediary wrapper (proxy) attaches an interceptor (
SandboxInterceptor) for the duration of every method call on the object. This interceptor decides which calls are allowed and which are rejected.
By design, the lifecycle of a Groovy Implementation is expected to unfold as follows:
flowchart LR
A[Compile Groovy source<br/>with SandboxTransformer] --> B[Create object / bean]
B --> C[Wrap bean with<br/>AspectJ proxy + GroovySandbox]
C --> D[A method is invoked]
D --> E{SandboxInterceptor<br/>checks the call}
E -->|Allowed| F[Permit execution]
E -->|Dangerous| G[Block / throw]
style C fill:#cde,stroke:#36c
style E fill:#cde,stroke:#36c
On paper this looks sound: every dangerous call must ultimately pass through the interceptor. The problem is that this security boundary is established a little too late.
Root Cause
The crux lies in the bean-creation logic of the ImplementationManager class. Stripped down, the flow looks like this:
// (1) Instantiate the object from the Groovy class. <clinit> runs RIGHT HERE. T bean = ApplicationContextProvider.getBeanFactory().createBean(clazz);if (engine == ImplementationEngine.GROOVY) { // (2) Only now is the sandbox attached, too late. AspectJProxyFactory factory = new AspectJProxyFactory(bean); factory.addAspect(new GroovySandbox(...)); bean = factory.getProxy(); }
At a glance the code seems fine: if the Implementation uses Groovy, Syncope creates a proxy and attaches GroovySandbox to the bean. But execution order is what matters here.
The line createBean(clazz) does not merely create an empty object. During that process the JVM must initialize the class, and if the class has a static initializer, that code runs at exactly this moment.
In Groovy, the following block:
static {
// code here
}
is compiled by the compiler into the bytecode’s class initializer method, <clinit>. Per the JVM specification, <clinit> runs exactly once, the first time the class is initialized, and the createBean call above is precisely what triggers that moment.
This is where the gap appears:
sequenceDiagram
participant A as Attacker
participant API as Syncope REST API
participant IM as ImplementationManager
participant JVM as JVM / ClassLoader
participant SB as GroovySandbox (proxy)
A->>API: POST /implementations (Groovy containing a static{} block)
API->>IM: build(impl)
IM->>JVM: parseClass(source), load class
IM->>JVM: createBean(clazz), initialize class
rect rgb(255, 224, 224)
JVM->>JVM: run clinit = the static{} block
Note over JVM: ProcessBuilder(...).start() ⇒ RCE, NO sandbox is active
end
IM->>SB: addAspect(GroovySandbox)
Note over IM,SB: The sandbox is attached only here, too late
API-->>A: HTTP 201 Created
In other words: the sandbox does exist, but it arrives after the payload has already run.
Why the Sandbox Is Bypassed
The Groovy sandbox is not just a compile-time check. As noted, the transformer rewrites dangerous calls into Checker.checkedCall(...) / Checker.checkedConstructor(...), but Checker itself still needs a runtime interceptor to decide whether a call is permitted.
At the moment static {} runs, no GroovyInterceptor has been registered yet, because the proxy (the thing responsible for registering the interceptor) is only created after createBean returns. When Checker asks “what is the list of currently applicable interceptors?”, it gets back an empty list, and falls straight through to direct execution:
flowchart TD
A["Rewritten call:<br/>Checker.checkedConstructor(ProcessBuilder, ...)"] --> B["getApplicableInterceptors()"]
B --> C{Any interceptor<br/>currently active?}
C -->|"Normally: yes"| D[SandboxInterceptor checks whitelist<br/>⇒ blocks ProcessBuilder]
C -->|"Inside static{}: EMPTY list"| E["Direct invocation<br/>InvokerHelper.invokeConstructorOf(...)"]
E --> F["ProcessBuilder executes<br/>UNCONTROLLED ⇒ RCE"]
style E fill:#fdd,stroke:#c33
style F fill:#fdd,stroke:#c33
The result is that code which should have been blocked by the sandbox runs freely inside the static initializer. A minimal payload looks like this:
import org.apache.syncope.core.provisioning.api.macro.MacroActionsclass P implements MacroActions { static { new ProcessBuilder(["/bin/sh", "-c", "id > /tmp/SYNCOPE_PWN"]).start().waitFor() } }
The bodies of the methods in the MacroActions interface are irrelevant, they never need to be called. The payload runs as soon as the class is initialized, before the sandbox proxy is created.
A point worth highlighting from a research perspective: the CVE-2025-57738 fix correctly handled abuse of AST transforms (such as @Grab, @ASTTest) and brought method bodies into the sandbox, but it missed the class-initialization window. It is the same root-cause family (untrusted Groovy code reaching a non-sandboxed execution path), just through a different entry point.
Exploitation
The prerequisite is that the attacker must hold the privilege to create an Implementation. In most environments this privilege belongs to administrators. However, if the authorization model is customized and the IMPLEMENTATION_CREATE entitlement is granted to another user, that user also qualifies as an attacker.
The payload is sent through Syncope’s Implementation-creation API:
POST /syncope/rest/implementations/MACRO_ACTIONS/<key> Authorization: Basic <credentials> Content-Type: application/json{"key":"<key>","engine":"GROOVY","type":"MACRO_ACTIONS","body":"<Groovy source>"}
When the request is processed, ImplementationDataBinderImpl.create() calls ImplementationManager.build(impl) synchronously. This flow leads to the Groovy class being parsed and then the bean being created, and as analyzed above, <clinit> runs right inside the bean-creation step. As a result, the RCE happens before the HTTP response is returned.
A successful request returns HTTP 201 Created, but by that point the command has already executed inside the Syncope JVM. The created Implementation is also persisted to the database; deleting it afterwards cannot undo the RCE that already ran.
In a test environment, I used Docker Compose to stand up Apache Syncope 4.1.0 and confirmed the payload writes a marker file inside the container:
[+] HTTP 201 (201 = implementation created, static{} executed)
[*] reading RCE marker from container:
uid=1000(syncope) gid=1000(syncope) groups=1000(syncope)
I also reconfirmed it on Apache Syncope 3.0.15. Per the official advisory, the affected versions are 3.0 through 3.0.16, 4.0 through 4.0.5, and 4.1.0.
Impact
This is a post-authentication RCE, not an unauthenticated one. Even so, in the context of an Identity Management platform, the privilege to create an Implementation is highly sensitive with this system itself holds the “keys” to the entire organization’s identities.
On successful exploitation, the attacker can run commands with the privileges of the Syncope process. Depending on the deployment, this can lead to:
- Reading configuration and secrets accessible to the Syncope process.
- Obtaining database credentials or integration tokens for other systems.
- Tampering with provisioning logic.
- Using Syncope as a pivot point to attack deeper into the internal network.
- Maintaining long-term persistence through malicious Implementations.
Notably, the payload does not need to wait for a workflow or any other action to trigger an Implementation’s method. The code runs at the very moment the Implementation is created.
On scoring: NVD rated the CVSS v3.1 at 7.2 (vector AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H), reflecting the high-privilege requirement (PR:H). However, it is worth noting that in practice many publicly exposed Syncope installations still run the default admin/password. The 3.0.15 startup log even emits a default-credentials warning that is rarely acted upon. Factoring this in, the real-world risk of the vulnerability is considerably higher than the 7.2 figure suggests.
Remediation
Apache fixed the bug in Syncope 4.0.6 and 4.1.1. Per the advisory, the fix ensures that static initializers in Groovy code also run inside the sandbox.
Users should upgrade to one of the fixed versions:
- Apache Syncope 4.0.6
- Apache Syncope 4.1.1
Technically, the correct remediation is to ensure the interceptor is registered before the class is initialized. A few viable approaches:
- Wrap the
createBean(clazz)call itself in atry { interceptor.register(); ... } finally { interceptor.unregister(); }block so the sandbox is in effect throughout initialization. - Load the class without immediately initializing it, using
Class.forName(name, false, loader), and defer instantiation until it sits inside the proxy boundary. - Register a process-wide
SandboxInterceptorthat is in effect for the entire lifetime of theGROOVY_CLASSLOADER.
Beyond upgrading, organizations running Syncope should review the entitlements related to Implementations. The IMPLEMENTATION_CREATE entitlement should be treated as high-risk, because it lets a user inject executable logic into the server-side runtime. At the same time, rotate any default credentials immediately.
Timeline
- 2026-04-25: I confirmed successful exploitation on
apache/syncope:4.1.0andapache/syncope:3.0.15, and privately reported it to the Apache Syncope security team. - 2026-05-25: Apache published the advisory for CVE-2026-42782.
- 2026-05-25: The CVE record was published.
- 2026-05-27: NVD updated the CVSS v3.1 score to 7.2 (HIGH) and the affected version (CPE) ranges.
References
- Apache advisory: https://lists.apache.org/thread/b869ms0ofrd129f7tgsn9flxgv9ztg2r
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-42782
- oss-security mirror: https://www.openwall.com/lists/oss-security/2026/05/25/4
- Apache Syncope: https://syncope.apache.org/
- CVE-2025-57738 (the predecessor vulnerability whose fix this bypasses): https://nvd.nist.gov/vuln/detail/CVE-2025-57738