Advisories · Web servers
CVE-2021-23017
High
CVSS 7.7
Nginx DNS resolver overflow
Disclosed 2021 · Last reviewed 2 Dec 2026
A forged DNS response could overflow the Nginx resolver when a server block used the resolver directive.
What happened
The resolver trusted a length in a DNS response while looking up an upstream name.
Affected and patched versions
- Affected
- Nginx before 1.21.0 and 1.20.1 when the resolver directive is configured.
- Patched
- Nginx 1.21.0, 1.20.1, and later.
How to check your server
Check
nginx -v
How to fix and harden
- Upgrade Nginx.
- If you do not need runtime DNS for upstreams, remove the resolver directive rather than pointing it at an untrusted resolver.
Fix
nginx -v
Sources
Version ranges and fixes follow the vendor advisory. When a distribution backports a fix, trust its security tracker over the upstream version number. New advisories: RSS · JSON