T08 · Insecure Dependencies
Warning
- Location
- SKILL.md:70
- Finding
- Unpinned Global npm Dependency Installation## Vulnerability Details **File Location**: `SKILL.md`, line 70 **Vulnerability Type**: Unpinned third-party dependency installed globally **Risk Level**: Medium **Complete Code Snippet**: ```text 使用 JavaScript 生成 .docx 文件,然后进行验证。安装:`npm install -g docx` ``` The same command is repeated in the dependency list at line 600: ```text - **docx**: `npm install -g docx` (生成新的全新空本文卷必备) ``` ### Technical Analysis The Skill directs the Agent to install the mutable latest release of the `docx` npm package globally. It does not specify an exact reviewed version, lockfile, integrity hash, trusted registry, or lifecycle-script restriction. npm installation can execute package lifecycle scripts with the permissions of the Agent's operating-system account. Because the package version is not pinned, the code installed during one execution can differ from the code installed after the Skill was reviewed. The global `-g` option also expands the installation's effects beyond an isolated project directory. This is a supply-chain weakness rather than evidence that the named package is currently malicious. Exploitation requires compromise of the selected package release, its dependency tree, the configured npm registry, or the dependency-resolution channel. ### Attack Path 1. An attacker compromises a future `docx` release, one of its resolved dependencies, or the npm registry/resolution path. 2. The Agent follows the documented setup instruction and runs `npm install -g docx`. 3. npm resolves the current mutable package version rather than a previously reviewed version. 4. Malicious package or lifecycle code executes with the privileges of the account running npm. 5. The compromised code can access data and modify files available to that account. Because installation is global, it may also affect later workflows that invoke the installed package. ### Impact Assessment Successful exploitation could provide arbitrary code executi ...[truncated 455 chars]
- Remediation
- ## Remediation Suggestions - Pin the dependency to an exact reviewed version instead of resolving the latest release, for example through a project-local `package.json`. - Commit a lockfile containing integrity metadata and install with `npm ci`. - Install the package in an isolated project directory rather than globally. - Use a configured trusted registry and verify package provenance and integrity. - Disable lifecycle scripts with `--ignore-scripts` when the required package functionality permits it. If scripts are required, review them and document that requirement explicitly. - Run installation and document generation in a sandbox or container with minimal filesystem and network permissions. - Periodically review the pinned package and transitive dependency tree before upgrading. - Replace both occurrences of `npm install -g docx`, including the repeated instruction at line 600, so the insecure command is not retained elsewhere in the Skill documentation.
