CVE-2021-44790 Overview
CVE-2021-44790 is a buffer overflow vulnerability in the Apache HTTP Server's mod_lua module, specifically affecting the multipart parser functionality. A carefully crafted request body can trigger a buffer overflow when the r:parsebody() function is called from Lua scripts. This vulnerability affects Apache HTTP Server version 2.4.51 and earlier, potentially allowing attackers to execute arbitrary code or crash the server.
Critical Impact
This buffer overflow vulnerability in mod_lua allows remote attackers to potentially execute arbitrary code or cause denial of service on vulnerable Apache HTTP Server installations through malicious multipart request bodies.
Affected Products
- Apache HTTP Server 2.4.51 and earlier
- Fedora 34, 35, and 36
- Debian Linux 10.0 and 11.0
- Apple macOS and Mac OS X 10.15.7 (various security updates)
- Oracle HTTP Server 12.2.1.3.0 and 12.2.1.4.0
- Oracle Communications Element Manager, Operations Monitor, Session Report Manager, and Session Route Manager
- Oracle Instantis EnterpriseTrack 17.1, 17.2, and 17.3
- Oracle ZFS Storage Appliance Kit 8.8
- Tenable Tenable.sc
- NetApp Cloud Backup
Discovery Timeline
- 2021-12-20 - CVE-2021-44790 published to NVD
- 2025-05-01 - Last updated in NVD database
Technical Details for CVE-2021-44790
Vulnerability Analysis
This vulnerability is classified as CWE-787 (Out-of-bounds Write), a type of memory corruption issue that occurs when the mod_lua multipart parser processes specially crafted HTTP request bodies. The vulnerability resides in the r:parsebody() function, which is used by Lua scripts running within the Apache HTTP Server to parse multipart form data from incoming requests.
When processing multipart request bodies, the parser fails to properly validate the size of input data before writing it to a fixed-size buffer. An attacker can exploit this by sending a maliciously crafted request with oversized or malformed multipart content, causing data to be written beyond the allocated buffer boundaries. This out-of-bounds write can corrupt adjacent memory, potentially leading to arbitrary code execution with the privileges of the Apache web server process.
The Apache httpd team noted at the time of disclosure that while they were not aware of an active exploit, the crafting of one was considered possible.
Root Cause
The root cause of CVE-2021-44790 lies in insufficient bounds checking within the mod_lua multipart parser. When the r:parsebody() function processes multipart MIME content from HTTP POST requests, it allocates a buffer to store parsed data. However, the code fails to adequately verify that incoming data fits within the allocated buffer size before performing write operations. This lack of proper boundary validation allows attackers to overflow the buffer by submitting carefully constructed multipart content that exceeds expected size limits.
Attack Vector
The attack is network-based and does not require authentication or user interaction. An attacker can remotely exploit this vulnerability by sending an HTTP request with a specially crafted multipart request body to an Apache server that has mod_lua enabled and uses Lua scripts that call the r:parsebody() function. The malicious payload is delivered through the HTTP request body, making this attack feasible against any publicly accessible Apache server with the vulnerable configuration.
The exploitation flow involves:
- Identifying a target Apache HTTP Server with mod_lua enabled
- Locating endpoints that process multipart form data through Lua scripts
- Crafting a malicious multipart request body designed to overflow the parser's buffer
- Sending the request to trigger the buffer overflow condition
- Potentially achieving code execution or causing a denial of service
Detection Methods for CVE-2021-44790
Indicators of Compromise
- Unexpected Apache httpd crashes or service restarts, particularly when processing multipart POST requests
- Anomalous memory access patterns or segmentation faults in Apache error logs
- Large or malformed multipart HTTP POST requests targeting Lua-enabled endpoints
- Evidence of exploitation attempts in web access logs showing unusual Content-Type headers with multipart boundaries
Detection Strategies
- Monitor Apache error logs for segmentation faults, memory corruption errors, or unexpected crashes related to mod_lua
- Implement Web Application Firewall (WAF) rules to detect and block abnormally large or malformed multipart request bodies
- Use intrusion detection systems to flag HTTP requests with suspicious multipart boundary patterns or oversized content
- Deploy endpoint detection solutions that can identify memory corruption exploitation attempts
Monitoring Recommendations
- Enable verbose logging for mod_lua to capture detailed information about Lua script execution and request parsing
- Set up alerting for Apache service crashes or abnormal restarts that may indicate exploitation attempts
- Monitor network traffic for unusual patterns of multipart POST requests, especially from single sources
- Implement application-level monitoring to track resource usage during request processing
How to Mitigate CVE-2021-44790
Immediate Actions Required
- Update Apache HTTP Server to version 2.4.52 or later, which contains the security fix for this vulnerability
- If immediate patching is not possible, disable mod_lua if it is not required for your deployment
- Review and audit Lua scripts that utilize r:parsebody() functionality
- Implement rate limiting and request size restrictions for endpoints that process multipart data
Patch Information
Apache has addressed this vulnerability in Apache HTTP Server version 2.4.52. Organizations should apply the official security update as soon as possible. Multiple vendors have also released their own patches and advisories:
- Apache HTTP Server Vulnerabilities - Official Apache security advisory
- Debian Security DSA-5035 - Debian security update
- Oracle Security Alert CPUJAN2022 - Oracle January 2022 CPU
- Oracle Security Alert CPUAPR2022 - Oracle April 2022 CPU
- Tenable Security Notification TNS-2022-01 - Tenable.sc security update
- Apple Support Article HT213255 - macOS security update
Workarounds
- Disable mod_lua entirely if Lua scripting is not required in your Apache configuration by commenting out or removing LoadModule lua_module directives
- Restrict access to Lua-enabled endpoints using Apache's access control directives to limit exposure to trusted networks only
- Implement a reverse proxy or WAF in front of Apache to filter and validate multipart request bodies before they reach the server
- Configure Apache's LimitRequestBody directive to restrict maximum request body sizes and reduce attack surface
# Configuration example to disable mod_lua
# In httpd.conf or apache2.conf, comment out the following line:
# LoadModule lua_module modules/mod_lua.so
# Alternatively, restrict request body size
LimitRequestBody 1048576
# Restrict access to Lua endpoints
<Location "/lua-scripts">
Require ip 192.168.1.0/24
</Location>
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.


