CVE-2022-33140: Nifi registry core Code Injection Vulnerability

HIGH
Advisory Identifier: GHSA-77hf-23pq-2g7c
CVSS 8.8
CWE-78 CWE-74
Published
Advisory Summary

CVE-2022-33140 is a HIGH (CVSS 8.8) code injection vulnerability (CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')) affecting Nifi registry core libraries in the Maven ecosystem. The issue involves code injection in apache nifi and nifi registry. Remediation is available by upgrading affected packages to version 1.16.3.

CVE-2022-33140 at a Glance

CVE Identifier CVE-2022-33140
GHSA Identifier GHSA-77hf-23pq-2g7c
Severity HIGH
CVSS v3.1 Base Score 8.8
CWE Classification CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
Affected Product Nifi registry core
Package Ecosystem Maven
Published Date
Last Updated

Security Impact

CVSS: 8.8

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2022-33140

To remediate this vulnerability, upgrade all affected Nifi registry core dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

org.apache.nifi.registry:nifi-registry-core fixed: 1.16.3
<dependency>
    <groupId>org.apache.nifi.registry</groupId>
    <artifactId>nifi-registry-core</artifactId>
    <version>1.16.3</version>
</dependency>
org.apache.nifi:nifi fixed: 1.16.3
<dependency>
    <groupId>org.apache.nifi</groupId>
    <artifactId>nifi</artifactId>
    <version>1.16.3</version>
</dependency>
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

mvn dependency:tree -Dincludes=org.apache.nifi.registry

How to Check if You Are Affected

To determine whether your Java application is affected by CVE-2022-33140, inspect your build dependencies using the Maven Dependency Plugin:

mvn dependency:tree -Dincludes=org.apache.nifi.registry

Analyze the terminal output to locate any version of Nifi registry core in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.16.3), your application is affected.

Note: The mvn dependency:tree -Dincludes=org.apache.nifi.registry command inspects the resolved dependency graph declared in your project's POM files; it does not perform automated security scanning or inspect runtime dynamic classpaths. Always verify runtime container classpaths and shaded JARs.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), where the product constructs all or part of an os command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended os command when it is sent to a downstream component. In Nifi registry core, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

The optional ShellUserGroupProvider in Apache NiFi 1.10.0 to 1.16.2 and Apache NiFi Registry 0.6.0 to 1.16.2 does not neutralize arguments for group resolution commands, allowing injection of operating system commands on Linux and macOS platforms. The ShellUserGroupProvider is not included in the default configuration. Command injection requires ShellUserGroupProvider to be one of the enabled User Group Providers in the Authorizers configuration. Command injection also requires an authenticated user with elevated privileges. Apache NiFi requires an authenticated user with authorization to modify access policies in order to execute the command. Apache NiFi Registry requires an authenticated user with authorization to read user groups in order to execute the command. The resolution removes command formatting based on user-provided arguments.

CVE-2022-33140 Affected Nifi registry core Versions

2 component(s)
Fixed Versions:
1.16.3
Product / Package Ecosystem Affected Versions Fixed Version
org.apache.nifi.registry:nifi-registry-core
Maven
≥ 0.6.0
< 1.16.3
1.16.3
org.apache.nifi:nifi
Maven
≥ 1.10.0
< 1.16.3
1.16.3

References

Frequently Asked Questions

What is CVE-2022-33140?
CVE-2022-33140 is a security vulnerability in Nifi registry core involving Code injection in Apache NiFi and NiFi Registry under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').
Which Nifi registry core versions are affected?
Affected versions include releases prior to 1.16.3 across affected packages: org.apache.nifi.registry:nifi-registry-core, org.apache.nifi:nifi.
What version fixes CVE-2022-33140?
Upgrading to 1.16.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is nifi-registry-core affected?
Yes, org.apache.nifi.registry:nifi-registry-core is affected in releases prior to 1.16.3. Upgrade your dependency to 1.16.3 or later.
Is nifi affected?
Yes, org.apache.nifi:nifi is affected in releases prior to 1.16.3. Upgrade your dependency to 1.16.3 or later.
What is the CVSS score of CVE-2022-33140?
CVE-2022-33140 has a CVSS v3.1 base score of 8.8 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2022-33140?
CVE-2022-33140 is classified under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') (The product constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.).
How can I check Maven dependencies for CVE-2022-33140?
Run the dependency tree command: 'mvn dependency:tree -Dincludes=org.apache.nifi.registry'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-77hf-23pq-2g7c",
  "modified" : "2022-11-03T22:19:38Z",
  "published" : "2022-06-16T00:00:26Z",
  "aliases" : [ "CVE-2022-33140" ],
  "summary" : "Code injection in Apache NiFi and NiFi Registry",
  "details" : "The optional ShellUserGroupProvider in Apache NiFi 1.10.0 to 1.16.2 and Apache NiFi Registry 0.6.0 to 1.16.2 does not neutralize arguments for group resolution commands, allowing injection of operating system commands on Linux and macOS platforms. The ShellUserGroupProvider is not included in the default configuration. Command injection requires ShellUserGroupProvider to be one of the enabled User Group Providers in the Authorizers configuration. Command injection also requires an authenticated user with elevated privileges. Apache NiFi requires an authenticated user with authorization to modify access policies in order to execute the command. Apache NiFi Registry requires an authenticated user with authorization to read user groups in order to execute the command. The resolution removes command formatting based on user-provided arguments.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.apache.nifi.registry:nifi-registry-core"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.6.0"
      }, {
        "fixed" : "1.16.3"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.apache.nifi:nifi"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.10.0"
      }, {
        "fixed" : "1.16.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-33140"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/apache/nifi"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread/bzs2pcdjsdrh5039oslmfr9mbs9qqdhr"
  }, {
    "type" : "WEB",
    "url" : "https://nifi.apache.org/security.html#CVE-2022-33140"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-74", "CWE-78" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-06-17T21:49:10Z",
    "nvd_published_at" : "2022-06-15T15:15:00Z"
  }
}