# CVE-2021-44790: Possible buffer overflow when parsing multipart content in mod_lua of Apache HTTP Server 2.4.51 and earlier

> A crafted request body can cause a buffer overflow in the mod_lua multipart parser, potentially allowing code execution or denial of service.

- **Severity:** Critical 9.8 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 20 Dec 2021
- **Updated:** 4 Aug 2024
- **Also known as:** ALPINE-CVE-2021-44790, ALSA-2022:0258, AZL-7044, BIT-apache-2021-44790, CLEANSTART-2026-DN02833, CLSA-2022-1643822315, CLSA-2022-1643914331, DEBIAN-CVE-2021-44790, GHSA-c547-2659-q37g, RHSA-2022:0258, RHSA-2022:0288, RHSA-2022:0303, RLSA-2022:0258, UBUNTU-CVE-2021-44790

## What is CVE-2021-44790?

CVE-2021-44790 is a critical memory corruption vulnerability in Apache Http Server, published on 20 Dec 2021. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

A carefully crafted request body can cause a buffer overflow in the mod_lua multipart parser (r:parsebody() called from Lua scripts). The Apache httpd team is not aware of an exploit for the vulnerabilty though it might be possible to craft one. This issue affects Apache HTTP Server 2.4.51 and earlier.

Weakness: CWE-787 (Out-of-bounds Write)

## Which versions are affected by CVE-2021-44790?

1 open source package ship an affected version, including apache. It affects 14 products.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `apache` | Bitnami | All versions | 2.4.52 |
| `httpd` | AlmaLinux:8 | All versions | 2.4.37-43.module_el8.5.0+2609+b30d9eec.1.alma |
| `httpd-devel` | AlmaLinux:8 | All versions | 2.4.37-43.module_el8.5.0+2609+b30d9eec.1.alma |
| `httpd-filesystem` | AlmaLinux:8 | All versions | 2.4.37-43.module_el8.5.0+2609+b30d9eec.1.alma |
| `httpd-manual` | AlmaLinux:8 | All versions | 2.4.37-43.module_el8.5.0+2609+b30d9eec.1.alma |
| `httpd-tools` | AlmaLinux:8 | All versions | 2.4.37-43.module_el8.5.0+2609+b30d9eec.1.alma |
| `mod_http2` | AlmaLinux:8 | All versions | 1.15.7-3.module_el8.5.0+2609+b30d9eec |
| `mod_ldap` | AlmaLinux:8 | All versions | 2.4.37-43.module_el8.5.0+2609+b30d9eec.1.alma |
| `mod_md` | AlmaLinux:8 | All versions | 1:2.0.8-8.module_el8.5.0+2609+b30d9eec |
| `mod_md` | AlmaLinux:8 | All versions | 1:2.0.8-8.module_el8.6.0+2872+fe0ff7aa |
| `mod_proxy_html` | AlmaLinux:8 | All versions | 1:2.4.37-43.module_el8.5.0+2609+b30d9eec.1.alma |
| `mod_session` | AlmaLinux:8 | All versions | 2.4.37-43.module_el8.5.0+2609+b30d9eec.1.alma |
| `mod_ssl` | AlmaLinux:8 | All versions | 1:2.4.37-43.module_el8.5.0+2609+b30d9eec.1.alma |
| `httpd` | Red Hat:enterprise_linux:8::appstream | All versions | 0:2.4.37-43.module+el8.5.0+13806+b30d9eec.1 |
| `httpd-debuginfo` | Red Hat:enterprise_linux:8::appstream | All versions | 0:2.4.37-43.module+el8.5.0+13806+b30d9eec.1 |
| `httpd-debugsource` | Red Hat:enterprise_linux:8::appstream | All versions | 0:2.4.37-43.module+el8.5.0+13806+b30d9eec.1 |
| `httpd-devel` | Red Hat:enterprise_linux:8::appstream | All versions | 0:2.4.37-43.module+el8.5.0+13806+b30d9eec.1 |
| `httpd-filesystem` | Red Hat:enterprise_linux:8::appstream | All versions | 0:2.4.37-43.module+el8.5.0+13806+b30d9eec.1 |
| `httpd-manual` | Red Hat:enterprise_linux:8::appstream | All versions | 0:2.4.37-43.module+el8.5.0+13806+b30d9eec.1 |
| `httpd-tools` | Red Hat:enterprise_linux:8::appstream | All versions | 0:2.4.37-43.module+el8.5.0+13806+b30d9eec.1 |
| `httpd-tools-debuginfo` | Red Hat:enterprise_linux:8::appstream | All versions | 0:2.4.37-43.module+el8.5.0+13806+b30d9eec.1 |
| `mod_http2` | Red Hat:enterprise_linux:8::appstream | All versions | 0:1.15.7-3.module+el8.4.0+8625+d397f3da |
| `mod_http2-debuginfo` | Red Hat:enterprise_linux:8::appstream | All versions | 0:1.15.7-3.module+el8.4.0+8625+d397f3da |
| `mod_http2-debugsource` | Red Hat:enterprise_linux:8::appstream | All versions | 0:1.15.7-3.module+el8.4.0+8625+d397f3da |
| `mod_ldap` | Red Hat:enterprise_linux:8::appstream | All versions | 0:2.4.37-43.module+el8.5.0+13806+b30d9eec.1 |
| `mod_ldap-debuginfo` | Red Hat:enterprise_linux:8::appstream | All versions | 0:2.4.37-43.module+el8.5.0+13806+b30d9eec.1 |
| `mod_md` | Red Hat:enterprise_linux:8::appstream | All versions | 1:2.0.8-8.module+el8.3.0+6814+67d1e611 |
| `mod_md-debuginfo` | Red Hat:enterprise_linux:8::appstream | All versions | 1:2.0.8-8.module+el8.3.0+6814+67d1e611 |
| `mod_md-debugsource` | Red Hat:enterprise_linux:8::appstream | All versions | 1:2.0.8-8.module+el8.3.0+6814+67d1e611 |
| `mod_proxy_html` | Red Hat:enterprise_linux:8::appstream | All versions | 1:2.4.37-43.module+el8.5.0+13806+b30d9eec.1 |
| `mod_proxy_html-debuginfo` | Red Hat:enterprise_linux:8::appstream | All versions | 1:2.4.37-43.module+el8.5.0+13806+b30d9eec.1 |
| `mod_session` | Red Hat:enterprise_linux:8::appstream | All versions | 0:2.4.37-43.module+el8.5.0+13806+b30d9eec.1 |
| `mod_session-debuginfo` | Red Hat:enterprise_linux:8::appstream | All versions | 0:2.4.37-43.module+el8.5.0+13806+b30d9eec.1 |
| `mod_ssl` | Red Hat:enterprise_linux:8::appstream | All versions | 1:2.4.37-43.module+el8.5.0+13806+b30d9eec.1 |
| `mod_ssl-debuginfo` | Red Hat:enterprise_linux:8::appstream | All versions | 1:2.4.37-43.module+el8.5.0+13806+b30d9eec.1 |
| `httpd` | Red Hat:rhel_e4s:8.1::appstream | All versions | 0:2.4.37-16.module+el8.1.0+13809+822d170a.3 |
| `httpd-debuginfo` | Red Hat:rhel_e4s:8.1::appstream | All versions | 0:2.4.37-16.module+el8.1.0+13809+822d170a.3 |
| `httpd-debugsource` | Red Hat:rhel_e4s:8.1::appstream | All versions | 0:2.4.37-16.module+el8.1.0+13809+822d170a.3 |
| `httpd-devel` | Red Hat:rhel_e4s:8.1::appstream | All versions | 0:2.4.37-16.module+el8.1.0+13809+822d170a.3 |
| `httpd-filesystem` | Red Hat:rhel_e4s:8.1::appstream | All versions | 0:2.4.37-16.module+el8.1.0+13809+822d170a.3 |

