Is nltk safe?
- Unsafe deserialization
- Python dynamic code execution
- Python shell/command execution
What to do: Nothing here argues against installing it. Grant the capabilities it lists only if you expect the tool to need them.
nltk 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. 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).
nltk 3.10.4
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 nltk's authors. Report a false positive.
Behavioral traits
How this component maps to the CSA agentic threat model. Descriptive — it never affects the risk score.
Findings (6)
It loads data with a format that can rebuild arbitrary objects (e.g. pickle, or unsafe YAML).
inner = shelve.open(db, flag)
db_out = shelve.open(os.path.join(staging, stem), "n")
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.
The code turns strings into live code at runtime (eval / new Function / exec).
funcopy = eval(
src, dict(_wrapper_=wrapper)
) # bare-exec ok: _assert_safe_signature fenced src (CVE-2026-14727)dec_func = eval(
src, dict(_func_=func, _call_=caller)
) # bare-exec ok: _assert_safe_signature fenced src (CVE-2026-14727)return compile(src, flags)
return compile(pattern, flags)
return compile(source_of(pattern), flags)
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.
The component can run operating-system commands or spawn processes.
return subprocess.Popen([invoked, *args], executable=real, **popen_kw)
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.
The component reads files from disk.
with open(
filename, "rb"
) as infile: # sandboxed-open ok: operator-chosen GUI file pathwith open(
filename, "rb"
) as infile: # sandboxed-open ok: operator-chosen GUI file pathwith open(
filename, "rb"
) as infile: # sandboxed-open ok: operator-chosen GUI file pathwith open(
filename
) as infile: # sandboxed-open ok: operator-chosen GUI file pathwith open(
filename
) as infile: # sandboxed-open ok: operator-chosen GUI file pathwith open(
usp
) as infile: # sandboxed-open ok: fixed db-info filename (exact-string gated)"text": _ieer_read_text(m.group("text"), root_label),"headline": _ieer_read_text(m.group("headline"), root_label),return _ieer_read_text(s, root_label)
with self.abspath(framefile).open() as fp:
with self.abspath(framefile).open() as fp:
with self.abspath(framefile).open() as fp:
with self.abspath(framefile).open() as fp:
return super().open(file)
with self.abspath(fileid).open() as fp:
return find(path_).open()
return find(local_path).open()
with super().open(info, mode="r", pwd=pwd) as raw:
return super().open(name, mode, pwd, force_zip64=force_zip64)
raw = super().open(info, mode="r", pwd=pwd, force_zip64=force_zip64)
pins[name] = open(
name, "rb", context=context
) # sandboxed-open ok: pathsec.openwith open(
self.creds_fullpath, encoding="utf8"
) as infile: # sandboxed-open ok: operator credentials path, not attacker inputWhy 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.
The component writes or deletes files on disk.
with open(
filename, "wb"
) as outfile: # sandboxed-open ok: operator-chosen GUI file pathwith open(
filename, "wb"
) as outfile: # sandboxed-open ok: operator-chosen GUI file pathwith open(
filename, "wb"
) as outfile: # sandboxed-open ok: operator-chosen GUI file pathwith open(
filename, "w"
) as outfile: # sandboxed-open ok: operator-chosen GUI file pathwith open(
filename, "w"
) as outfile: # sandboxed-open ok: operator-chosen GUI file pathwith open(
filename, "w"
) as outfile: # sandboxed-open ok: operator-chosen GUI file pathlogfile = open(
logfilename, "a", buffering=1
) # sandboxed-open ok: operator log pathwith open(
filename, "wb"
) as f: # sandboxed-open ok: operator-chosen GUI file pathos.unlink(leaf, dir_fd=dir_fd)
_shutil.copyfileobj(source, sink)
os.unlink(leaf, dir_fd=dir_fd)
os.unlink(text)
shutil.rmtree(text, ignore_errors=ignore_errors)
os.unlink(name, dir_fd=dir_fd)
outf = open(
outfile, "w", newline="", encoding=encoding, errors=errors
) # sandboxed-open ok: operator output pathself.output = open(
self.fname, "w"
) # sandboxed-open ok: operator output pathwith open(
creds_file, "a", encoding="utf8"
) as infile: # sandboxed-open ok: operator credentials path, not attacker inputWhy 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.
The component makes outbound network requests.
import urllib.request
from urllib.request import url2pathname
rewritten = url2pathname(name)
p = os.path.join(path_, url2pathname(resource_name))
pkg_dir = os.path.join(path_, url2pathname(pkg))
pkg_zip = os.path.join(path_, url2pathname(pkg + ".zip"))
p = os.path.join(path_, url2pathname(zipfile))
local_path = url2pathname(path_)
import requests
return requests.exceptions.HTTPError(message, response=response)
import requests
response = requests.get(
requests.compat.urljoin(self.url, "live"), timeout=5
)requests.compat.urljoin(self.url, "live"), timeout=5
response = requests.get(
requests.compat.urljoin(self.url, "ready"), timeout=5
)requests.compat.urljoin(self.url, "ready"), timeout=5
import requests
self.session = requests.Session()
import urllib.request
proxies = urllib.request.getproxies()
return bool(host) and not urllib.request.proxy_bypass(host)
handlers.append(urllib.request.ProxyHandler(isolated_proxies))
handlers.append(urllib.request.ProxyBasicAuthHandler(handler.passwd))
handlers.append(urllib.request.ProxyDigestAuthHandler(handler.passwd))
handlers.append(urllib.request.ProxyHandler({}))opener = urllib.request.build_opener(*handlers)
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 nltk.
Maintain nltk?
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 componentHow we determine this: deterministic static analysis (regex + AST), evidence-anchored, no code execution. Methodology →