CVE-2022-25168 Command injection in org.apache.hadoop.fs.FileUtil.unTarUsingTar
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.
| Package | Affected | Fixed in |
|---|---|---|
org.apache.hadoop:hadoop-common Maven | From 2.0.0 | 2.10.2 |
org.apache.hadoop:hadoop-common Maven | From 2.0.0 | 2.10.2 |
org.apache.hadoop:hadoop-common Maven | From 3.0.0-alpha | 3.2.4 |
org.apache.hadoop:hadoop-common Maven | From 3.0.0-alpha | 3.2.4 |
org.apache.hadoop:hadoop-common Maven | From 3.3.0 | 3.3.3 |
org.apache.hadoop:hadoop-common Maven | From 3.3.0 | 3.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.
Other vulnerabilities in Apache Hadoop
- CVE-2021-37404 Heap buffer overflow in libhdfs native library
- CVE-2022-26612 Arbitrary file write in FileUtil#unpackEntries on Windows
- CVE-2019-17195 Improper Check for Unusual or Exceptional Conditions in Connect2id Nimbus JOSE+JWT
- CVE-2017-15718 Exposure of Sensitive Information in Hadoop
- CVE-2012-4449 Use of a Broken or Risky Cryptographic Algorithm in Apache Hadoop
Sources
Also known as GHSA-8wm5-8h9c-47pc.