T08 · Insecure Dependencies
- Location
SKILL.md:19- Finding
Unpinned npm CLI Installation and Execution
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 19-24
Vulnerability Type: Unpinned third-party package execution
Risk Level: MediumVulnerable Code
bash npm i -g @nestjs/cli nest new my-project cd my-project && npm run start:devtext Or use `npx @nestjs/cli@latest new my-project` to avoid global installation.Technical Analysis
The guide instructs users to install
@nestjs/cliglobally without an exact version or to download and execute the mutablelatestrelease throughnpx. npm packages and their lifecycle scripts execute with the privileges of the invoking user. Thelatesttag can change after the Skill has been reviewed, so the effective code executed by this procedure is not fixed by the audited content.Although
@nestjs/cliis a purpose-appropriate dependency and there is no evidence that its current releases are malicious, this pattern unnecessarily exposes users to registry compromise, maintainer-account compromise, malicious release replacement, and unexpected behavior introduced by future versions. A global installation also increases the persistence and system-wide availability of the installed executable.Attack Path
- An attacker compromises the npm package, a maintainer account, the registry delivery path, or a release referenced by the mutable
latesttag. - A user or Agent follows the Quick Start instructions.
- npm resolves and downloads the compromised or unexpectedly changed release.
- npm lifecycle scripts or CLI initialization code execute locally.
- The package operates with the invoking user's privileges and can access resources available to that account.
Impact Assessment
Successful exploitation could execute arbitrary code as the invoking user. This may expose source code, environment variables, npm credentials, SSH material, and other files accessible to that account. It could also modify generated projects ...[truncated 229 chars]
- An attacker compromises the npm package, a maintainer account, the registry delivery path, or a release referenced by the mutable
- Remediation
View remediation
Remediation Suggestions
- Replace mutable or unversioned commands with a reviewed exact version, such as
npx @nestjs/cli@<reviewed-exact-version> new my-project. - Prefer a project-local development dependency over a global installation.
- Generate and commit a lockfile, and use deterministic installation commands such as
npm cifor existing projects. - Review package provenance, release signatures or attestations, and registry configuration before execution.
- Avoid running npm installation or initialization commands with administrative privileges.
- Document a controlled upgrade process instead of relying on the
latestdistribution tag.
- Replace mutable or unversioned commands with a reviewed exact version, such as
