Add Apache NiFi ExecuteGraphQuery Tinkerpop Groovy RCE module (CVE-2026-39816) - #21852
Open
M4xSec wants to merge 2 commits into
Open
Add Apache NiFi ExecuteGraphQuery Tinkerpop Groovy RCE module (CVE-2026-39816)#21852M4xSec wants to merge 2 commits into
M4xSec wants to merge 2 commits into
Conversation
Adds an exploit module for CVE-2026-39816. The TinkerpopClientService in Apache NiFi 2.0.0-M1 through 2.8.0 is missing the Restricted annotation that carries the Execute Code required permission, and the ExecuteGraphQuery / ExecuteGraphQueryRecord processors that drive it are not gated by Execute Code either. A flow author who has been explicitly denied Execute Code, but still has read/write on a process group and the controller, can create the service in bytecode-submission mode and an ExecuteGraphQuery whose Graph Query is Groovy. The processor compiles and evaluates the Groovy with a local GremlinGroovyScriptEngine before any graph traversal, so it runs as the NiFi service account and bypasses the restriction. Fixed in 2.9.0. The module logs in through the configured OpenID Connect provider (NiFi 2.x secured mode has no local login), or takes an existing bearer token, creates the controller service and processor, runs a command payload, and removes both components on cleanup. Tested against Apache NiFi 2.8.0 fronted by Keycloak OIDC. Signed-off-by: venexy <predator0x300@gmail.com>
Contributor
|
nifi is available on docker. can you create a dockerfile or comparable (docker compose) that setups up the environment in a way that can be exploited? |
The module only authenticated through the external OIDC flow, so it could not log in to a stock single-user or LDAP-backed NiFi, which are the common lab and on-prem setups. Read authentication/configuration and, when externalLoginRequired is false, post the credentials to /access/token for the bearer token; keep the OIDC dance for federated installs. USERNAME and PASSWORD now work against either, and BEARER-TOKEN still short-circuits both. Verified end to end against a single-user 2.8.0 lab with the graph bundle: a flow author denied Execute Code gets 403 on ExecuteScript while ExecuteGraphQuery runs Groovy as the nifi user. Signed-off-by: venexy <predator0x300@gmail.com>
Author
|
Hi @h00die Added a docker-compose lab for it: README has the run steps and the module invocation. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Exploit module for CVE-2026-39816. The
TinkerpopClientServicein Apache NiFi2.0.0-M1 through 2.8.0 is missing the
@Restrictedannotation that carries theExecute Code required permission, and the
ExecuteGraphQuery/ExecuteGraphQueryRecordprocessors that use it are not gated by Execute Codeeither. The processor compiles and evaluates its "Graph Query" with a local
GremlinGroovyScriptEnginebefore it ever connects to a graph database, so aflow author who has been explicitly denied Execute Code (the policy that guards
ExecuteScriptandExecuteProcess), but who still has read/write on a processgroup and the controller, can create the service in
bytecode-submissionmodeplus an
ExecuteGraphQuerywhose query is Groovy, and run code as the NiFiservice account. This bypasses the restriction that NiFi's Restricted machinery
is meant to enforce.
Exploitation needs the optional graph bundle (
nifi-other-graph-services-nar,which ships
TinkerpopClientService) installed; servers without it are notaffected. Fixed in NiFi 2.9.0.
NiFi 2.x secured installations have no local login, so the module drives the
Spring Security OIDC login (authorize redirect, credential POST, callback) to
obtain the NiFi JWT from
USERNAME/PASSWORD, or accepts an existingBEARER-TOKEN. It creates the controller service and processor, runs a commandpayload, and removes both components on cleanup. NiFi does not disclose its
version on the unauthenticated API, so
checkconfirms the API is reachable andreports
Detectedwhen the build is not disclosed.Verification
nifi-other-graph-services-narbundle and OIDC configureduse exploit/linux/http/apache_nifi_tinkerpop_groovy_rceset RHOSTS,VHOST,USERNAME,PASSWORD(orBEARER-TOKEN),LHOST,PAYLOADcheckreports the NiFi API is reachablerunTested against Apache NiFi 2.8.0 fronted by Keycloak OIDC.