T08 · Insecure Dependencies
- Location
docx-js.md:8- Finding
Unpinned Global Installation of a Third-Party Node.js Dependency
- Content
View full analysis
Vulnerability Details
File Location:
docx-js.md:8-9
Vulnerability Type: Unpinned and globally installed third-party dependency
Risk Level: MediumVulnerable Code
text Assume docx is installed globally If not installed: `npm install -g docx`Technical Analysis
The installation instructions retrieve and globally install the latest available version of the
docxpackage without an exact version, lockfile, or integrity constraint. Consequently, the dependency resolved during installation may differ from the version reviewed or tested by the Skill author.npm installation can execute package lifecycle scripts. If the package, a transitive dependency, the configured npm registry, or the relevant release channel is compromised, installation may execute attacker-controlled code with the permissions of the user running npm. Global installation also broadens the affected scope beyond an isolated project directory.
No malicious dependency is embedded in the audited project, and no currently compromised package was established during this static audit. The vulnerability is the unsafe and mutable dependency acquisition process.
Attack Path
- An attacker compromises the
docxpackage, one of its transitive dependencies, a future release, or the registry path used by the host. - A user follows the Skill documentation and runs
npm install -g docx. - npm resolves the mutable latest package version rather than a previously audited version.
- Malicious package content or lifecycle scripts execute during installation.
- The installed module is subsequently loaded by
scripts/generate_docx_from_markdown.cjs, allowing malicious runtime behavior to continue during document generation.
Impact Assessment
Successful exploitation could execute arbitrary code with the privileges of the user running npm. Depending on those privileges, the attacker could access or modify files available to tha ...[truncated 361 chars]
- An attacker compromises the
- Remediation
View remediation
Remediation Suggestions
- Replace the global installation instruction with a project-local dependency.
- Add a
package.jsonthat pins an audited exact version ofdocx. - Commit a package lockfile and instruct users to run
npm cirather than installing the mutable latest version. - Avoid version ranges such as
^or~for security-sensitive document-generation dependencies. - Verify the expected npm registry and retain lockfile integrity hashes.
- Disable lifecycle scripts during installation when compatible with the dependency:
bash npm ci --ignore-scripts - Run dependency auditing and provenance verification before publishing the Skill.
- Remove the recommendation to install the module globally, thereby limiting any compromise to the Skill workspace.
