T08 · Insecure Dependencies
Warning
- Location
- SKILL.md:9
- Finding
- Unpinned Third-Party npm Package Can Execute Unreviewed Code<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 9–11 and 46–50 **Vulnerability Type**: Unpinned third-party dependency and unsafe package execution **Risk Level**: Medium ### Vulnerable Code ```yaml dependencies: npm: - "@aiagenta2z/onekey-gateway" installation: npm: npm -g install @aiagenta2z/onekey-gateway ``` ```shell ## install onekey agent gateway npm install @aiagenta2z/onekey-gateway ## CLI to Call API and Symbol List npx onekey agent aiagenta2z/financeagent get_hk_stock_market_hkex '{"symbol_list": ["700", "1024"]}' ``` ### Technical Analysis The Skill instructs users to install `@aiagenta2z/onekey-gateway` without specifying an exact version or integrity hash. Package resolution can therefore select a newer package version that was not present during this audit. npm package installation may execute package lifecycle scripts with the privileges of the invoking user. The documented global installation also increases the package's reach within the user's environment. The subsequent `npx onekey` command executes the installed package's CLI code. No evidence establishes that the current package is malicious. The vulnerability is that the Skill does not constrain or verify the executable third-party dependency, leaving execution behavior dependent on mutable package-registry content. ### Attack Path 1. An attacker compromises the package publisher, registry account, publication process, or another part of the dependency supply chain. 2. The attacker publishes a malicious version under the same package name. 3. A user follows the Skill instructions without an exact version constraint. 4. npm resolves and downloads the attacker-controlled release. 5. Malicious lifecycle scripts can run during installation, or malicious CLI logic can run when `npx onekey` is invoked. 6. The payload executes with the permissions of the user running npm. ### Impact Assessment Successful exploitation could permit arbitrary code execution ...[truncated 490 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Pin the dependency to an audited exact version rather than using an unconstrained package name. 2. Record and verify package integrity information through a committed lockfile. 3. Prefer a project-local installation using `npm ci` over global installation. 4. Invoke the already installed binary with `npx --no-install` so that execution cannot trigger an implicit download. 5. Review the package's lifecycle scripts, transitive dependencies, publisher identity, and registry provenance before approval. 6. Run the package with a dedicated, least-privileged account or sandbox and expose only the environment variables and files required for the market-data request. 7. Add automated dependency monitoring and require security review before updating the pinned version. A safer documented workflow would resemble: ```shell npm install --save-exact @aiagenta2z/onekey-gateway@<audited-version> npx --no-install onekey agent aiagenta2z/financeagent \ get_hk_stock_market_hkex '{"symbol_list":["700","1024"]}' ``` ]]>
