Python Object Deserialization

critical Web Application Scanning Plugin ID 113229

Synopsis

Python Object Deserialization

Description

Serialization is the process of converting an object to a stream of bytes, in order to store or send it through the network. By opposition, deserialization is the process of reconstructing an object from this stream of bytes.

When Python web applications use the `pickle` library to perform user-supplied data deserialization, an attacker could inject a custom serialized Python object in order to achieve a remote code execution on the system or to generate a Denial of Service attack (DoS).

Solution

Untrusted data should never be deserialized by the application. If required, a code review should be done to prevent deserialization of arbitrary classes and to harden the whole process.

See Also

https://cheatsheetseries.owasp.org/cheatsheets/Deserialization_Cheat_Sheet.html

https://www.owasp.org/index.php/Deserialization_of_untrusted_data

https://resources.infosecinstitute.com/10-steps-avoid-insecure-deserialization/#gref

https://davidhamann.de/2020/04/05/exploiting-python-pickle/

https://intoli.com/blog/dangerous-pickles/

Plugin Details

Severity: Critical

ID: 113229

Type: remote

Published: 5/18/2022

Updated: 5/18/2022

Scan Template: api, scan, pci

Risk Information

CVSS v2

Risk Factor: High

Base Score: 7.6

Vector: AV:N/AC:H/Au:N/C:C/I:C/A:C

CVSS Score Source: Tenable

CVSS v3

Risk Factor: Critical

Base Score: 9

Vector: CVSS:3.0/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:H

CVSS Score Source: Tenable

Reference Information