Products: Apache Http Server, Apple Mac Os X, Apple Macos, Debian Debian Linux, Fedoraproject Fedora, Netapp Cloud Backup, Oracle Communications Element Manager, Oracle Communications Operations Monitor, Oracle Communications Session Report Manager, Oracle Communications Session Route Manager, Oracle Http Server, Oracle Instantis Enterprisetrack, Oracle Zfs Storage Appliance Kit, Tenable Tenable.sc.

## How do I fix CVE-2021-44790?

Upgrade apache to 2.4.52 or later.

## Is CVE-2021-44790 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2021-44790 exists.

Public exploit code:

- Thực nghiệm CVE-2021-44790 (github_poc): https://github.com/nuPacaChi/-CVE-2021-44790
- Apache HTTP Server 2.4.x mod_lua Buffer Overflow (CVE-2021-44790) - Advanced exploitation framework with fingerprinting, multi-stage scanning, plugin architecture, professional reporting, screenshot capture, SQLite database, and 95%+ confidence detection. Author: Sudeepa Wanigarathna. (github_poc): https://github.com/CerberusMrXi/Apache-Lua-Buffer-Overflow-Exploit-CVE-2021-44790
- Apache 2.4.x - Buffer Overflow (exploitdb)
- https://github.com/MohammadAliMehri/cve-2021-44790-lab (github_poc): https://github.com/MohammadAliMehri/cve-2021-44790-lab

## Other vulnerabilities in Apache Http Server

- [CVE-2021-42013](https://insights.sbomify.com/CVE-2021-42013/): Apache HTTP Server Path Traversal (critical 9.8, exploited in the wild)
- [CVE-2024-38475](https://insights.sbomify.com/CVE-2024-38475/): Apache HTTP Server Improper Escaping of Output (critical 9.1, exploited in the wild)
- [CVE-2021-40438](https://insights.sbomify.com/CVE-2021-40438/): Apache HTTP Server-Side Request Forgery (SSRF) (critical 9.0, exploited in the wild)
- [CVE-2019-0211](https://insights.sbomify.com/CVE-2019-0211/): Apache HTTP Server Privilege Escalation (high 7.8, exploited in the wild)
- [CVE-2021-41773](https://insights.sbomify.com/CVE-2021-41773/): Apache HTTP Server Path Traversal (high 7.5, exploited in the wild)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2021-44790 and fix it if it is affected.

What it is: CVE-2021-44790 is a critical memory corruption vulnerability in Apache Http Server, published on 20 Dec 2021. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2021-44790 exists.

Affected packages and fixed versions:
- apache (Bitnami): affected all versions; fixed in 2.4.52

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2021-44790/ (Markdown: https://insights.sbomify.com/CVE-2021-44790/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2021-44790
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2021-44790
- OSV: https://osv.dev/vulnerability/CVE-2021-44790

---
From sbomify Insights: https://insights.sbomify.com/CVE-2021-44790/
Summaries are generated and may contain mistakes; the official description above is the record.
