Skip to main content
SkillTotal

Is NumPy safe?

What NumPy does

NumPy is the core Python package for array computing, built around an N-dimensional array object. It adds broadcasting functions, tools for integrating C/C++ and Fortran code, and linear algebra, Fourier transform and random number routines. The PyPI author field lists Travis E. Oliphant et al., and the code lives in numpy/numpy. It reads and writes the files your code asks for, such as .npy and .npz arrays. Before installing, pin the version, and keep allow_pickle=False, the default in numpy.load, when loading array files from others, because the documentation notes that loading pickled data can execute arbitrary code.

Partially analyzed - C/C++ code not checked for shell, network or file access
Notable — review in context (a capability is not a malicious indicator):
  • Unsafe deserialization
  • Python dynamic code execution
  • Python shell/command execution

What to do: The C/C++ code was not checked for shell, network or file access, so this result is incomplete. Review that code before installing.

NumPy is a PyPI package analyzed by SkillTotal's deterministic static scanner. The scan found no malicious indicators, though 1 risky construct is reported for review. Its C/C++ code was not checked for shell, network or file access, so this result is partial. It can: dynamic code execution, filesystem read, filesystem write, network egress and shell execution — capabilities are what the code can do, not a verdict on intent. Risk score 20/100 (low).

numpy 2.5.5

PyPI package · pypi:numpy
LOW
20
/ 100 risk score
Snapshot · scanned Nov 21, 2026 · numpy@2.5.5 · engine 1.8.0 / ruleset 107

Get notified when this component changes

Change alerts aren't live yet. Leave your email and we'll let you know when they launch. We use it only for this and delete it on request.

Automated static-analysis result. It can contain false positives and false negatives, and is not a claim about the intent of NumPy's authors. Report a false positive.

Capabilities — what this component can do (not a risk score):
dynamic code executionfilesystem readfilesystem writenetwork egressshell execution

Behavioral traits

How this component maps to the CSA agentic threat model. Descriptive — it never affects the risk score.

Execution authority
Tool Access Control / Direct Tool Access
Filesystem reach
Tool Execution Context
Network egress
Interaction & Communication / Direct Communication
Unsafe deserialization
General Protections / Input Validation

Findings (6)

HIGHUnsafe deserializationST-DESERIALIZE-PY

It loads data with a format that can rebuild arbitrary objects (e.g. pickle, or unsafe YAML).

array = pickle.load(fp, **pickle_kwargs)
return pickle.load(fid, **pickle_kwargs)

Why it matters: Feeding such a loader untrusted data can execute code hidden inside that data.

Fix: Deserialize untrusted data with a safe format/loader: JSON, or yaml.safe_load / Loader=SafeLoader. Reserve pickle/marshal for data you fully control.

CapabilityPython dynamic code executionnot scored · severity highST-DYN-PY

The code turns strings into live code at runtime (eval / new Function / exec).

return eval(f"{l1}:{' and '.join(l2)}")
return eval(f"{l1}:{' or '.join(l2)}")
return eval('lambda v,f=f:not f(v)')
d = eval(f.read().lower(), {}, {})
ret['size'] = repr(eval(ret['size']))
v = eval(initexpr, {}, params)
value = eval(value, {}, params)
l = str(eval(l, {}, params))
l = str(eval(l, {}, params))
kindselect['kind'] = eval(
                                        kindselect['kind'], {}, params)
p = eval(v, g_params, params)
item = eval(item, g_params, params)
code = compile(code_str, f'Test name: {label} ', 'exec')

Why it matters: If those strings aren't fixed and trusted, they become a way to run arbitrary code.

Fix: Avoid evaluating dynamically constructed code; if unavoidable, ensure the input is a trusted constant and never derived from external data.

CapabilityPython shell/command executionnot scored · severity highST-SHELL-PY

The component can run operating-system commands or spawn processes.

