Back to skill

Security audit

SUPAH DeFi Optimizer

Security checks for vulnerabilities and agentic risk

Overview

The skill appears purpose-built for DeFi analysis, but its automatic paid API calls have inconsistent price disclosures and weak runtime controls.

Review this skill before installing. It sends wallet or position identifiers to a remote DeFi API and may cause automatic USDC x402 charges on Base. Only use it in an environment where you can confirm or cap spending, and treat the published per-action prices as ambiguous until the publisher makes them consistent.

Vulnerability Patterns
  • 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
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (2)

T09 · Insecure Skill Coding Practices

Warning
Location
index.js:31
Finding
Unvalidated CLI Input Allows API Route and Query Manipulation<![CDATA[ ## Vulnerability Details **File Location**: `index.js`, lines 31–37 **Vulnerability Type**: Improper validation and encoding of user-controlled URL path segments **Risk Level**: Medium ### Vulnerable Code ```js const cmd = args[0]; const input = args.slice(1).join(' '); const endpoint = cmd === 'positions' ? `/agent/v1/defi/positions/${input}` : cmd === 'optimize' ? `/agent/v1/defi/optimize/${input}` : cmd === 'yields' ? '/agent/v1/defi/yields' : cmd === 'rebalance' ? `/agent/v1/defi/rebalance/${input}` : cmd === 'il' ? `/agent/v1/defi/il/${input}` : null; if (!endpoint) { console.log('Unknown command. Run without arguments for help.'); return; } const res = await api(endpoint); ``` ### Technical Analysis The CLI concatenates the user-supplied wallet or position value directly into an API URL path. The value is not validated against the expected wallet or position identifier format and is not encoded with `encodeURIComponent`. Consequently, reserved URL characters and path components contained in the input may affect the request structure rather than being interpreted as part of a single identifier. For example: - `?` can introduce or replace the query string. - `#` can truncate the portion of the URL transmitted to the server. - `..` path segments may be normalized and alter the requested route. - `/` can inject additional path segments. The affected operation remains an HTTPS GET request to the configured API origin. This issue does not directly permit shell command execution or local privilege escalation. However, it can cause the client to access an API route different from the route implied by the selected CLI command. ### Attack Path 1. An attacker convinces a user or automated agent to invoke a wallet- or position-based command with a crafted identifier. 2. The identifier contains reserved URL characters or traversal-like path segments, such as `../../other-route?opti ...[truncated 1031 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Validate every wallet address against the exact supported blockchain format before constructing a request. For Base/EVM addresses, require a value matching an appropriate strict format, such as a 20-byte hexadecimal address with a `0x` prefix. 2. Define and enforce a strict allowlist format for position identifiers. 3. Encode each dynamic path segment independently: ```js const encodedInput = encodeURIComponent(input); const endpoint = `/agent/v1/defi/positions/${encodedInput}`; ``` 4. Construct requests with the WHATWG `URL` API rather than string concatenation: ```js const url = new URL(API); url.pathname = `/agent/v1/defi/positions/${encodeURIComponent(input)}`; ``` 5. Reject input containing unexpected separators, control characters, query delimiters, fragments, or path traversal components. 6. Before any x402 payment approval, verify that the final normalized URL still matches the exact endpoint selected by the CLI command. ]]>

other

Warning
Location
SKILL.md:41
Finding
Conflicting Price Disclosures Can Cause Unexpected Cryptocurrency Charges<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 41–45; `index.js`, lines 27–31; `README.md`, lines 10–11 **Vulnerability Type**: Inconsistent financial charge disclosure **Risk Level**: Medium ### Vulnerable Content `SKILL.md` advertises different prices for individual actions: ```md | Action | Price | What You Get | |--------|-------|-------------| | APY comparison | $0.02 | Top yields across Base protocols | | IL calculation | $0.05 | Impermanent loss analysis for position | | Position scan | $0.03 | All DeFi positions for a wallet | | Optimization report | $0.10 | AI-powered rebalancing suggestions | | Yield alert | $0.005/alert | Rate change notification | ``` The executable CLI advertises every exposed operation at `$0.10`: ```js console.log(' positions <wallet> - View positions ($0.10)'); console.log(' optimize <wallet> - Auto-optimize ($0.10)'); console.log(' yields - Compare APYs ($0.10)'); console.log(' rebalance <wallet> - Suggestions ($0.10)'); console.log(' il <position> - IL calculator ($0.10)\n'); ``` The README also advertises `$0.10` prices: ```md ## Pricing - View positions: $0.10 - Auto-optimize: $0.10 | IL calc: $0.10 | Rebalance: $0.10 ``` ### Technical Analysis The project provides materially inconsistent price disclosures: - Position scanning is listed as `$0.03` in `SKILL.md` but `$0.10` in the CLI and README. - APY comparison is listed as `$0.02` in `SKILL.md` but `$0.10` in the CLI. - Impermanent-loss calculation is listed as `$0.05` in `SKILL.md` but `$0.10` in the CLI and README. - Skill metadata permits payments up to `$0.10` per call. A user relying on the lower per-operation prices in `SKILL.md` may therefore authorize a runtime whose configured maximum permits a larger charge. The local implementation does not contain code that processes an x402 challenge or validates its amount, currency, recipient, network, or relationship to the requested operation. It only performs ...[truncated 1369 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Establish a single authoritative pricing configuration and generate `SKILL.md`, README pricing, and CLI help output from it. 2. Make the declared per-action price consistent across all package files. 3. Implement explicit x402 challenge handling rather than relying on undocumented external behavior. 4. Before authorizing payment, validate all relevant challenge fields: - Exact amount for the selected action - `USDC` currency - Base network - Expected recipient address - Expected API origin and endpoint - Challenge expiration and replay protections 5. Reject payment challenges above the exact action-specific price, even if they are below the global maximum. 6. Present the final amount and recipient to the user before payment when interactive approval is available. 7. Add automated tests that fail whenever metadata, documentation, executable help text, and enforced payment limits disagree. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (5)

Lp3

Medium
Category
MCP Least Privilege
Confidence
87% confidence
Finding
The skill declares environmental requirements and network/payment capabilities but does not define an explicit tool scope such as permissions or allowed-tools. That ambiguity can let an agent invoke the skill with broader-than-expected access, making unintended data exposure or external calls more likely.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The skill describes wallet position scanning and optimization but does not prominently warn that wallet addresses and DeFi position data are sent to external services. Even though blockchain data is public, linking a user's queried wallets, positions, and behavior to a third-party API creates privacy and profiling risks.

Vague Triggers

Medium
Confidence
91% confidence
Finding
The trigger phrases are broad and could cause the skill to activate on generic DeFi-related requests without clear user intent boundaries. In this skill, that is more dangerous because activation may result in paid external API calls and transmission of wallet-related data to a third party.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The skill advertises automatic x402 micropayments per call without a prominent user warning or consent flow at the point of use. Combined with broad triggers, this can lead to unintended charges from ordinary requests, making the risk more severe than a typical disclosure issue.

Missing User Warnings

Medium
Confidence
92% confidence
Finding
The CLI sends user-supplied wallet addresses or position identifiers to a remote API endpoint without any just-in-time disclosure, confirmation, or privacy warning at execution time. In a DeFi context, these identifiers can reveal portfolio composition, LP activity, and financial behavior, creating privacy and profiling risk even if the data is public on-chain.

Static analysis

No suspicious patterns detected.