T08 · Insecure Dependencies
- Location
scripts/xhs-cover.sh:1- Finding
Unpinned npm Package Is Downloaded and Executed Through npx
- Content
View full analysis
Vulnerability Details
File Location:
scripts/xhs-cover.sh:1-7
Additional References:SKILL.md:23,29,32,35,38;README.md:41,57,60,63,66
Vulnerability Type: Unpinned third-party dependency execution
Risk Level: MediumVulnerable code:
bash #!/bin/bash # xhs-cover.sh - Xiaohongshu cover generation Skill script # Invokes xhscover through npx and handles registration/login/generation set -e exec npx xhscover "$@"The documentation similarly instructs users to execute unpinned commands such as:
bash npx xhscover setup npx xhscover generate "5 habits that make you more disciplined" npx xhscover balance npx xhscover historyTechnical Analysis
The wrapper executes
xhscoverthroughnpxwithout specifying an exact package version, using a lockfile, validating an integrity hash, or requiring a previously installed local binary. If the package is not available locally,npxcan download the package version currently resolved by the npm registry and execute its code.This creates a supply-chain trust boundary: the code reviewed in this repository does not fully determine the code that runs when the Skill is invoked. A compromised npm publisher account, malicious package release, registry compromise, or unexpected upstream change could cause arbitrary JavaScript or package lifecycle code to execute under the Agent user's account.
Argument forwarding does not independently introduce shell command injection because
"$@"preserves argument boundaries and prevents shell reinterpretation. The confirmed issue is the mutable, unpinned executable dependency.Attack Path
- An attacker compromises the
xhscovernpm publisher, publishing process, or package distribution channel. - The attacker publishes a malicious release under the existing package name.
- A user or Agent runs
scripts/xhs-cover.shor one of the documentednpx xhscovercommands on a system ...[truncated 1062 chars]
- An attacker compromises the
- Remediation
View remediation
Remediation Suggestions
-
Pin
xhscoverto an exact reviewed version instead of resolving the latest available release. -
Add a
package.jsonand committed lockfile containing registry integrity metadata. -
Install dependencies using a deterministic command such as:
bash npm ci --ignore-scriptsIf the package legitimately requires lifecycle scripts, review them before allowing execution rather than enabling them by default.
-
Invoke only the locally installed, locked binary and prohibit network fallback:
bash exec npx --no-install xhscover "$@"Alternatively, execute
./node_modules/.bin/xhscoverdirectly after verifying installation. -
Review upstream source and release changes before updating the pinned version. Use automated dependency scanning and verify package provenance where supported.
-
Run the Skill with least privilege and restrict access to unrelated credentials and sensitive workspace files.
-
Update all commands in
README.mdandSKILL.mdso users are not instructed to execute an unpinned package directly.
-
