T08 · Insecure Dependencies
Warning
- Location
- SKILL.md:14
- Finding
- Unpinned npm Dependency Installation and Execution## Vulnerability Details **File Location**: `SKILL.md`, lines 14–22 and 53–60 **Vulnerability Type**: Unpinned third-party package installation and execution **Risk Level**: Medium ### Vulnerable Code Lines 14–22: ```json "npmPackages": ["@pnp/cli-microsoft365"] }, "install": [ { "id": "node", "kind": "node", "package": "@pnp/cli-microsoft365", "label": "Install m365 CLI (npm)", "description": "Install the CLI for Microsoft 365 globally: npm install -g @pnp/cli-microsoft365" ``` Lines 53–60: ```bash ## Installation The CLI must be installed: ```bash npm install -g @pnp/cli-microsoft365 ``` Or use npx (sandbox): ```bash npx @pnp/cli-microsoft365 --help ``` ### Technical Analysis The skill directs the agent to retrieve and execute `@pnp/cli-microsoft365` without specifying an exact reviewed version or integrity value. Consequently, npm resolves the package to the version represented by the applicable current distribution tag at installation time rather than to immutable audited content. The global installation command can install package files and expose commands across the user's environment. The `npx` alternative may download and execute package code immediately. npm lifecycle scripts and transitive dependencies can also run or be loaded as part of installation and execution. The listed official repository and package URLs provide provenance information, but they do not cryptographically bind the installed artifact to a reviewed release. No evidence indicates that the named package is currently malicious. The vulnerability is the unsafe, mutable dependency acquisition process and the resulting exposure to a compromised future release, compromised transitive dependency, registry compromise, or account takeover. ### Attack Path 1. An attacker compromises the package publisher, a transitive dependency, or the package-distribution channel and publishes malicious co ...[truncated 1501 chars]
- Remediation
- ## Remediation Suggestions 1. Pin the dependency to an exact reviewed version in both metadata and command examples, avoiding version ranges and mutable distribution tags. 2. Maintain a lockfile that records exact transitive dependency versions and integrity hashes. 3. Prefer a project-local installation over `npm install -g` to reduce system-wide impact and make dependency state reproducible. 4. Avoid executing an implicitly downloaded package through unpinned `npx`. If `npx` is retained, require an exact reviewed version and configure it not to accept an unexpected package download silently. 5. Verify package integrity and publisher provenance before installation. Where supported, use npm provenance attestations, trusted registry controls, and an approved internal package mirror. 6. Disable npm lifecycle scripts during installation where compatible, then explicitly enable only required and reviewed setup operations. 7. Run installation and the CLI in a least-privileged isolated environment without unrelated secrets, sensitive environment variables, or broad filesystem access. 8. Authenticate using a least-privileged Microsoft 365 identity and restrict application permissions to the workloads required for the task. 9. Establish a controlled dependency-update process in which new package and transitive dependency versions are reviewed and tested before the pinned version is changed.
