CVE-2021-34538
📋 TL;DR
This vulnerability in Apache Hive allows unauthorized users to manipulate existing User-Defined Functions (UDFs) without proper authorization checks. Attackers can drop and recreate UDFs to point to malicious JAR files, potentially executing arbitrary code. Organizations running affected Apache Hive versions are at risk.
💻 Affected Systems
- Apache Hive
📦 What is this software?
Hive by Apache
⚠️ Risk & Real-World Impact
Worst Case
An attacker gains full control of the Hive server by replacing legitimate UDFs with malicious code, leading to data exfiltration, system compromise, or ransomware deployment.
Likely Case
Unauthorized users escalate privileges within Hive, manipulate data, or disrupt operations by modifying UDFs without detection.
If Mitigated
With proper network segmentation and authentication controls, impact is limited to authorized users who might abuse legitimate access.
🎯 Exploit Status
Exploitation requires some level of access to Hive (e.g., user credentials), but no advanced technical skills are needed once access is obtained.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: Apache Hive 3.1.3 and later
Vendor Advisory: https://lists.apache.org/thread/oqqgnhz4c6nxsfd0xstosnk0g15f7354
Restart Required: Yes
Instructions:
1. Download Apache Hive 3.1.3 or later from the official Apache website. 2. Stop the Hive service. 3. Backup configuration and data. 4. Install the updated version. 5. Restart the Hive service. 6. Verify functionality.
🔧 Temporary Workarounds
Restrict UDF Operations
allTemporarily disable or restrict CREATE and DROP function operations for non-admin users via Hive authorization policies.
-- In Hive, configure authorization (e.g., with Ranger or Sentry) to limit UDF management to trusted administrators only.
🧯 If You Can't Patch
- Implement strict network access controls to isolate Hive servers from untrusted networks.
- Enforce strong authentication and least-privilege access for all Hive users, auditing UDF changes regularly.
🔍 How to Verify
Check if Vulnerable:
Check the Hive version; if it is earlier than 3.1.3, the system is vulnerable. Review Hive logs for unauthorized UDF operations.
Check Version:
hive --version
Verify Fix Applied:
After patching, confirm the version is 3.1.3 or later and test that unauthorized users cannot manipulate UDFs.
📡 Detection & Monitoring
Log Indicators:
- Unusual CREATE or DROP FUNCTION operations in Hive logs, especially from non-admin users.
- Log entries showing UDF modifications or errors related to authorization failures.
Network Indicators:
- Unexpected outbound connections from Hive servers to external IPs, potentially indicating malicious JAR downloads.
SIEM Query:
source="hive.logs" AND ("CREATE FUNCTION" OR "DROP FUNCTION") AND user!="admin"