# CVE-2021-23017: Memory corruption in Nginx Web Server, Nginx Plus

> An attacker forging DNS UDP packets can trigger a 1-byte memory overwrite in Nginx resolver, causing worker crashes or potential code execution.

- **Severity:** High 7.7 (`CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:L`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 1 Jun 2021
- **Updated:** 3 Aug 2024
- **Also known as:** ALPINE-CVE-2021-23017, ALSA-2021:2259, ALSA-2021:2290, ALSA-2022:0323, BIT-nginx-2021-23017, BIT-nginx-gateway-2021-23017, CLEANSTART-2026-WB96831, CLSA-2021-1632261741, CLSA-2021-1632261762, CLSA-2021-1634922789, CLSA-2021-1634922818, CLSA-2021-1635459350, CLSA-2021-1635459358, CLSA-2022-1646060645, CLSA-2022-1646085758, DEBIAN-CVE-2021-23017, DLA-2670-1, DSA-4921-1, GHSA-83p9-mcpm-374v, MGASA-2021-0301, OESA-2021-1225, RHBA-2021:2955, RHSA-2021:2258, RHSA-2021:2259, RHSA-2021:2278, RHSA-2021:2290, RHSA-2022:0323, RLSA-2021:2259, RLSA-2021:2290, RLSA-2022:0323, SUSE-SU-2021:1792-1, SUSE-SU-2021:1814-1, SUSE-SU-2021:1815-1, SUSE-SU-2021:1839-1, UBUNTU-CVE-2021-23017, USN-4967-1, USN-4967-2, openSUSE-SU-2021:0835-1, openSUSE-SU-2021:1815-1

## What is CVE-2021-23017?

CVE-2021-23017 is a high-severity memory corruption vulnerability in Fedoraproject Fedora, published on 1 Jun 2021. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

A security issue in nginx resolver was identified, which might allow an attacker who is able to forge UDP packets from the DNS server to cause 1-byte memory overwrite, resulting in worker process crash or potential other impact.

Weakness: CWE-193 (Off-by-one Error)

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

2 open source packages ship an affected version, including nginx and nginx-gateway. It affects 13 products.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `nginx` | Bitnami | From 0.6.18 | 1.20.1 |
| `nginx-gateway` | Bitnami | From 0.6.18 | 1.20.1 |
| `nginx` | AlmaLinux:8 | All versions | 1:1.16.1-2.module_el8.4.0+2470+68135136.1.alma |
| `nginx` | AlmaLinux:8 | All versions | 1:1.16.1-2.module_el8.5.0+35+6a1225c3.1.alma |
| `nginx` | AlmaLinux:8 | All versions | 1:1.18.0-3.module_el8.4.0+2472+f736ed63.1.alma |
| `nginx` | AlmaLinux:8 | All versions | 1:1.18.0-3.module_el8.5.0+36+48437aab.1.alma |
| `nginx` | AlmaLinux:8 | All versions | 1:1.20.1-1.module_el8.5.0+2611+ab304644.alma |
| `nginx` | AlmaLinux:8 | All versions | 1:1.20.1-1.module_el8.6.0+2782+a022aca3.alma |
| `nginx-all-modules` | AlmaLinux:8 | All versions | 1:1.16.1-2.module_el8.4.0+2470+68135136.1.alma |
| `nginx-all-modules` | AlmaLinux:8 | All versions | 1:1.18.0-3.module_el8.4.0+2472+f736ed63.1.alma |
| `nginx-all-modules` | AlmaLinux:8 | All versions | 1:1.20.1-1.module_el8.5.0+2611+ab304644.alma |
| `nginx-all-modules` | AlmaLinux:8 | All versions | 1:1.20.1-1.module_el8.6.0+2782+a022aca3.alma |
| `nginx-filesystem` | AlmaLinux:8 | All versions | 1:1.16.1-2.module_el8.4.0+2470+68135136.1.alma |
| `nginx-filesystem` | AlmaLinux:8 | All versions | 1:1.18.0-3.module_el8.4.0+2472+f736ed63.1.alma |
| `nginx-filesystem` | AlmaLinux:8 | All versions | 1:1.20.1-1.module_el8.5.0+2611+ab304644.alma |
| `nginx-filesystem` | AlmaLinux:8 | All versions | 1:1.20.1-1.module_el8.6.0+2782+a022aca3.alma |
| `nginx-mod-http-image-filter` | AlmaLinux:8 | All versions | 1:1.16.1-2.module_el8.4.0+2470+68135136.1.alma |
| `nginx-mod-http-image-filter` | AlmaLinux:8 | All versions | 1:1.16.1-2.module_el8.5.0+35+6a1225c3.1.alma |
| `nginx-mod-http-image-filter` | AlmaLinux:8 | All versions | 1:1.18.0-3.module_el8.4.0+2472+f736ed63.1.alma |
| `nginx-mod-http-image-filter` | AlmaLinux:8 | All versions | 1:1.18.0-3.module_el8.5.0+36+48437aab.1.alma |
| `nginx-mod-http-image-filter` | AlmaLinux:8 | All versions | 1:1.20.1-1.module_el8.5.0+2611+ab304644.alma |
| `nginx-mod-http-image-filter` | AlmaLinux:8 | All versions | 1:1.20.1-1.module_el8.6.0+2782+a022aca3.alma |
| `nginx-mod-http-perl` | AlmaLinux:8 | All versions | 1:1.16.1-2.module_el8.4.0+2470+68135136.1.alma |
| `nginx-mod-http-perl` | AlmaLinux:8 | All versions | 1:1.16.1-2.module_el8.5.0+35+6a1225c3.1.alma |
| `nginx-mod-http-perl` | AlmaLinux:8 | All versions | 1:1.18.0-3.module_el8.4.0+2472+f736ed63.1.alma |
| `nginx-mod-http-perl` | AlmaLinux:8 | All versions | 1:1.18.0-3.module_el8.5.0+36+48437aab.1.alma |
| `nginx-mod-http-perl` | AlmaLinux:8 | All versions | 1:1.20.1-1.module_el8.5.0+2611+ab304644.alma |
| `nginx-mod-http-perl` | AlmaLinux:8 | All versions | 1:1.20.1-1.module_el8.6.0+2782+a022aca3.alma |
| `nginx-mod-http-xslt-filter` | AlmaLinux:8 | All versions | 1:1.16.1-2.module_el8.4.0+2470+68135136.1.alma |
| `nginx-mod-http-xslt-filter` | AlmaLinux:8 | All versions | 1:1.16.1-2.module_el8.5.0+35+6a1225c3.1.alma |
| `nginx-mod-http-xslt-filter` | AlmaLinux:8 | All versions | 1:1.18.0-3.module_el8.4.0+2472+f736ed63.1.alma |
| `nginx-mod-http-xslt-filter` | AlmaLinux:8 | All versions | 1:1.18.0-3.module_el8.5.0+36+48437aab.1.alma |
| `nginx-mod-http-xslt-filter` | AlmaLinux:8 | All versions | 1:1.20.1-1.module_el8.5.0+2611+ab304644.alma |
| `nginx-mod-http-xslt-filter` | AlmaLinux:8 | All versions | 1:1.20.1-1.module_el8.6.0+2782+a022aca3.alma |
| `nginx-mod-mail` | AlmaLinux:8 | All versions | 1:1.16.1-2.module_el8.4.0+2470+68135136.1.alma |
| `nginx-mod-mail` | AlmaLinux:8 | All versions | 1:1.16.1-2.module_el8.5.0+35+6a1225c3.1.alma |
| `nginx-mod-mail` | AlmaLinux:8 | All versions | 1:1.18.0-3.module_el8.4.0+2472+f736ed63.1.alma |
| `nginx-mod-mail` | AlmaLinux:8 | All versions | 1:1.18.0-3.module_el8.5.0+36+48437aab.1.alma |
| `nginx-mod-mail` | AlmaLinux:8 | All versions | 1:1.20.1-1.module_el8.5.0+2611+ab304644.alma |
| `nginx-mod-mail` | AlmaLinux:8 | All versions | 1:1.20.1-1.module_el8.6.0+2782+a022aca3.alma |

Products: F5 Nginx, Fedoraproject Fedora, Netapp Ontap Select Deploy Administration Utility, Openresty Openresty, Oracle Blockchain Platform, Oracle Communications Control Plane Monitor, Oracle Communications Fraud Monitor, Oracle Communications Operations Monitor, Oracle Communications Session Border Controller, Oracle Enterprise Communications Broker, Oracle Enterprise Session Border Controller, Oracle Enterprise Telephony Fraud Monitor, Oracle Goldengate.

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

Upgrade nginx to 1.20.1 or later.

## Is CVE-2021-23017 being exploited?

There is no known exploitation of CVE-2021-23017 in the wild and no public exploit code.

Public exploit code:

- PoC for Nginx 0.6.18 - 1.20.0 Memory Overwrite Vulnerability CVE-2021-23017 (github_poc): https://github.com/M507/CVE-2021-23017-PoC
- nginx 1.15.10 patch against cve-2021-23017  (ingress version) (github_poc): https://github.com/niandy/nginx-patch
- https://github.com/lakshit1212/CVE-2021-23017-PoC (github_poc): https://github.com/lakshit1212/CVE-2021-23017-PoC
- The issue only affects nginx if the "resolver" directive is used in the configuration file. Further, the attack is only possible if an attacker is able to forge UDP packets from the DNS server. (github_poc): https://github.com/z3usx01/CVE-2021-23017-POC
- vulnerability in NGINX servers (versions 0.6.18–1.20.0). The scripts aim to cause a Denial of Service (DoS) by sending malicious DNS responses, with enhancements to bypass firewalls. (github_poc): https://github.com/6lj/EVIL-CVE-2021-23017-Update-2025
- Nginx 1.20.0 - Denial of Service (DOS) (exploitdb)

## Other vulnerabilities in Fedoraproject Fedora

- [CVE-2016-1247](https://insights.sbomify.com/CVE-2016-1247/): Path traversal in n/a (high 7.8)
- [CVE-2014-0088](https://insights.sbomify.com/CVE-2014-0088/): Memory corruption in n/a (high 7.5)
- [CVE-2014-0133](https://insights.sbomify.com/CVE-2014-0133/): Memory corruption in n/a (high 7.5)
- [CVE-2013-4547](https://insights.sbomify.com/CVE-2013-4547/): Security feature bypass in n/a (high 7.5)
- [CVE-2013-0337](https://insights.sbomify.com/CVE-2013-0337/): Information disclosure in n/a (high 7.5)

## Fix prompt for AI coding agents

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

What it is: CVE-2021-23017 is a high-severity memory corruption vulnerability in Fedoraproject Fedora, published on 1 Jun 2021. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2021-23017 in the wild and no public exploit code.

Affected packages and fixed versions:
- nginx (Bitnami): affected from 0.6.18; fixed in 1.20.1
- nginx-gateway (Bitnami): affected from 0.6.18; fixed in 1.20.1

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-23017/ (Markdown: https://insights.sbomify.com/CVE-2021-23017/index.md)
```

## Sources

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

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