CVE-2009-2692 - Improper Restriction of Operations within the Bounds of a Memory Buffer

Severity

72%

Complexity

39%

Confidentiality

165%

The Linux kernel 2.6.0 through 2.6.30.4, and 2.4.4 through 2.4.37.4, does not initialize all function pointers for socket operations in proto_ops structures, which allows local users to trigger a NULL pointer dereference and gain privileges by using mmap to map page zero, placing arbitrary code on this page, and then invoking an unavailable operation, as demonstrated by the sendpage operation (sock_sendpage function) on a PF_PPPOX socket.

The Linux kernel 2.6.0 through 2.6.30.4, and 2.4.4 through 2.4.37.4, does not initialize all function pointers for socket operations in proto_ops structures, which allows local users to trigger a NULL pointer dereference and gain privileges by using mmap to map page zero, placing arbitrary code on this page, and then invoking an unavailable operation, as demonstrated by the sendpage operation (sock_sendpage function) on a PF_PPPOX socket.

CVSS 2.0 Base Score 7.2. CVSS Attack Vector: local. CVSS Attack Complexity: low. CVSS Vector: (AV:L/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

Type

Linux Kernel

First reported 15 years ago

2009-08-14 15:16:00

Last updated 6 years ago

2018-10-10 19:41:00

Affected Software

Linux Kernel 2.4.4

2.4.4

Linux Kernel 2.4.5

2.4.5

Linux Kernel 2.4.6

2.4.6

Linux Kernel 2.4.7

2.4.7

Linux Kernel 2.4.8

2.4.8

Linux Kernel 2.4.9

2.4.9

Linux Kernel 2.4.10

2.4.10

Linux Kernel 2.4.11

2.4.11

Linux Kernel 2.4.12

2.4.12

Linux Kernel 2.4.13

2.4.13

Linux Kernel 2.4.14

2.4.14

Linux Kernel 2.4.15

2.4.15

Linux Kernel 2.4.16

2.4.16

Linux Kernel 2.4.17

2.4.17

Linux Kernel 2.4.18

2.4.18

Linux Kernel 2.4.19

2.4.19

Linux Kernel 2.4.20

2.4.20

Linux Kernel 2.4.21

2.4.21

Linux Kernel 2.4.22

2.4.22

Linux Kernel 2.4.23

2.4.23

Linux Kernel 2.4.25

2.4.25

Linux Kernel 2.4.26

2.4.26

Linux Kernel 2.4.27

2.4.27

Linux Kernel 2.4.28

2.4.28

Linux Kernel 2.4.29

2.4.29

Linux Kernel 2.4.30

2.4.30

Linux Kernel 2.4.30 rc2

2.4.30

Linux Kernel 2.4.30 rc3

2.4.30

Linux Kernel 2.4.32

2.4.32

Linux Kernel 2.4.33

2.4.33

Linux Kernel 2.4.33.2

2.4.33.2

Linux Kernel 2.4.33.3

2.4.33.3

Linux Kernel 2.4.33.4

2.4.33.4

Linux Kernel 2.4.33.5

2.4.33.5

Linux Kernel 2.4.34

2.4.34

Linux Kernel 2.6.0

2.6.0

Linux Kernel 2.6.1

2.6.1

Linux Kernel 2.6.10

2.6.10

Linux Kernel 2.6.11

2.6.11

Linux Kernel 2.6.11.1

2.6.11.1

Linux Kernel 2.6.11.2

2.6.11.2

Linux Kernel 2.6.11.3

2.6.11.3

Linux Kernel 2.6.11.4

2.6.11.4

Linux Kernel 2.6.11.5

2.6.11.5

Linux Kernel 2.6.11.6

2.6.11.6

Linux Kernel 2.6.11.7

2.6.11.7

Linux Kernel 2.6.11.8

2.6.11.8

Linux Kernel 2.6.11.9

2.6.11.9

Linux Kernel 2.6.11.10

2.6.11.10

Linux Kernel 2.6.11.11

2.6.11.11

Linux Kernel 2.6.11.12

2.6.11.12

Linux Kernel 2.6.12

2.6.12

Linux Kernel 2.6.12.1

2.6.12.1

Linux Kernel 2.6.12.2

2.6.12.2

Linux Kernel 2.6.12.3

2.6.12.3

Linux Kernel 2.6.12.4

2.6.12.4

Linux Kernel 2.6.12.5

2.6.12.5

Linux Kernel 2.6.12.6

2.6.12.6

Linux Kernel 2.6.13

2.6.13

Linux Kernel 2.6.13.1

2.6.13.1

Linux Kernel 2.6.13.2

2.6.13.2

Linux Kernel 2.6.13.3

2.6.13.3

Linux Kernel 2.6.13.4

2.6.13.4

Linux Kernel 2.6.13.5

2.6.13.5

Linux Kernel 2.6.14

2.6.14

Linux Kernel 2.6.14.1

2.6.14.1

Linux Kernel 2.6.14.2

2.6.14.2

Linux Kernel 2.6.14.3

2.6.14.3

Linux Kernel 2.6.14.4

2.6.14.4

Linux Kernel 2.6.14.5

2.6.14.5

Linux Kernel 2.6.14.6

2.6.14.6

Linux Kernel 2.6.14.7

2.6.14.7

Linux Kernel 2.6.15

2.6.15

Linux Kernel 2.6.15.1

2.6.15.1

Linux Kernel 2.6.15.2

2.6.15.2

Linux Kernel 2.6.15.3

2.6.15.3

Linux Kernel 2.6.15.4

2.6.15.4

Linux Kernel 2.6.15.5

2.6.15.5

Linux Kernel 2.6.15.6

2.6.15.6

Linux Kernel 2.6.15.7

2.6.15.7

Linux Kernel 2.6.16

2.6.16

Linux Kernel 2.6.16.1

2.6.16.1

Linux Kernel 2.6.16.2

2.6.16.2

Linux Kernel 2.6.16.10

2.6.16.10

Linux Kernel 2.6.16.11

2.6.16.11

Linux Kernel 2.6.16.12

2.6.16.12

Linux Kernel 2.6.16.13

2.6.16.13

Linux Kernel 2.6.16.14

2.6.16.14

Linux Kernel 2.6.16.15

2.6.16.15

Linux Kernel 2.6.16.16

2.6.16.16

Linux Kernel 2.6.16.17

2.6.16.17

Linux Kernel 2.6.16.18

2.6.16.18

Linux Kernel 2.6.16.19

2.6.16.19

Linux Kernel 2.6.16.20

2.6.16.20

Linux Kernel 2.6.16.21

2.6.16.21

Linux Kernel 2.6.16.22

2.6.16.22

Linux Kernel 2.6.16.23

2.6.16.23

Linux Kernel 2.6.16.24

2.6.16.24

Linux Kernel 2.6.16.25

2.6.16.25

Linux Kernel 2.6.16.26

2.6.16.26

Linux Kernel 2.6.16.27

2.6.16.27

Linux Kernel 2.6.16.28

2.6.16.28

Linux Kernel 2.6.30

2.6.30

Linux Kernel 2.6.30 Release Candidate 1

2.6.30

Linux Kernel 2.6.30 Release Candidate 2

2.6.30

Linux Kernel 2.6.30 Release Candidate 3

2.6.30

Linux Kernel 2.6.30 Release Candidate 5

2.6.30

Linux Kernel 2.6.30 Release Candidate 6

2.6.30

Linux Kernel 2.6.30.1

2.6.30.1

Linux Kernel 2.6.30.2

2.6.30.2

Linux Kernel 2.6.30.4

2.6.30.4

References

20090813 Linux NULL pointer dereference due to incorrect proto_ops initializations

Exploit

http://blog.cr0.org/2009/08/linux-null-pointer-dereference-due-to.html

http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.4.37.y.git;a=commit;h=c18d0fe535a73b219f960d1af3d0c264555a12e3

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=e694958388c50148389b0e9b9e9e8945cf0f1b98

http://grsecurity.net/~spender/wunderbar_emporium.tgz

SUSE-SR:2009:015

RHSA-2009:1222

RHSA-2009:1223

36278

Vendor Advisory

36289

Vendor Advisory

36327

Vendor Advisory

36430

Vendor Advisory

37298

Vendor Advisory

37471

Vendor Advisory

http://support.avaya.com/css/P8/documents/100067254

http://wiki.rpath.com/wiki/Advisories:rPSA-2009-0121

DSA-1865

19933

9477

http://www.kernel.org/pub/linux/kernel/v2.4/ChangeLog-2.4.37.5

Vendor Advisory

http://www.kernel.org/pub/linux/kernel/v2.6/ChangeLog-2.6.30.5

Vendor Advisory

http://www.kernel.org/pub/linux/kernel/v2.6/testing/ChangeLog-2.6.31-rc6

Vendor Advisory

MDVSA-2009:233

[oss-security] 20090814 CVE-2009-2692 kernel: uninit op in SOCKOPS_WRAP() leads to privesc

RHSA-2009:1233

20090813 Linux NULL pointer dereference due to incorrect proto_ops initializations

20090818 rPSA-2009-0121-1 kernel open-vm-tools

20091120 VMSA-2009-0016 VMware vCenter and ESX update release and vMA patch release address multiple security issue in third party components

20100625 VMSA-2010-0010 ESX 3.5 third party update for Service Console kernel

36038

Exploit

http://www.vmware.com/security/advisories/VMSA-2009-0016.html

ADV-2009-2272

Patch, Vendor Advisory

ADV-2009-3316

Vendor Advisory

http://zenthought.org/content/file/android-root-2009-08-16-source

https://bugzilla.redhat.com/show_bug.cgi?id=516949

https://issues.rpath.com/browse/RPL-3103

oval:org.mitre.oval:def:11526

oval:org.mitre.oval:def:11591

oval:org.mitre.oval:def:8657

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.