CVE-2022-32893 - Out-of-bounds Write

Severity

88%

Complexity

27%

Confidentiality

98%

An out-of-bounds write issue was addressed with improved bounds checking. This issue is fixed in iOS 15.6.1 and iPadOS 15.6.1, macOS Monterey 12.5.1, Safari 15.6.1. Processing maliciously crafted web content may lead to arbitrary code execution. Apple is aware of a report that this issue may have been actively exploited.

CVSS 3.1 Base Score 8.8. CVSS Attack Vector: network. CVSS Attack Complexity: low. CVSS Vector: (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/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

First reported 2 years ago

2022-08-24 20:15:00

Last updated 2 years ago

2022-11-07 13:50:00

Affected Software

Apple Safari

References

https://support.apple.com/en-us/HT213414

https://support.apple.com/en-us/HT213412

https://support.apple.com/en-us/HT213413

[oss-security] 20220825 WebKitGTK and WPE WebKit Security Advisory WSA-2022-0008

[oss-security] 20220826 Re: WebKitGTK and WPE WebKit Security Advisory WSA-2022-0008

FEDORA-2022-eada5f24a0

DSA-5219

DSA-5220

https://support.apple.com/en-us/HT213414

Vendor Advisory

https://support.apple.com/en-us/HT213412

Vendor Advisory

https://support.apple.com/en-us/HT213413

Vendor Advisory

[oss-security] 20220825 WebKitGTK and WPE WebKit Security Advisory WSA-2022-0008

Third Party Advisory

[oss-security] 20220826 Re: WebKitGTK and WPE WebKit Security Advisory WSA-2022-0008

Third Party Advisory

FEDORA-2022-eada5f24a0

Mailing List, Third Party Advisory

DSA-5219

Third Party Advisory

DSA-5220

Third Party Advisory

[oss-security] 20220829 Re: WebKitGTK and WPE WebKit Security Advisory WSA-2022-0008

Third Party Advisory

[oss-security] 20220829 Re: WebKitGTK and WPE WebKit Security Advisory WSA-2022-0008

[debian-lts-announce] 20220830 [SECURITY] [DLA 3087-1] webkit2gtk security update

GLSA-202208-39

20220831 APPLE-SA-2022-08-31-1 iOS 12.5.6

[oss-security] 20220902 Re: WebKitGTK and WPE WebKit Security Advisory WSA-2022-0008

FEDORA-2022-ddfeee50c9

[oss-security] 20220913 Re: WebKitGTK and WPE WebKit Security Advisory WSA-2022-0008

20221030 APPLE-SA-2022-10-27-13 watchOS 9

[oss-security] 20220825 WebKitGTK and WPE WebKit Security Advisory WSA-2022-0008

Mailing List, Third Party Advisory

[oss-security] 20220826 Re: WebKitGTK and WPE WebKit Security Advisory WSA-2022-0008

Mailing List, Third Party Advisory

[oss-security] 20220829 Re: WebKitGTK and WPE WebKit Security Advisory WSA-2022-0008

Mailing List, Third Party Advisory

[oss-security] 20220829 Re: WebKitGTK and WPE WebKit Security Advisory WSA-2022-0008

Mailing List, Third Party Advisory

[debian-lts-announce] 20220830 [SECURITY] [DLA 3087-1] webkit2gtk security update

Third Party Advisory

GLSA-202208-39

Third Party Advisory

20220831 APPLE-SA-2022-08-31-1 iOS 12.5.6

Mailing List, Third Party Advisory

[oss-security] 20220902 Re: WebKitGTK and WPE WebKit Security Advisory WSA-2022-0008

Mailing List, Third Party Advisory

FEDORA-2022-ddfeee50c9

Mailing List, Third Party Advisory

[oss-security] 20220913 Re: WebKitGTK and WPE WebKit Security Advisory WSA-2022-0008

Mailing List, Third Party Advisory

20221030 APPLE-SA-2022-10-27-13 watchOS 9

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.