CVE-2014-1859: NumPy arbitrary file write via symlink attack

CVE-2014-1859 · Severity: low · CVSS 3 · Published 2018-01-08

NumPy is a widely-used Python library for numerical computing. Multiple test and utility modules used insecure temporary file creation, allowing a local attacker to overwrite arbitrary files via symlink manipulation. This could enable code execution or data loss on systems where NumPy is installed.

Technologies: numpy (PyPI). Vendors: PyPI.

Quick answers

Is CVE-2014-1859 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2014-1859 being exploited in the wild.
How severe is CVE-2014-1859?
Low severity, with a CVSS score of 3, published 8 January 2018.
Which products and versions are affected?
numpy (PyPI) ECOSYSTEM:introduced=0,fixed=1.8.1, GIT:introduced=0,fixed=0bb46c1448b0d3f5453d5182a17ea7ac5854ee15|ECOSYSTEM:introduced=0,fixed=1.8.1.
Is there a fix for CVE-2014-1859?
Yes. numpy (PyPI): upgrade to 1.8.1 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2014-1859 attacked?
It is attacked with local access.
Am I affected by CVE-2014-1859?
Check whether you run numpy (PyPI) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • numpy (PyPI): upgrade to 1.8.1 or later
    pip install "numpy>=1.8.1"

Technical details

The vulnerability stems from insecure use of mktemp() function in NumPy's test and utility modules (core/tests/test_memmap.py, core/tests/test_multiarray.py, f2py/f2py2e.py, and lib/tests/test_io.py). The mktemp() function only returns a filename without creating it, leaving a race condition window where a local attacker can create a symlink with the predicted name. When NumPy subsequently opens and writes to that path, the symlink causes arbitrary file writes to attacker-controlled locations. Attack requires local system access and privileges to create symlinks in shared temporary directories. The vulnerability was fixed in NumPy 1.8.1 by replacing mktemp() with secure alternatives like mkstemp().

Affected products

  • NumPy NumPy before 1.8.1

Identifiers

  • CVE-2014-1859
  • GHSA-2fc2-6r4j-p65h
  • PYSEC-2018-34

Timeline

  • 2014-02-05: disclosed
  • 2014-02-06: patched
  • 2022-05-14: advisory

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.