Back to skill

Security audit

DeepBook CLI. Watch, Make & Take the Sui Market

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent DeepBook CLI guide, but it handles wallet keys and live on-chain trading in ways that need careful review before use.

Install only after reviewing the CLI source/package provenance. Prefer a pinned, project-local install; never place private keys or API keys in command arguments, chat, or tool-call text; use stdin, a keychain, hardware wallet, or another protected signer. Require explicit human approval before any mainnet trade, deposit, withdrawal, swap, manager creation, or margin action, and verify network, pool, manager ID, amounts, and dry-run output first.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
Findings (2)

T08 · Insecure Dependencies

Warning
Location
SKILL.md:18
Finding
Unpinned Third-Party Package Installed Globally<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 18-22 **Vulnerability Type**: Unpinned global dependency installation **Risk Level**: Medium ### Complete Code Snippet ```markdown Check if `deepbook` is installed: ```bash deepbook --version ``` If not, install it: ```bash npm install -g deepbook-cli ``` ``` ### Technical Analysis The Skill directs users or agents to globally install `deepbook-cli` from the npm registry without specifying an exact version, integrity hash, lockfile, or package provenance validation. As a result, the installed code depends on whichever release the registry resolves at execution time rather than the version reviewed during the Skill audit. The `-g` option increases exposure by installing the package globally. npm installation can execute package lifecycle scripts under the installing user's privileges, while the resulting executable becomes available across projects. A compromised maintainer account, malicious release, dependency compromise, or registry-level supply-chain incident could therefore cause the installation step to execute code that was not present during this review. The audit found no evidence that `deepbook-cli` is currently malicious. The finding concerns the unsafe and mutable dependency acquisition process. ### Attack Path 1. An attacker compromises the npm package, a maintainer account, or a transitive dependency and publishes a malicious release. 2. A user or agent follows the Skill and runs `npm install -g deepbook-cli`. 3. npm resolves the unpinned package name to the compromised release. 4. Malicious lifecycle scripts may execute during installation under the user's privileges. 5. The globally installed executable may subsequently access wallet configuration, credentials, transaction data, or other files available to that user. ### Impact Assessment Successful exploitation could permit arbitrary code execution with the privileges of the user performing the installation. De ...[truncated 388 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Pin the CLI to an exact reviewed version, for example: ```bash npm install --global deepbook-cli@<reviewed-exact-version> ``` 2. Document the official npm package scope, source repository, publisher identity, and expected package integrity digest. 3. Verify package provenance and integrity before installation, including npm provenance attestations where available. 4. Prefer a project-local installation with a committed lockfile over global installation: ```bash npm install --save-exact deepbook-cli@<reviewed-exact-version> npx deepbook --version ``` 5. Install with a dedicated, least-privileged account and avoid `sudo`. 6. Review package lifecycle scripts and transitive dependencies before approving version updates. 7. Establish an explicit upgrade process in which each new package version is reviewed before changing the pin. ]]>

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:131
Finding
Private Keys Accepted Through Command-Line Arguments<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 131-140; related global option at line 41 and command listing at line 73 **Vulnerability Type**: Sensitive credential exposure through process arguments and shell history **Risk Level**: High ### Complete Code Snippet ```markdown - `deepbook config set-address <address>` - `deepbook config set-trade-cap <objectId>` - `deepbook config set-read-key [apiKey]` (or `--stdin`) - `deepbook config set-stream-key <pool> [apiKey]` (or `--stdin`) - `deepbook config set-provider-base-url <mainnet|testnet> <url>` - `deepbook config set-provider-stream-base-url <mainnet|testnet> <url>` - `deepbook config import-key [privateKey]` (or `--stdin`, optional `--alias`) - `deepbook account details` - `deepbook account list` - `deepbook account balance [--coin <SUI|USDC|DEEP|coinType>]` - `deepbook account import <alias> [privateKey]` (or `--stdin`) ``` The Skill also documents the following global option: ```markdown - `--private-key <suiprivkey>` ``` ### Technical Analysis The documented interfaces allow a wallet private key to be supplied directly as a positional argument or through the global `--private-key` option. Command-line arguments are an inappropriate transport mechanism for signing keys because they may be retained or exposed through: - Shell history files. - Process listings and process-inspection interfaces. - Terminal session recording. - Agent tool-call transcripts and execution logs. - Debugging, monitoring, or command-auditing systems. - Copy-and-paste buffers and operational documentation. The Skill states that private keys must never be printed or logged and offers `--stdin` for import commands. Those controls partially mitigate the issue but do not prevent users or agents from selecting the explicitly documented argument-based forms. The global `--private-key` option is especially problematic because the shown documentation does not identify a safer equivalent for that invocation ...[truncated 1320 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Remove positional private-key arguments and the global `--private-key` option from all recommended workflows. 2. Require a protected input mechanism, such as: - Hidden interactive input from a terminal. - Standard input from a protected file descriptor. - An operating-system credential store or keychain. - A hardware wallet or external signing service. 3. Update the Skill to explicitly prohibit placing private keys in shell arguments, environment variables, command examples, chat messages, and agent tool calls. 4. If stdin remains supported, advise users to avoid unsafe forms such as `echo <key> | ...`, which can still expose the key through history or process arguments. Prefer hidden prompting or protected file-descriptor redirection. 5. Ensure files under `~/.deepbook` use restrictive permissions, such as owner-only access, and encrypt stored private-key material using an appropriate credential-management mechanism. 6. Redact private keys from command telemetry, exception messages, debug logs, and agent transcripts. 7. Add warnings and runtime rejection for command-line key arguments, followed by removal of the insecure interface in a documented migration. 8. Encourage users to rotate any private key previously supplied through a command-line argument if its confidentiality cannot be assured. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
Findings (2)

Missing User Warnings

Medium
Confidence
96% confidence
Finding
The skill explicitly documents commands that accept private keys as positional arguments or flags, which can expose secrets through shell history, process listings, terminal logs, and agent telemetry. Although the file says 'Never print or log private keys,' it still promotes unsafe input patterns, making accidental key disclosure likely in real use.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The skill provides step-by-step instructions for creating managers, depositing funds, executing spot trades, withdrawing assets, and performing margin close operations, but it does not prominently warn that these are live on-chain actions that can be irreversible and may result in loss of funds. In an agent skill context, this is especially risky because automation may follow the workflow directly and omit human confirmation before value-moving actions.

Static analysis

No suspicious patterns detected.