Remote code execution in nginx



Published: 2021-05-25 | Updated: 2022-07-31
Risk High
Patch available YES
Number of vulnerabilities 1
CVE-ID CVE-2021-23017
CWE-ID CWE-193
Exploitation vector Network
Public exploit Public exploit code for vulnerability #1 is available.
Vulnerable software
Subscribe
nginx
Server applications / Web servers

Vendor NGINX

Security Bulletin

This security bulletin contains one high risk vulnerability.

1) Off-by-one

EUVDB-ID: #VU53543

Risk: High

CVSSv3.1: 7.1 [CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H/E:U/RL:O/RC:C]

CVE-ID: CVE-2021-23017

CWE-ID: CWE-193 - Off-by-one Error

Exploit availability: Yes

Description

The vulnerability allows a remote attacker to execute arbitrary code on the target system.

The vulnerability exists due to an off-by-one error within the ngx_resolver_copy() function when processing DNS responses. A remote attacker can trigger an off-by-one error, write a dot character (‘.’, 0x2E) out of bounds in a heap allocated buffer and execute arbitrary code on the system.

Successful exploitation of this vulnerability may result in complete compromise of vulnerable system.

The vulnerability can be triggered by a DNS response in reply to a DNS request from nginx when the resolver primitive is configured. A specially crafted packet allows overwriting the least significant byte of next heap chunk metadata with 0x2E.

Mitigation

Install updates from vendor's website.

Vulnerable software versions

nginx: 0.6.18 - 0.6.1516, 0.7.0 - 0.7.69, 0.8.0 - 0.8.55, 0.9.0 - 0.9.7, 1.0.0 - 1.0.15, 1.1.0 - 1.1.19, 1.2.0 - 1.2.9, 1.3.0 - 1.3.16, 1.4.0 - 1.4.7, 1.5.0 - 1.5.13, 1.6.0 - 1.6.3, 1.7.0 - 1.7.12, 1.8.0 - 1.8.1, 1.9.0 - 1.9.15, 1.10.0 - 1.10.3, 1.11.0 - 1.11.13, 1.12.0 - 1.12.2, 1.13.0 - 1.13.12, 1.14.0 - 1.14.2, 1.15.0 - 1.15.12, 1.16.0 - 1.16.1, 1.17.0 - 1.17.10, 1.18.0, 1.19.0 - 1.19.10, 1.20.1


CPE2.3 External links

http://www.x41-dsec.de/lab/advisories/x41-2021-002-nginx-resolver-copy/
http://mailman.nginx.org/pipermail/nginx-announce/2021/000300.html

Q & A

Can this vulnerability be exploited remotely?

Yes. This vulnerability can be exploited by a remote non-authenticated attacker via the Internet.

How the attacker can exploit this vulnerability?

The attacker would have to send a specially crafted request to the affected application in order to exploit this vulnerability.

Is there known malware, which exploits this vulnerability?

No. We are not aware of malware exploiting this vulnerability.



###SIDEBAR###