CVE-2016-2108 - Improper Restriction of Operations within the Bounds of a Memory Buffer

Severity

99%

Complexity

99%

Confidentiality

165%

The ASN.1 implementation in OpenSSL before 1.0.1o and 1.0.2 before 1.0.2c allows remote attackers to execute arbitrary code or cause a denial of service (buffer underflow and memory corruption) via an ANY field in crafted serialized data, aka the "negative zero" issue.

The ASN.1 implementation in OpenSSL before 1.0.1o and 1.0.2 before 1.0.2c allows remote attackers to execute arbitrary code or cause a denial of service (buffer underflow and memory corruption) via an ANY field in crafted serialized data, aka the "negative zero" issue.

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

CVSS 2.0 Base Score 9.9. CVSS Attack Vector: network. CVSS Attack Complexity: low. CVSS Vector: (AV:N/AC:L/Au:N/C:C/I:C/A:C).

Demo Examples

Improper Restriction of Operations within the Bounds of a Memory Buffer

CWE-119

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

Improper Restriction of Operations within the Bounds of a Memory Buffer

CWE-119

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.

Improper Restriction of Operations within the Bounds of a Memory Buffer

CWE-119

The following example asks a user for an offset into an array to select an item.


               
}
printf("You selected %s\n", items[index-1]);

The programmer allows the user to specify which element in the list to select, however an attacker can provide an out-of-bounds offset, resulting in a buffer over-read (CWE-126).

Improper Restriction of Operations within the Bounds of a Memory Buffer

CWE-119

In the following code, the method retrieves a value from an array at a specific array index location that is given as an input parameter to the method


               
}
return value;// check that the array index is less than the maximum// length of the array
value = array[index];// get the value at the specified index of the array
// if array index is invalid then output error message// and return value indicating error
value = -1;

However, this method only verifies that the given array index is less than the maximum length of the array but does not check for the minimum value (CWE-839). This will allow a negative value to be accepted as the input array index, which will result in a out of bounds read (CWE-125) and may allow access to sensitive memory. The input array index should be checked to verify that is within the maximum and minimum range required for the array (CWE-129). In this example the if statement should be modified to include a minimum range check, as shown below.


               
...// check that the array index is within the correct// range of values for the array

Improper Restriction of Operations within the Bounds of a Memory Buffer

CWE-119

Windows provides the _mbs family of functions to perform various operations on multibyte strings. When these functions are passed a malformed multibyte string, such as a string containing a valid leading byte followed by a single null byte, they can read or write past the end of the string buffer causing a buffer overflow. The following functions all pose a risk of buffer overflow: _mbsinc _mbsdec _mbsncat _mbsncpy _mbsnextc _mbsnset _mbsrev _mbsset _mbsstr _mbstok _mbccpy _mbslen

Overview

First reported 9 years ago

2016-05-05 01:59:00

Last updated 7 years ago

2018-01-05 02:30:00

Affected Software

Red Hat Enterprise Linux Desktop 6.0

6.0

RedHat Enterprise Linux HPC Node 6.0

6.0

Red Hat Enterprise Linux Server 6.0

6.0

Red Hat Enterprise Linux Workstation 6.0

6.0

OpenSSL Project OpenSSL

OpenSSL Project OpenSSL 1.0.2

1.0.2

OpenSSL Project OpenSSL 1.0.2-beta1

1.0.2

OpenSSL 1.0.2 Beta 2

1.0.2

OpenSSL 1.0.2 Beta 3

1.0.2

OpenSSL OpenSSL 1.0.2a

1.0.2a

OpenSSL Project OpenSSL 1.0.2b

1.0.2b

RedHat Enterprise Linux Desktop 7.0

7.0

RedHat Enterprise Linux HPC Node 7.0

7.0

Red Hat Enterprise Linux HPC Node EUS 7.2

7.2

RedHat Enterprise Linux Server 7.0

7.0

Red Hat Enterprise Linux Server AUS 7.2

7.2

Red Hat Enterprise Linux Server EUS 7.2

7.2

RedHat Enterprise Linux Workstation 7.0

7.0

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 5.0

5.0

Google Android 5.0.1

5.0.1

Google Android 5.1

5.1

Google Android 5.1.0

5.1.0

Google Android 6.0

6.0

Google Android 6.0.1

6.0.1

References

http://kb.juniper.net/InfoCenter/index?page=content&id=JSA10759

APPLE-SA-2016-07-18-1

FEDORA-2016-05c567df1a

FEDORA-2016-1411324654

FEDORA-2016-1e39d934ed

SUSE-SU-2016:1206

SUSE-SU-2016:1228

SUSE-SU-2016:1231

SUSE-SU-2016:1233

openSUSE-SU-2016:1237

openSUSE-SU-2016:1238

openSUSE-SU-2016:1239

openSUSE-SU-2016:1240

openSUSE-SU-2016:1241

openSUSE-SU-2016:1242

openSUSE-SU-2016:1243

SUSE-SU-2016:1267

openSUSE-SU-2016:1273

SUSE-SU-2016:1290

SUSE-SU-2016:1360

http://packetstormsecurity.com/files/136912/Slackware-Security-Advisory-openssl-Updates.html

RHSA-2016:0722

RHSA-2016:0996

RHSA-2016:2056

RHSA-2016:2073

RHSA-2016:2957

http://source.android.com/security/bulletin/2016-07-01.html

http://support.citrix.com/article/CTX212736

20160504 Multiple Vulnerabilities in OpenSSL Affecting Cisco Products: May 2016

DSA-3566

http://www.oracle.com/technetwork/security-advisory/cpujul2016-2881720.html

http://www.oracle.com/technetwork/security-advisory/cpujul2017-3236622.html

http://www.oracle.com/technetwork/topics/security/bulletinapr2016-2952098.html

http://www.oracle.com/technetwork/topics/security/linuxbulletinapr2016-2952096.html

89752

91787

1035721

SSA:2016-124-01

USN-2959-1

RHSA-2016:1137

RHSA-2017:0193

RHSA-2017:0194

https://bto.bluecoat.com/security-advisory/sa123

https://git.openssl.org/?p=openssl.git;a=commit;h=3661bb4e7934668bd99ca777ea8b30eedfafa871

https://git.openssl.org/?p=openssl.git;a=commit;h=f5da52e308a6aeea6d5f3df98c4da295d7e9cc27

https://h20566.www2.hpe.com/hpsc/doc/public/display?docLocale=en_US&docId=emr_na-hpesbgn03726en_us

https://h20566.www2.hpe.com/hpsc/doc/public/display?docLocale=en_US&docId=emr_na-hpesbhf03756en_us

https://h20566.www2.hpe.com/hpsc/doc/public/display?docLocale=en_US&docId=emr_na-hpesbhf03765en_us

https://h20566.www2.hpe.com/portal/site/hpsc/public/kb/docDisplay?docId=emr_na-c05149345

https://h20566.www2.hpe.com/portal/site/hpsc/public/kb/docDisplay?docId=emr_na-c05164862

https://h20566.www2.hpe.com/portal/site/hpsc/public/kb/docDisplay?docId=emr_na-c05386804

https://kb.pulsesecure.net/articles/Pulse_Security_Advisories/SA40202

GLSA-201612-16

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

https://security-center.intel.com/advisory.aspx?intelid=INTEL-SA-00067&languageid=en-fr

https://support.apple.com/HT206903

https://www.openssl.org/news/secadv/20160503.txt

Vendor Advisory

https://www.tenable.com/security/tns-2016-18

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.