subprocess.run(command, cwd=cwd, check=True)
output = subprocess.run(cmd, capture_output=True, text=True)
res = subprocess.run(cmd, cwd=cwd, capture_output=True, text=True,
                         errors="replace", **kwargs)

Why it matters: Powerful and often legitimate — confirm the commands aren't built from untrusted input.

Fix: Confirm the command and its arguments are fully controlled and not derived from untrusted input; avoid shell=True.

CapabilityPython filesystem readnot scored · severity mediumST-FS-PY-READ

The component reads files from disk.

f_ctx = open(
                os.fspath(filename),
                ('r' if mode == 'c' else mode) + 'b'
            )
ctx = open(os.fspath(fd), 'rb')
return self.build_template_path.read_text()
with open(source) as fid:
with open(source) as f:
with open(f2cmap_file) as f:
with open(filename, 'rb') as fhandle:
return open(filename, mode, encoding=encoding)
magic_str = _read_bytes(fp, MAGIC_LEN, "magic string")
hlength_str = _read_bytes(fp, struct.calcsize(hlength_type), "array header length")
header = _read_bytes(fp, header_length, "array header")
data = _read_bytes(fp, read_size, "array data")
with open(os.fspath(filename), mode + 'b') as fp:
with open(os.fspath(filename), 'rb') as fp:
fid = stack.enter_context(open(os.fspath(file), "rb"))
with open(os.path.join(inc_dir, 'random', 'bitgen.h')) as fid:
with open(os.path.join(inc_dir, 'random', 'distributions.h')) as fid:
np_dist.read_text('direct_url.json') or '{}',
with open(_proc_pid_stat) as f:
with open(_proc_pid_stat) as f:
with open('/proc/meminfo') as f:

Why it matters: Usually legitimate, but worth confirming it can't be steered into reading sensitive files.

Fix: Confirm which files are read and that paths cannot be influenced by untrusted input to reach sensitive locations.

CapabilityPython filesystem write/deletenot scored · severity mediumST-FS-PY-WRITE

The component writes or deletes files on disk.

ctx = open(os.fspath(file), "wb")
shutil.copy2(path_object, dest_path)
meson_build_file.write_text(src)
shutil.copy(generated_source, bdir / generated_source.name)
with open(pyffilename, 'w') as f:
with open(options['signsfile'], 'w') as f:
with open(fn, 'w') as f:
with open(fn, 'w') as f:
with open(fn, 'w') as f:
with open(wn, 'w') as f:
with open(wn, 'w') as f:
shutil.rmtree(self._destpath)
shutil.copyfileobj(openedurl, f)
shutil.copyfile(path, upath)
file_ctx = open(file, "wb")
open(fname, 'wt').close()
with open(cfile.parent / "meson.build", "wt") as fid:
with open(native_file_name, "wt") as fid:

Why it matters: Usually legitimate, but worth confirming the paths can't be controlled by untrusted input.

Fix: Confirm which files are written/deleted and that paths cannot be influenced by untrusted input.

CapabilityPython network egressnot scored · severity mediumST-NET-PY

The component makes outbound network requests.

from urllib.request import urlopen
with urlopen(path) as openedurl:
from urllib.request import urlopen
netfile = urlopen(path)

Why it matters: Usually legitimate, but confirm the destinations are expected and no sensitive data leaves.

Fix: Confirm the destination hosts are expected and that no sensitive data is sent off-host.

How attackers abuse these capabilities

Interactive labs on the attack class behind the rules above. They show the technique, not anything found in NumPy.

Maintain NumPy?

Check the next package before your agent installs it

The free Claude Code plugin scans each npm, PyPI or MCP package with this report's open-source engine before the install command runs. It runs on your machine and needs no account.

Check your own component

Run the same evidence-backed scan on any MCP server, agent skill, or package.

Scan your own component

How we determine this: deterministic static analysis (regex + AST), evidence-anchored, no code execution. Methodology →