CVE-2019-17024 - Buffer Copy without Checking Size of Input ('Classic Buffer Overflow')

Severity

88%

Complexity

27%

Confidentiality

98%

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

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

Demo Examples

Buffer Copy without Checking Size of Input ('Classic Buffer Overflow')

CWE-120

The following code asks the user to enter their last name and then attempts to store the value entered in the last_name array.


               
scanf ("%s", last_name);

The problem with the code above is that it does not restrict or limit the size of the name entered by the user. If the user enters "Very_very_long_last_name" which is 24 characters long, then a buffer overflow will occur since the array can only hold 20 characters total.

Buffer Copy without Checking Size of Input ('Classic Buffer Overflow')

CWE-120

The following code attempts to create a local copy of a buffer to perform some manipulations to the data.


               
}
...

However, the programmer does not ensure that the size of the data pointed to by string will fit in the local buffer and blindly copies the data with the potentially dangerous strcpy() function. This may result in a buffer overflow condition if an attacker can influence the contents of the string parameter.

Buffer Copy without Checking Size of Input ('Classic Buffer Overflow')

CWE-120

The excerpt below calls the gets() function in C, which is inherently unsafe.


               
}
...

However, the programmer uses the function gets() which is inherently unsafe because it blindly copies all input from STDIN to the buffer without restricting how much is copied. This allows the user to provide a string that is larger than the buffer size, resulting in an overflow condition.

Buffer Copy without Checking Size of Input ('Classic Buffer Overflow')

CWE-120

In the following example, a server accepts connections from a client and processes the client request. After accepting a client connection, the program will obtain client information using the gethostbyaddr method, copy the hostname of the client that connected to a local variable and output the hostname of the client to a log file.


               
...
close(serversocket);
}
close(clientsocket);

However, the hostname of the client that connected may be longer than the allocated size for the local hostname variable. This will result in a buffer overflow when copying the client hostname to the local variable using the strcpy method.

Overview

First reported 5 years ago

2020-01-08 22:15:00

Last updated 5 years ago

2020-01-13 20:15:00

Affected Software

Mozilla Firefox

Canonical Ubuntu Linux 16.04 LTS (Long-Term Support)

16.04

Canonical Ubuntu Linux 18.04 LTS Edition

18.04

Canonical Ubuntu Linux 19.04

19.04

Canonical Ubuntu Linux 19.10

19.10

Debian Linux 8.0 (Jessie)

8.0

Debian Linux 9.0

9.0

Red Hat Enterprise Linux Desktop 6.0

6.0

RedHat Enterprise Linux Desktop 7.0

7.0

Red Hat Enterprise Linux Server 6.0

6.0

RedHat Enterprise Linux Server 7.0

7.0

Red Hat Enterprise Linux Workstation 6.0

6.0

RedHat Enterprise Linux Workstation 7.0

7.0

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.