CVE-2022-25168: Hadoop common Apache Hadoop Argument Injection Vulnerability Vulnerability

CRITICAL
Advisory Identifier: GHSA-8wm5-8h9c-47pc
CVSS 9.8
CWE-78 CWE-88
Published
Advisory Summary

CVE-2022-25168 is a CRITICAL (CVSS 9.8) apache hadoop argument injection vulnerability vulnerability (CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')) affecting Hadoop common libraries in the Maven ecosystem. The issue involves apache hadoop argument injection vulnerability. Remediation is available by upgrading affected packages to version 2.10.2, 3.2.4, 3.3.3.

CVE-2022-25168 at a Glance

CVE Identifier CVE-2022-25168
GHSA Identifier GHSA-8wm5-8h9c-47pc
Severity CRITICAL
CVSS v3.1 Base Score 9.8
CWE Classification CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
Affected Product Hadoop common
Package Ecosystem Maven
Published Date
Last Updated

Security Impact

CVSS: 9.8

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

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
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-25168

To remediate this vulnerability, upgrade all affected Hadoop common 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.hadoop:hadoop-common fixed: 2.10.2
<dependency>
    <groupId>org.apache.hadoop</groupId>
    <artifactId>hadoop-common</artifactId>
    <version>2.10.2</version>
</dependency>
org.apache.hadoop:hadoop-common fixed: 3.2.4
<dependency>
    <groupId>org.apache.hadoop</groupId>
    <artifactId>hadoop-common</artifactId>
    <version>3.2.4</version>
</dependency>
org.apache.hadoop:hadoop-common fixed: 3.3.3
<dependency>
    <groupId>org.apache.hadoop</groupId>
    <artifactId>hadoop-common</artifactId>
    <version>3.3.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.hadoop

How to Check if You Are Affected

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

mvn dependency:tree -Dincludes=org.apache.hadoop

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

Note: The mvn dependency:tree -Dincludes=org.apache.hadoop 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 Hadoop common, 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

Apache Hadoop's `FileUtil.unTar(File, File)` API does not escape the input file name before being passed to the shell. An attacker can inject arbitrary commands. This is only used in Hadoop 3.3 InMemoryAliasMap.completeBootstrapTransfer, which is only ever run by a local user. It has been used in Hadoop 2.x for yarn localization, which does enable remote code execution. It is used in Apache Spark, from the SQL command ADD ARCHIVE. As the ADD ARCHIVE command adds new binaries to the classpath, being able to execute shell scripts does not confer new permissions to the caller. SPARK-38305. "Check existence of file before untarring/zipping", which is included in 3.3.0, 3.1.4, 3.2.2, prevents shell commands being executed, regardless of which version of the hadoop libraries are in use. Users should upgrade to Apache Hadoop 2.10.2, 3.2.4, 3.3.3 or upper (including HADOOP-18136).

CVE-2022-25168 Affected Hadoop common Versions

3 component(s)
Fixed Versions:
2.10.23.2.43.3.3
Product / Package Ecosystem Affected Versions Fixed Version
org.apache.hadoop:hadoop-common
Maven
≥ 2.0.0
< 2.10.2
2.10.2
org.apache.hadoop:hadoop-common
Maven
≥ 3.0.0-alpha
< 3.2.4
3.2.4
org.apache.hadoop:hadoop-common
Maven
≥ 3.3.0
< 3.3.3
3.3.3

References

Frequently Asked Questions

What is CVE-2022-25168?
CVE-2022-25168 is a security vulnerability in Hadoop common involving Apache Hadoop argument injection vulnerability under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').
Which Hadoop common versions are affected?
Affected versions include releases prior to 2.10.2, 3.2.4, 3.3.3 across affected packages: org.apache.hadoop:hadoop-common.
What version fixes CVE-2022-25168?
Upgrading to 2.10.2, 3.2.4, 3.3.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is hadoop-common affected?
Yes, org.apache.hadoop:hadoop-common is affected in releases prior to 2.10.2, 3.2.4, 3.3.3. Upgrade your dependency to 2.10.2, 3.2.4, 3.3.3 or later.
What is the CVSS score of CVE-2022-25168?
CVE-2022-25168 has a CVSS v3.1 base score of 9.8 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2022-25168?
CVE-2022-25168 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-25168?
Run the dependency tree command: 'mvn dependency:tree -Dincludes=org.apache.hadoop'. 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-8wm5-8h9c-47pc",
  "modified" : "2022-08-11T21:14:19Z",
  "published" : "2022-08-05T00:00:24Z",
  "aliases" : [ "CVE-2022-25168" ],
  "summary" : "Apache Hadoop argument injection vulnerability",
  "details" : "Apache Hadoop's `FileUtil.unTar(File, File)` API does not escape the input file name before being passed to the shell. An attacker can inject arbitrary commands. This is only used in Hadoop 3.3 InMemoryAliasMap.completeBootstrapTransfer, which is only ever run by a local user. It has been used in Hadoop 2.x for yarn localization, which does enable remote code execution. It is used in Apache Spark, from the SQL command ADD ARCHIVE. As the ADD ARCHIVE command adds new binaries to the classpath, being able to execute shell scripts does not confer new permissions to the caller. SPARK-38305. \"Check existence of file before untarring/zipping\", which is included in 3.3.0, 3.1.4, 3.2.2, prevents shell commands being executed, regardless of which version of the hadoop libraries are in use. Users should upgrade to Apache Hadoop 2.10.2, 3.2.4, 3.3.3 or upper (including HADOOP-18136).",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.apache.hadoop:hadoop-common"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.0.0"
      }, {
        "fixed" : "2.10.2"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.apache.hadoop:hadoop-common"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.0.0-alpha"
      }, {
        "fixed" : "3.2.4"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.apache.hadoop:hadoop-common"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.3.0"
      }, {
        "fixed" : "3.3.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-25168"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/apache/hadoop/commit/cae749b076f35f0be13a926ee8cfbb7ce4402746"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/apache/hadoop"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread/mxqnb39jfrwgs3j6phwvlrfq4mlox130"
  }, {
    "type" : "WEB",
    "url" : "https://security.netapp.com/advisory/ntap-20220915-0007"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-78", "CWE-88" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-08-11T21:14:19Z",
    "nvd_published_at" : "2022-08-04T15:15:00Z"
  }
}