Command injection in org.apache.hadoop.fs.FileUtil.unTarUsingTar
Apache Software Foundation Apache Hadoop
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| org.apache.hadoop:hadoop-common Maven |
|
|
Apache Software Foundation Apache Hadoop
| Product | Affected | Fixed in |
|---|---|---|
| org.apache.hadoop:hadoop-common Maven |
|
|
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).
From the CVE record · apache
Apache Hadoop’s FileUtil.unTar(File, File) passes an unescaped input filename to the shell, allowing an attacker to inject commands. Its use in Hadoop 2.x YARN localization can enable remote code execution; in Hadoop 3.3, the affected bootstrap operation is run only by a local user. Apache Spark also uses the API through ADD ARCHIVE, but executing shell scripts there does not grant the caller additional permissions.
Teams running Apache Hadoop or Maven package org.apache.hadoop:hadoop-common in versions >=2.0.0 <2.10.2, >=3.0.0-alpha <3.2.4, or >=3.3.0 <3.3.3 should check their deployments.