CVE-2021-44790: Code Execution On Apache Via An Integer Underflow
An integer underflow in Apache httpd's mod_lua multipart parser allows a remote unauthenticated attacker to send a crafted POST request that causes a buffer overflow, potentially leading to remote code execution or denial of service.
An integer underflow vulnerability has been reported in the modlua module of Apache httpd. The vulnerability is due to improper validation of the request body in the module's multipart parser, called via the r:parsebody() function in Lua scripts.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely an integer underflow when calculating the length of a multipart form field, leading to a buffer overflow in memcpy.
Impact
Successful exploitation could lead to remote code execution under the security context of the server process, while an unsuccessful attack could lead to a denial-of-service condition.
What the attacker needed
Mod_lua enabled; Lua script calls r:parsebody(); attacker can send HTTP requests
The fix
The bug was fixed in Apache HTTP Server 2.4.52; applying the update is the only method to fully address this vulnerability.
How it was found
- Enable mod_lua and configure a Lua script that calls r:parsebody().
- Send an HTTP POST request with Content-Type multipart/form-data and a crafted body where the end boundary appears within less than 8 characters after the CRLF.
- The server processes the request, triggering the integer underflow and buffer overflow.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
This is a bug in a part of the Apache web server that handles file uploads. When a specially formatted upload request is sent, a calculation goes wrong and the server tries to copy too much data into a small memory space, which can crash the server or let an attacker run their own code.
What is Memory corruption?
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.