T08 · Insecure Dependencies
- Location
SKILL.md:53- Finding
Unpinned Global npm Dependency Installation
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, line 53
Vulnerability Type:T08: Insecure Dependencies
Risk Level: MediumVulnerable Code:
markdown 使用 `docx` npm 包(`npm install -g docx`)编写 JavaScript 脚本生成文档。Technical Analysis
The Skill directs the agent to install the latest available version of the
docxnpm package globally. The dependency is not pinned to a reviewed version, and no lockfile or integrity-verification mechanism is specified.npm installations can execute package lifecycle scripts with the permissions of the invoking user. Consequently, a compromised package release or transitive dependency could execute arbitrary code during installation. The
-goption also creates a broader system-level footprint than a project-local installation and may affect other Node.js workflows that use globally installed packages.The audit found no evidence that the named package is currently malicious. The vulnerability arises from the unsafe dependency installation process and its exposure to future supply-chain compromise.
Attack Path
- An attacker compromises the
docxnpm package, one of its transitive dependencies, or the relevant package-distribution account. - The attacker publishes a malicious release containing an installation lifecycle script or altered runtime code.
- The Skill is invoked and directs the agent or user to execute
npm install -g docx. - npm resolves the unpinned dependency to the attacker-controlled release.
- Malicious lifecycle code executes during installation with the invoking user's privileges, or malicious runtime code executes when the document-generation script imports the package.
- The payload can access resources available to that user and can modify globally installed Node.js components.
Impact Assessment
Successful exploitation could permit arbitrary code execution with the privileges of the user running npm. Accessible scope m ...[truncated 532 chars]
- An attacker compromises the
- Remediation
View remediation
Remediation Suggestions
- Pin
docxto a specifically reviewed version rather than resolving the latest release:bash npm install --save-exact docx@<reviewed-version> - Install the package within a dedicated project directory instead of using the global
-goption. - Commit a reviewed
package.jsonandpackage-lock.json, then use:bash npm ci - Verify registry configuration, package provenance, publisher identity, and lockfile integrity before installation.
- Disable lifecycle scripts where compatible with the reviewed package:
bash npm ci --ignore-scripts - Run dependency installation and report generation in a sandbox or container with minimum privileges, restricted credentials, and limited filesystem and network access.
- Add automated dependency auditing and controlled update review so version changes are not accepted without security validation.
- Pin
