CVE-2022-37434 - Out-of-bounds Write

Severity

98%

Complexity

39%

Confidentiality

98%

zlib through 1.2.12 has a heap-based buffer over-read or buffer overflow in inflate in inflate.c via a large gzip header extra field. NOTE: only applications that call inflateGetHeader are affected. Some common applications bundle the affected zlib source code but may be unable to call inflateGetHeader (e.g., see the nodejs/node reference).

CVSS 3.1 Base Score 9.8. CVSS Attack Vector: network. CVSS Attack Complexity: low. CVSS Vector: (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H).

Demo Examples

Out-of-bounds Write

CWE-787

The following code attempts to save four different identification numbers into an array.


               
id_sequence[3] = 456;

Out-of-bounds Write

CWE-787

In the following example, it is possible to request that memcpy move a much larger segment of memory than assumed:


               
}
.../* if chunk info is valid, return the size of usable memory,* else, return -1 to indicate an error*/
...

If returnChunkSize() happens to encounter an error it will return -1. Notice that the return value is not checked before the memcpy operation (CWE-252), so -1 can be passed as the size argument to memcpy() (CWE-805). Because memcpy() assumes that the value is unsigned, it will be interpreted as MAXINT-1 (CWE-195), and therefore will copy far more memory than is likely available to the destination buffer (CWE-787, CWE-788).

Out-of-bounds Write

CWE-787

This example takes an IP address from a user, verifies that it is well formed and then looks up the hostname and copies it into a buffer.


               
}
strcpy(hostname, hp->h_name);/*routine that ensures user_supplied_addr is in the right format for conversion */

This function allocates a buffer of 64 bytes to store the hostname, however there is no guarantee that the hostname will not be larger than 64 bytes. If an attacker specifies an address which resolves to a very large hostname, then we may overwrite sensitive data or even relinquish control flow to the attacker.

Note that this example also contains an unchecked return value (CWE-252) that can lead to a NULL pointer dereference (CWE-476).

Out-of-bounds Write

CWE-787

This example applies an encoding procedure to an input string and stores it into a buffer.


               
}
return dst_buf;
die("user string too long, die evil hacker!");
else dst_buf[dst_index++] = user_supplied_string[i];
dst_buf[dst_index++] = ';';
/* encode to < */

The programmer attempts to encode the ampersand character in the user-controlled string, however the length of the string is validated before the encoding procedure is applied. Furthermore, the programmer assumes encoding expansion will only expand a given character by a factor of 4, while the encoding of the ampersand expands by 5. As a result, when the encoding procedure expands the string it is possible to overflow the destination buffer if the attacker provides a string of many ampersands.

Out-of-bounds Write

CWE-787

In the following C/C++ example, a utility function is used to trim trailing whitespace from a character string. The function copies the input string to a local character string and uses a while statement to remove the trailing whitespace by moving backward through the string and overwriting whitespace with a NUL character.


               
}
return retMessage;// copy input string to a temporary string
message[index] = strMessage[index];
// trim trailing whitespace
len--;
// return string without trailing whitespace

However, this function can cause a buffer underwrite if the input character string contains all whitespace. On some systems the while statement will move backwards past the beginning of a character string and will call the isspace() function on an address outside of the bounds of the local buffer.

Out-of-bounds Write

CWE-787

The following is an example of code that may result in a buffer underwrite, if find() returns a negative value to indicate that ch is not found in srcBuf:


               
}
...

If the index to srcBuf is somehow under user control, this is an arbitrary write-what-where condition.

Overview

Type

NetApp

First reported 2 years ago

2022-08-05 07:15:00

Last updated 2 years ago

2022-11-16 17:24:00

Affected Software

NetApp ONTAP Select Deploy Administration Utility

NetApp Active IQ Unified Manager for VMware vSphere

vmware_vsphere

NetApp Active IQ Unified Manager for Windows

windows

References

https://github.com/nodejs/node/blob/75b68c6e4db515f76df73af476eccf382bbcb00a/deps/zlib/inflate.c#L762-L764

https://github.com/ivd38/zlib_overflow

https://github.com/madler/zlib/commit/eff308af425b67093bab25f80f1ae950166bece1

https://github.com/madler/zlib/blob/21767c654d31d2dccdde4330529775c6c5fd5389/zlib.h#L1062-L1063

[oss-security] 20220805 zlib buffer overflow

https://github.com/curl/curl/issues/9271

[oss-security] 20220808 Re: zlib buffer overflow

https://github.com/nodejs/node/blob/75b68c6e4db515f76df73af476eccf382bbcb00a/deps/zlib/inflate.c#L762-L764

Exploit, Third Party Advisory

https://github.com/ivd38/zlib_overflow

Exploit, Third Party Advisory

https://github.com/madler/zlib/commit/eff308af425b67093bab25f80f1ae950166bece1

Patch, Third Party Advisory

https://github.com/madler/zlib/blob/21767c654d31d2dccdde4330529775c6c5fd5389/zlib.h#L1062-L1063

Exploit, Third Party Advisory

[oss-security] 20220805 zlib buffer overflow

Mailing List, Third Party Advisory

https://github.com/curl/curl/issues/9271

Exploit, Issue Tracking, Third Party Advisory

[oss-security] 20220808 Re: zlib buffer overflow

Mailing List, Patch, Third Party Advisory

FEDORA-2022-25e4dbedf9

DSA-5218

FEDORA-2022-15da0cf165

https://security.netapp.com/advisory/ntap-20220901-0005/

FEDORA-2022-b8232d1cca

[debian-lts-announce] 20220912 [SECURITY] [DLA 3103-1] zlib security update

FEDORA-2022-3c28ae0cd8

FEDORA-2022-0b517a5397

FEDORA-2022-25e4dbedf9

Mailing List, Third Party Advisory

DSA-5218

Third Party Advisory

FEDORA-2022-15da0cf165

Mailing List, Third Party Advisory

https://security.netapp.com/advisory/ntap-20220901-0005/

Third Party Advisory

FEDORA-2022-b8232d1cca

Mailing List, Third Party Advisory

[debian-lts-announce] 20220912 [SECURITY] [DLA 3103-1] zlib security update

Mailing List, Third Party Advisory

FEDORA-2022-3c28ae0cd8

Third Party Advisory

FEDORA-2022-0b517a5397

Third Party Advisory

https://support.apple.com/kb/HT213490

https://support.apple.com/kb/HT213493

https://support.apple.com/kb/HT213494

https://support.apple.com/kb/HT213491

https://support.apple.com/kb/HT213488

https://support.apple.com/kb/HT213489

20221030 APPLE-SA-2022-10-27-5 Additional information for APPLE-SA-2022-10-24-2 macOS Ventura 13

FEDORA-2022-3c28ae0cd8

Mailing List, Third Party Advisory

FEDORA-2022-0b517a5397

Mailing List, Third Party Advisory

https://support.apple.com/kb/HT213490

Third Party Advisory

https://support.apple.com/kb/HT213493

Third Party Advisory

https://support.apple.com/kb/HT213494

Third Party Advisory

https://support.apple.com/kb/HT213491

Third Party Advisory

https://support.apple.com/kb/HT213488

Third Party Advisory

https://support.apple.com/kb/HT213489

Third Party Advisory

20221030 APPLE-SA-2022-10-27-5 Additional information for APPLE-SA-2022-10-24-2 macOS Ventura 13

Mailing List, Third Party Advisory

Stay updated

ExploitPedia is constantly evolving. Sign up to receive a notification when we release additional functionality.

Get in touch

If you'd like to report a bug or have any suggestions for improvements then please do get in touch with us using this form. We will get back to you as soon as we can.