CVE-2022-25168 Command injection in org.apache.hadoop.fs.FileUtil.unTarUsingTar

Critical 9.8 Published Updated

Attackers can inject arbitrary shell commands via unescaped file names in Hadoop's untar utility, potentially leading to remote code execution.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2022-25168?

CVE-2022-25168 is a critical command injection vulnerability in Apache Hadoop, published on 4 Aug 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

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).

Weakness: CWE-78

Which versions are affected by CVE-2022-25168?

6 open source packages ship an affected version, including org.apache.hadoop:hadoop-common. It affects 1 product.

PackageAffectedFixed in
org.apache.hadoop:hadoop-common MavenFrom 2.0.02.10.2
org.apache.hadoop:hadoop-common MavenFrom 2.0.02.10.2
org.apache.hadoop:hadoop-common MavenFrom 3.0.0-alpha3.2.4
org.apache.hadoop:hadoop-common MavenFrom 3.0.0-alpha3.2.4
org.apache.hadoop:hadoop-common MavenFrom 3.3.03.3.3
org.apache.hadoop:hadoop-common MavenFrom 3.3.03.3.3

Products include Apache Hadoop.

How do I fix CVE-2022-25168?

Upgrade org.apache.hadoop:hadoop-common to a fixed version for your release line: 2.10.2, 3.2.4 or 3.3.3.

Upgrade, and pass arguments to programs as a list instead of through a shell. More about Command injection.

Is CVE-2022-25168 being exploited?

There is no known exploitation of CVE-2022-25168 in the wild and no public exploit code.

Sources

Also known as GHSA-8wm5-8h9c-47pc.

Is CVE-2022-25168 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free