Skip to content

Insecure Deserialization with msgpack-numpy

Description

The use of msgpack-numpy unpacking relies on pickle to deserialize numpy arrays containing objects, which can result in arbitrary code execution. Consider switching to a safer serialization method.

Examples

Insecure Code

python
import msgpack_numpy; msgpack_numpy.patch(); data = msgpack.unpackb(...)

Secure Code

python
import json; data = json.loads(...)

Remediation

Replace msgpack-numpy with a safer serialization method, such as JSON or MessagePack without numpy support.

Rule Details

FieldValue
IDCODE-0005
CategoryDeserialization
SeverityCRITICAL
CWECWE-502
ConfidenceMEDIUM
ImpactHIGH
LikelihoodMEDIUM
ExploitabilityEASY
Tagspickle, arbitrary code execution
OWASPN/A

References