Apache NiFi 2.8.0 — EXECUTE_CODE Permission Bypass to Groovy RCE (CVE-2026-39816)
by ZeroPath (ZeroPathAI) · 2026-07-05
- Severity
- Critical
- CVE
- CVE-2026-39816
- Category
- web
- Affected product
- Apache NiFi (with the optional graph bundle / nifi-other-graph-services-nar)
- Affected versions
- 2.8.0 (fixed in 2.9.0)
- Disclosed
- 2026-07-05
- Patch status
- patched
References
Archive entry
intelseclab/poc-archiveMetadata
| Field | Value |
|---|---|
| Date Added | 2026-07-05 |
| Last Updated | 2026-05 |
| Author / Researcher | ZeroPath (ZeroPathAI) |
| CVE / Advisory | CVE-2026-39816 |
| Category | web |
| Severity | Critical |
| CVSS Score | Not specified in source |
| Status | Weaponized |
| Tags | apache-nifi, groovy, code-injection, privilege-escalation, rce, graph-bundle, authenticated |
| Related | N/A |
Affected Target
| Field | Value |
|---|---|
| Software / System | Apache NiFi (with the optional graph bundle / nifi-other-graph-services-nar) |
| Versions Affected | 2.8.0 (fixed in 2.9.0) |
| Language / Platform | Python (exploit) targeting a Java web application (NiFi) |
| Authentication Required | Yes (flow-designer permissions, explicitly without EXECUTE_CODE) |
| Network Access Required | Yes |
Summary
Apache NiFi restricts all of its 16 dedicated script-execution processors behind an EXECUTE_CODE permission, enforced via a @Restricted annotation. However, the optional graph bundle’s TinkerpopClientService — used by the ExecuteGraphQuery / ExecuteGraphQueryRecord processors — implements its own Groovy-based “bytecode submission” code path that is missing this annotation. A flow designer who has read/write access to build pipelines but has been deliberately denied EXECUTE_CODE can still configure a TinkerpopClientService and an ExecuteGraphQuery processor with arbitrary Groovy in the “Graph Query” property; starting the processor compiles and executes that Groovy directly in the NiFi JVM, bypassing the intended security boundary entirely.
Vulnerability Details
Root Cause
TinkerpopClientService.bytecodeSubmission() (in nifi-other-graph-services) compiles and runs an attacker-supplied Groovy string via groovyShell.parse(s) / compiled.run() with no sanitization, allowlist, or sandboxing, and neither this service nor the processors that drive it carry the @Restricted(requiredPermission = EXECUTE_CODE) annotation applied to every other scripting component (CWE-95).
Attack Vector
- As a user with flow-designer permissions (process-group and
/controllerread/write) but explicitly withoutEXECUTE_CODE, configure aTinkerpopClientServicecontroller service in “ByteCode Submission” mode, pointing at any reachable Gremlin server (used only for initialization). - Create an
ExecuteGraphQueryprocessor and place attacker-controlled Groovy code in its “Graph Query” property. - Start the processor; NiFi compiles and executes the Groovy in the NiFi service account’s JVM context on its own timer, with no upstream connection or FlowFile content required.
- Use the resulting code execution to read secrets, pivot to connected systems, or establish persistence.
Impact
Arbitrary code execution as the NiFi service account, exposing the keystore, sensitive properties key, flow-encrypted secrets, and any downstream systems reachable from NiFi (databases, message buses, object storage) — precisely the access EXECUTE_CODE is meant to gate.
Environment / Lab Setup
Target: Apache NiFi 2.8.0 with nifi-other-graph-services-nar installed
Attacker: Docker, Python 3.10+, uv
Proof of Concept
PoC Script
See
pocs/flow_designer_groovy_rce.py(exploit) andsetup/setup.sh/setup/docker-compose.yml/setup/teardown.sh(lab environment) in this folder.
| |
The script authenticates as a restricted flow_designer user, first confirms ExecuteScript is correctly denied by the EXECUTE_CODE gate, then creates a TinkerpopClientService + ExecuteGraphQuery processor with Groovy that spawns a reverse shell, upgrading it to a fully interactive PTY-backed session inside the NiFi container.
Detection & Indicators of Compromise
Signs of compromise:
- Creation or modification of
TinkerpopClientService/ExecuteGraphQuerycomponents by non-privileged flow-designer accounts - Unexpected outbound shell connections originating from the NiFi host process
Remediation
| Action | Detail |
|---|---|
| Primary fix | Upgrade to Apache NiFi 2.9.0 or later, which restricts the graph bundle’s code-execution path behind EXECUTE_CODE |
| Interim mitigation | Remove the nifi-other-graph-services-nar bundle if unused, or restrict EXECUTE_CODE and flow-editing permissions to fully trusted users only |
References
Notes
Mirrored from https://github.com/ZeroPathAI/nifi-CVE-2026-39816-poc on 2026-07-05.