CVE-2017-0603 - Integer Overflow or Wraparound

Severity

54%

Complexity

49%

Confidentiality

115%

A denial of service vulnerability in libstagefright in Mediaserver could enable an attacker to use a specially crafted file to cause a device hang or reboot. This issue is rated as Moderate because it requires an uncommon device configuration. Product: Android. Versions: 4.4.4, 5.0.2, 5.1.1, 6.0, 6.0.1, 7.0, 7.1.1, 7.1.2. Android ID: A-35763994.

A denial of service vulnerability in libstagefright in Mediaserver could enable an attacker to use a specially crafted file to cause a device hang or reboot. This issue is rated as Moderate because it requires an uncommon device configuration. Product: Android. Versions: 4.4.4, 5.0.2, 5.1.1, 6.0, 6.0.1, 7.0, 7.1.1, 7.1.2. Android ID: A-35763994.

CVSS 3.0 Base Score 4.7. CVSS Attack Vector: local. CVSS Attack Complexity: high. CVSS Vector: (CVSS:3.0/AV:L/AC:H/PR:N/UI:R/S:U/C:N/I:N/A:H).

CVSS 2.0 Base Score 5.4. CVSS Attack Vector: network. CVSS Attack Complexity: high. CVSS Vector: (AV:N/AC:H/Au:N/C:N/I:N/A:C).

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.

Demo Examples

Divide By Zero

CWE-369

The following Java example contains a function to compute an average but does not validate that the input value used as the denominator is not zero. This will create an exception for attempting to divide by zero. If this error is not handled by Java exception handling, unexpected results can occur.


               
}
return totalTime / numRequests;

By validating the input value used as the denominator the following code will ensure that a divide by zero error will not cause unexpected results. The following Java code example will validate the input value, output an error message, and throw an exception.


               
}
return totalTime / numRequests;
throw ArithmeticException;

Divide By Zero

CWE-369

Divide By Zero

CWE-369

Overview

Type

Google Android

First reported 7 years ago

2017-05-12 15:29:00

Last updated 5 years ago

2019-10-03 00:03:00

Affected Software

Google Android Operating System 4.0

4.0

Google Android Operating System 4.0.1

4.0.1

Google Android Operating System 4.0.2

4.0.2

Google Android Operating System 4.0.3

4.0.3

Google Android Operating System 4.0.4

4.0.4

Google Android Operating System 4.1

4.1

Google Android Operating System 4.1.2

4.1.2

Google Android Operating System 4.2 (Jelly Bean)

4.2

Google Android Operating System 4.2.1

4.2.1

Google Android Operating System 4.2.2

4.2.2

Google Android Operating System 4.3

4.3

Google Android Operating System 4.3.1

4.3.1

Google Android Operating System 4.4

4.4

Google Android Operating System 4.4.1

4.4.1

Google Android Operating System 4.4.2

4.4.2

Google Android Operating System 4.4.3

4.4.3

Google Android Operating System 4.4.4

4.4.4

Google Android Operating System 5.0

5.0

Google Android 5.0.1

5.0.1

Google Android 5.0.2

5.0.2

Google Android 5.1

5.1

Google Android 5.1.0

5.1.0

Google Android 5.1.1

5.1.1

Google Android 6.0

6.0

Google Android 6.0.1

6.0.1

Google Android (Nougat) 7.0

7.0

Google Android 7.1.0

7.1.0

Google Android 7.1.1

7.1.1

Google Android 7.1.2

7.1.2

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.