CVE-2022-22721 - Integer Overflow or Wraparound

Severity

98%

Complexity

39%

Confidentiality

98%

If LimitXMLRequestBody is set to allow request bodies larger than 350MB (defaults to 1M) on 32 bit systems an integer overflow happens which later causes out of bounds writes. This issue affects Apache HTTP Server 2.4.52 and earlier.

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).

CVSS 2.0 Base Score 6.8. CVSS Attack Vector: network. CVSS Attack Complexity: medium. CVSS Vector: (AV:N/AC:M/Au:N/C:P/I:P/A:P).

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

CVSS 2.0 Base Score 5.8. CVSS Attack Vector: network. CVSS Attack Complexity: medium. CVSS Vector: (AV:N/AC:M/Au:N/C:N/I:P/A:P).

Demo Examples

Integer Overflow or Wraparound

CWE-190

The following image processing code allocates a table for images.


               
...

This code intends to allocate a table of size num_imgs, however as num_imgs grows large, the calculation determining the size of the list will eventually overflow (CWE-190). This will result in a very small list to be allocated instead. If the subsequent code operates on the list as if it were num_imgs long, it may result in many types of out-of-bounds problems (CWE-119).

Integer Overflow or Wraparound

CWE-190

The following code excerpt from OpenSSH 3.3 demonstrates a classic case of integer overflow:


               
}
for (i = 0; i < nresp; i++) response[i] = packet_get_string(NULL);

If nresp has the value 1073741824 and sizeof(char*) has its typical value of 4, then the result of the operation nresp*sizeof(char*) overflows, and the argument to xmalloc() will be 0. Most malloc() implementations will happily allocate a 0-byte buffer, causing the subsequent loop iterations to overflow the heap buffer response.

Integer Overflow or Wraparound

CWE-190

Integer overflows can be complicated and difficult to detect. The following example is an attempt to show how an integer overflow may lead to undefined looping behavior:


               
}
bytesRec += getFromInput(buf+bytesRec);

In the above case, it is entirely possible that bytesRec may overflow, continuously creating a lower number than MAXGET and also overwriting the first MAXGET-1 bytes of buf.

Integer Overflow or Wraparound

CWE-190

In this example the method determineFirstQuarterRevenue is used to determine the first quarter revenue for an accounting/business application. The method retrieves the monthly sales totals for the first three months of the year, calculates the first quarter sales totals from the monthly sales totals, calculates the first quarter revenue based on the first quarter sales, and finally saves the first quarter revenue results to the database.


               
}
return 0;// Variable for sales revenue for the quarter// Calculate quarterly total// Calculate the total revenue for the quarter

However, in this example the primitive type short int is used for both the monthly and the quarterly sales variables. In C the short int primitive type has a maximum value of 32768. This creates a potential integer overflow if the value for the three monthly sales adds up to more than the maximum value for the short int primitive type. An integer overflow can lead to data corruption, unexpected behavior, infinite loops and system crashes. To correct the situation the appropriate primitive type should be used, as in the example below, and/or provide some validation mechanism to ensure that the maximum value for the primitive type is not exceeded.


               
}
...// Calculate quarterly total// Calculate the total revenue for the quarter

Note that an integer overflow could also occur if the quarterSold variable has a primitive type long but the method calculateRevenueForQuarter has a parameter of type short.

Overview

First reported 2 years ago

2022-03-14 11:15:00

Last updated 2 years ago

2022-11-02 13:18:00

Affected Software

Apache Software Foundation Apache HTTP Server

Debian Linux 9.0

9.0

Oracle HTTP Server 12.2.1.3.0

12.2.1.3.0

Apple Mac OS X

References

https://httpd.apache.org/security/vulnerabilities_24.html

[oss-security] 20220314 CVE-2022-22721: Apache HTTP Server: core: Possible buffer overflow with very large or unlimited LimitXMLRequestBody

https://httpd.apache.org/security/vulnerabilities_24.html

Vendor Advisory

[oss-security] 20220314 CVE-2022-22721: Apache HTTP Server: core: Possible buffer overflow with very large or unlimited LimitXMLRequestBody

Mailing List, Third Party Advisory

https://security.netapp.com/advisory/ntap-20220321-0001/

FEDORA-2022-b4103753e9

[debian-lts-announce] 20220322 [SECURITY] [DLA 2960-1] apache2 security update

FEDORA-2022-21264ec6db

FEDORA-2022-78e3211c55

https://security.netapp.com/advisory/ntap-20220321-0001/

Third Party Advisory

FEDORA-2022-b4103753e9

Mailing List, Third Party Advisory

[debian-lts-announce] 20220322 [SECURITY] [DLA 2960-1] apache2 security update

Mailing List, Third Party Advisory

FEDORA-2022-21264ec6db

Third Party Advisory

FEDORA-2022-78e3211c55

Third Party Advisory

https://www.oracle.com/security-alerts/cpuapr2022.html

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

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

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

20220516 APPLE-SA-2022-05-16-2 macOS Monterey 12.4

20220516 APPLE-SA-2022-05-16-4 Security Update 2022-004 Catalina

20220516 APPLE-SA-2022-05-16-3 macOS Big Sur 11.6.6

N/A

GLSA-202208-20

FEDORA-2022-21264ec6db

Mailing List, Third Party Advisory

FEDORA-2022-78e3211c55

Mailing List, Third Party Advisory

https://www.oracle.com/security-alerts/cpuapr2022.html

Patch, Third Party Advisory

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

Third Party Advisory

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

Third Party Advisory

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

Third Party Advisory

20220516 APPLE-SA-2022-05-16-2 macOS Monterey 12.4

Third Party Advisory

20220516 APPLE-SA-2022-05-16-4 Security Update 2022-004 Catalina

Third Party Advisory

20220516 APPLE-SA-2022-05-16-3 macOS Big Sur 11.6.6

Third Party Advisory

N/A

Third Party Advisory

GLSA-202208-20

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.