CVE-2020-14422 - Uncontrolled Resource Consumption

Severity

75%

Complexity

39%

Confidentiality

60%

Lib/ipaddress.py in Python through 3.8.3 improperly computes hash values in the IPv4Interface and IPv6Interface classes, which might allow a remote attacker to cause a denial of service if an application is affected by the performance of a dictionary containing IPv4Interface or IPv6Interface objects, and this attacker can cause many dictionary entries to be created.

Lib/ipaddress.py in Python through 3.8.3 improperly computes hash values in the IPv4Interface and IPv6Interface classes, which might allow a remote attacker to cause a denial of service if an application is affected by the performance of a dictionary containing IPv4Interface or IPv6Interface objects, and this attacker can cause many dictionary entries to be created. This is fixed in: v3.5.10, v3.5.10rc1; v3.6.12; v3.7.9; v3.8.4, v3.8.4rc1, v3.8.5, v3.8.6, v3.8.6rc1; v3.9.0, v3.9.0b4, v3.9.0b5, v3.9.0rc1, v3.9.0rc2.

CVSS 3.1 Base Score 7.5. 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:N/A:H).

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

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

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

Demo Examples

Uncontrolled Resource Consumption

CWE-400

The following example demonstrates the weakness.


               
}
}
}
...
Thread.currentThread().interrupt();// postpone response
...
new Thread(loop).start();
}
}
}
r.run();
...

There are no limits to runnables. Potentially an attacker could cause resource problems very quickly.

Uncontrolled Resource Consumption

CWE-400

This code allocates a socket and forks each time it receives a new connection.


               
}
pid = fork();

The program does not track how many connections have been made, and it does not limit the number of connections. Because forking is a relatively expensive operation, an attacker would be able to cause the system to run out of CPU, processes, or memory by making a large number of connections. Alternatively, an attacker could consume all available connections, preventing others from accessing the system remotely.

Uncontrolled Resource Consumption

CWE-400

In the following example a server socket connection is used to accept a request to store data on the local file system using a specified filename. The method openSocketConnection establishes a server socket to accept requests from a client. When a client establishes a connection to this service the getNextMessage method is first used to retrieve from the socket the name of the file to store the data, the openFileToWrite method will validate the filename and open a file to write to on the local file system. The getNextMessage is then used within a while loop to continuously read data from the socket and output the data to the file until there is no longer any data from the socket.


               
}
closeSocket(socket);
return(FAIL);
closeFile();
}
break;

This example creates a situation where data can be dumped to a file on the local file system without any limits on the size of the file. This could potentially exhaust file or disk resources and/or limit other clients' ability to access the service.

Uncontrolled Resource Consumption

CWE-400

In the following example, the processMessage method receives a two dimensional character array containing the message to be processed. The two-dimensional character array contains the length of the message in the first character array and the message body in the second character array. The getMessageLength method retrieves the integer value of the length from the first character array. After validating that the message length is greater than zero, the body character array pointer points to the start of the second character array of the two-dimensional character array and memory is allocated for the new body character array.


               
}/* process message accepts a two-dimensional character array of the form [length][body] containing the message to be processed */
}
return(SUCCESS);
return(FAIL);

This example creates a situation where the length of the body character array can be very large and will consume excessive memory, exhausting system resources. This can be avoided by restricting the length of the second character array with a maximum length check

Also, consider changing the type from 'int' to 'unsigned int', so that you are always guaranteed that the number is positive. This might not be possible if the protocol specifically requires allowing negative values, or if you cannot control the return value from getMessageLength(), but it could simplify the check to ensure the input is positive, and eliminate other errors such as signed-to-unsigned conversion errors (CWE-195) that may occur elsewhere in the code.


               
if ((length > 0) && (length < MAX_LENGTH)) {...}

Uncontrolled Resource Consumption

CWE-400

In the following example, a server object creates a server socket and accepts client connections to the socket. For every client connection to the socket a separate thread object is generated using the ClientSocketThread class that handles request made by the client through the socket.


               
}
} catch (IOException ex) {...}
serverSocket.close();
t.start();

In this example there is no limit to the number of client connections and client threads that are created. Allowing an unlimited number of client connections and threads could potentially overwhelm the system and system resources.

The server should limit the number of client connections and the client threads that are created. This can be easily done by creating a thread pool object that limits the number of threads that are generated.


               
}
} catch (IOException ex) {...}
serverSocket.close();
pool.execute(t);

Overview

First reported 3 years ago

2020-06-18 14:15:00

Last updated 3 years ago

2020-11-16 20:45:00

Affected Software

Python

OpenSUSE Leap 15.1

15.1

Fedora 31

31

Fedora 32

32

References

https://bugs.python.org/issue41004

https://github.com/python/cpython/pull/20956

https://bugs.python.org/issue41004

Vendor Advisory

https://github.com/python/cpython/pull/20956

Issue Tracking

openSUSE-SU-2020:0931

openSUSE-SU-2020:0940

[debian-lts-announce] 20200715 [SECURITY] [DLA 2280-1] python3.5 security update

FEDORA-2020-705c6ea5be

FEDORA-2020-b513391ca8

openSUSE-SU-2020:0931

Mailing List, Third Party Advisory

openSUSE-SU-2020:0940

Mailing List, Third Party Advisory

https://bugs.python.org/issue41004

Third Party Advisory, Vendor Advisory

[debian-lts-announce] 20200715 [SECURITY] [DLA 2280-1] python3.5 security update

Third Party Advisory

FEDORA-2020-705c6ea5be

Third Party Advisory

FEDORA-2020-b513391ca8

Third Party Advisory

openSUSE-SU-2020:0989

openSUSE-SU-2020:1002

FEDORA-2020-dfb11916cc

https://security.netapp.com/advisory/ntap-20200724-0004/

USN-4428-1

FEDORA-2020-bb919e575e

FEDORA-2020-c3b07cc5c9

GLSA-202008-01

FEDORA-2020-87c0a0a52d

FEDORA-2020-1ddd5273d6

FEDORA-2020-efb908b6a8

FEDORA-2020-d808fdd597

FEDORA-2020-982b2950db

FEDORA-2020-c539babb0a

FEDORA-2020-d30881c970

openSUSE-SU-2020:0989

Mailing List, Third Party Advisory

openSUSE-SU-2020:1002

Mailing List, Third Party Advisory

https://github.com/python/cpython/pull/20956

Issue Tracking, Third Party Advisory

FEDORA-2020-c539babb0a

Mailing List, Third Party Advisory

FEDORA-2020-efb908b6a8

Mailing List, Third Party Advisory

FEDORA-2020-982b2950db

Mailing List, Third Party Advisory

FEDORA-2020-705c6ea5be

Mailing List, Third Party Advisory

FEDORA-2020-bb919e575e

Mailing List, Third Party Advisory

FEDORA-2020-87c0a0a52d

Mailing List, Third Party Advisory

FEDORA-2020-d30881c970

Mailing List, Third Party Advisory

FEDORA-2020-c3b07cc5c9

Mailing List, Third Party Advisory

FEDORA-2020-d808fdd597

Mailing List, Third Party Advisory

FEDORA-2020-dfb11916cc

Mailing List, Third Party Advisory

FEDORA-2020-b513391ca8

Mailing List, Third Party Advisory

FEDORA-2020-1ddd5273d6

Mailing List, Third Party Advisory

GLSA-202008-01

Third Party Advisory

https://security.netapp.com/advisory/ntap-20200724-0004/

Third Party Advisory

USN-4428-1

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.