CVE-2021-36373 Overview
CVE-2021-36373 is a denial of service vulnerability in Apache Ant that occurs when processing specially crafted TAR archive files. When Apache Ant reads a maliciously constructed TAR archive, the build process can be forced to allocate excessive amounts of memory, ultimately resulting in an out-of-memory error. This attack is particularly concerning because even small malicious inputs can trigger significant memory allocation, making it an efficient vector for disrupting automated build processes and CI/CD pipelines.
Critical Impact
Attackers can disrupt build pipelines and development workflows by supplying malicious TAR archives, causing denial of service conditions in Apache Ant build environments.
Affected Products
- Apache Ant prior to version 1.9.16
- Apache Ant prior to version 1.10.11
- Oracle Agile PLM 9.3.6
- Oracle Banking Trade Finance 14.5
- Oracle Communications Cloud Native Core Automated Test Suite 1.9.0
- Oracle Primavera Gateway (multiple versions)
- Oracle Retail XStore Point of Service (versions 16.0.6 through 20.0.1)
- Oracle Utilities Framework (multiple versions)
Discovery Timeline
- July 14, 2021 - CVE-2021-36373 published to NVD
- November 21, 2024 - Last updated in NVD database
Technical Details for CVE-2021-36373
Vulnerability Analysis
This vulnerability is classified under CWE-130 (Improper Handling of Length Parameter Inconsistency), indicating a flaw in how Apache Ant processes length fields within TAR archive headers. The vulnerability allows an attacker to craft a TAR archive with manipulated header values that cause the application to allocate disproportionately large memory buffers relative to the actual archive size.
The attack requires local access to the system and user interaction (such as a developer running a build that processes the malicious archive). The primary impact is availability, as successful exploitation leads to memory exhaustion and application termination without affecting data confidentiality or integrity.
Root Cause
The root cause stems from improper validation of length parameters in TAR archive headers during the archive reading process. Apache Ant's TAR handling code trusts the declared size values in archive entries without adequately verifying them against actual file content or applying reasonable memory allocation limits. This allows a crafted archive to specify extremely large sizes that trigger excessive memory allocation attempts.
Attack Vector
The attack vector requires local access to deliver the malicious TAR archive to the build system. An attacker could introduce the malicious archive through various means:
- Compromised build dependencies or third-party libraries
- Supply chain attacks on artifact repositories
- Malicious commits to source code repositories that include TAR archives
- Social engineering developers to process untrusted archives
When the Ant build process encounters the malicious archive during operations such as untar tasks, the memory exhaustion occurs, causing the JVM to crash with an OutOfMemoryError and halting the build process.
The vulnerability does not require authentication and primarily targets automated build environments where TAR archives are processed as part of the build workflow.
Detection Methods for CVE-2021-36373
Indicators of Compromise
- OutOfMemoryError exceptions in Apache Ant build logs during TAR processing operations
- Abnormally high memory consumption by Java processes running Ant builds
- Build failures occurring specifically during untar or archive extraction tasks
- Sudden termination of build processes without explicit configuration errors
Detection Strategies
- Monitor JVM heap usage for anomalous spikes during Ant build executions
- Implement alerting on OutOfMemoryError occurrences in build system logs
- Audit incoming TAR archives for suspicious size declarations that exceed reasonable thresholds
- Review build dependencies for untrusted or recently modified TAR archives
Monitoring Recommendations
- Configure memory usage thresholds and alerts for build server processes
- Enable detailed logging for Ant build operations involving archive handling
- Implement file integrity monitoring for TAR archives in build artifact repositories
- Set up automated scanning of build inputs for known malicious archive signatures
How to Mitigate CVE-2021-36373
Immediate Actions Required
- Upgrade Apache Ant to version 1.9.16 or later (for 1.9.x branch)
- Upgrade Apache Ant to version 1.10.11 or later (for 1.10.x branch)
- Review and restrict sources of TAR archives processed in build pipelines
- Apply memory limits to JVM processes running Ant builds as a defense-in-depth measure
Patch Information
Apache has released patched versions that address this memory exhaustion vulnerability. Organizations should upgrade to Apache Ant 1.9.16 or 1.10.11 (or later) depending on their version branch. For Oracle products that bundle Apache Ant, consult the Oracle Critical Patch Updates from October 2021, January 2022, April 2022, and July 2022 for specific patching guidance.
Additional security advisories are available from:
Workarounds
- Implement strict input validation on TAR archives before processing with Ant
- Configure JVM memory limits (-Xmx) to contain potential memory exhaustion impacts
- Isolate build processes in containers with resource constraints to limit blast radius
- Avoid processing TAR archives from untrusted or unverified sources in automated builds
# Configure JVM memory limits for Ant builds as a mitigation measure
export ANT_OPTS="-Xmx512m -Xms256m"
# Run ant build with constrained heap size
ant -Dant.opts="-Xmx512m" build
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

