T08 · Insecure Dependencies
Warning
- Location
- analyze.py:6
- Finding
- Unpinned NLTK Dependency and Unverified Runtime Lexicon Download## Vulnerability Details **File Location**: `analyze.py:6-10` **Additional Location**: `SKILL.md:27-30` **Vulnerability Type**: Supply-chain risk from an unpinned dependency and runtime resource retrieval without application-level integrity verification **Risk Level**: Medium ### Vulnerable Code `analyze.py:6-10`: ```python def ensure_vader(): try: nltk.data.find('sentiment/vader_lexicon.zip') except LookupError: # Download quietly nltk.download('vader_lexicon', quiet=True) ``` `SKILL.md:27-30`: ```markdown - Python 3 - `nltk` library (`pip install nltk`) - `vader_lexicon` (downloaded via `nltk.downloader`) ``` ### Technical Analysis The documented installation command installs `nltk` without a pinned version, lockfile, or package hash. Consequently, the exact code installed depends on the package version resolved when installation occurs. In addition, `ensure_vader()` automatically invokes NLTK's downloader if the VADER resource is unavailable. The application does not pin a specific lexicon artifact or independently validate its checksum before use. This means the effective runtime data can depend on externally mutable package repositories, downloader metadata, and upstream resources after the skill has been reviewed. The download is documented, and the reviewed project does not itself fetch or execute arbitrary source code. This finding is therefore a supply-chain hardening issue rather than evidence of an embedded malicious payload. ### Attack Path 1. An attacker compromises or successfully substitutes an NLTK package release, package distribution source, downloader index, or upstream VADER resource. 2. A user installs the unpinned `nltk` dependency, or invokes the skill in an environment where `vader_lexicon` is absent. 3. The environment resolves attacker-influenced package content or `ensure_vader()` silently initiates retrieval through `nltk.download()`. ...[truncated 952 chars]
- Remediation
- ## Remediation Suggestions 1. Pin NLTK to a reviewed exact version in a requirements file, such as `nltk==<reviewed-version>`. 2. Generate and enforce a lockfile containing cryptographic hashes, for example with `pip-compile --generate-hashes`, and install using `pip install --require-hashes`. 3. Retrieve the VADER lexicon during a controlled build or installation phase rather than automatically during normal execution. 4. Pin the expected lexicon artifact and verify its cryptographic checksum before making it available to the application. 5. Replace the implicit runtime download with a clear error explaining how to install the verified resource when it is absent. 6. Use trusted package indexes over TLS, restrict alternate indexes, and periodically review dependency and artifact updates before changing pinned versions. 7. Run the skill under a least-privileged account with limited filesystem and network access to reduce the effect of any future supply-chain compromise.
