T08 · Insecure Dependencies
Warning
- Location
- SKILL.md:20
- Finding
- Unpinned npm Package Installation and Automatic Execution<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:20-25`, `SKILL.md:111` **Vulnerability Type**: Unpinned third-party dependency execution **Risk Level**: Medium ### Vulnerable Code ```bash sudo npm install @serverless-devs/s -g sudo s -v ``` ```bash npx -y @serverless-devs/s -v ``` ```bash printf 'y\n' | npx -y @serverless-devs/s deploy ``` ### Technical Analysis The documented commands install or execute `@serverless-devs/s` without specifying an exact reviewed version or validating package integrity. Consequently, npm resolves whichever package version is current when the command is run. The `npx -y` option automatically accepts package installation and immediately executes the resolved package. The global installation command is more sensitive because it invokes npm using `sudo`, allowing package installation hooks or executable code to run with elevated local privileges. Although the referenced package is consistent with the Skill's stated purpose, this execution pattern creates a supply-chain trust boundary that is not fixed to the version reviewed during the audit. A compromised package release, npm account, registry response, or transitive dependency could alter the code executed by future users. ### Attack Path 1. An attacker compromises the npm package, a maintainer account, or a transitive dependency. 2. The attacker publishes a malicious version under the legitimate package name. 3. A user follows the Skill and runs the unpinned global installation or `npx -y` command. 4. npm resolves and downloads the malicious release without requiring version review. 5. Package lifecycle hooks or CLI initialization code execute on the local host. 6. During deployment, the malicious code may access configured Alibaba Cloud credentials and perform operations using the user's cloud permissions. 7. If the global installation is run through `sudo`, malicious installation code may execute with root privileges. ### Impact Assessment Successful e ...[truncated 628 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Pin `@serverless-devs/s` to an exact reviewed version rather than resolving the latest release. 2. Install the dependency locally in a controlled project directory and commit a lockfile with integrity metadata. 3. Invoke the pinned local executable instead of using an unversioned `npx -y` command. 4. Avoid running npm with `sudo`; use a user-owned npm prefix, package manager isolation, or a disposable container. 5. Review package provenance, maintainers, release signatures, and transitive dependency changes before upgrading. 6. Use npm integrity and provenance verification where available. 7. Disable package lifecycle scripts during installation when compatible with the tool, or inspect them before execution. 8. Execute deployment tooling with short-lived, least-privilege Alibaba Cloud credentials in an isolated environment. 9. Replace the documented commands with an explicitly versioned form, such as: ```bash npm install --save-exact @serverless-devs/s@<reviewed-version> npx --no-install s -v npx --no-install s deploy ``` ]]>
