Back to skill

Security audit

Apex

Security checks for vulnerabilities and agentic risk

Overview

The skill is a real ApeX trading integration, but it can place and cancel live futures orders with weak enforced safeguards.

Only install this if you are comfortable giving the skill ApeX trading authority. Prefer testnet first, use tightly scoped API credentials with withdrawals disabled, avoid exposing a primary seed, review every order before execution, and be especially careful with cancel-all, close-position, and reward-enrollment requests.

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 (3)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/apex.mjs:190
Finding
Signed trading operations accept unvalidated order sizes and prices<![CDATA[ ## Vulnerability Details **File Location**: `scripts/apex.mjs:190-243` and `scripts/apex.mjs:246-283` **Vulnerability Type**: Insufficient validation of security-critical financial inputs **Risk Level**: High ### Vulnerable Code ```js case 'market-buy': case 'market-sell': { const apexClient = await createPrivateClient(); const symbol = normalizeSymbol(args[1]); const size = args[2]; if (!symbol || !size) { throw new Error(`Usage: apex ${command} <coin> <size>`); } const side = command === 'market-buy' ? 'BUY' : 'SELL'; const symbolInfo = apexClient.symbols?.[symbol]; if (!symbolInfo?.l2PairId) { throw new Error(`Unknown symbol: ${symbol}`); } let price = ''; try { const worst = await apexClient.privateApi.getWorstPrice(symbol, size, side); price = worst?.worstPrice || ''; } catch (err) { const ticker = await getTickerPrice(apexClient, symbol); price = ticker?.lastPrice || ''; } if (!price) throw new Error(`Unable to determine price for ${symbol}`); const makerFeeRate = apexClient.account?.contractAccount?.makerFeeRate || '0'; const takerFeeRate = apexClient.account?.contractAccount?.takerFeeRate || '0'; const limitFee = calculateLimitFee(price, size, takerFeeRate, symbolInfo.baseCoinRealPrecision); const order = { pairId: symbolInfo.l2PairId, makerFeeRate, takerFeeRate, symbol, side, type: 'MARKET', size: String(size), price: String(price), limitFee, reduceOnly: false, timeInForce: 'IMMEDIATE_OR_CANCEL', expiration: Math.floor(Date.now() / 1000 + 30 * 24 * 60 * 60), }; const result = await apexClient.privateApi.createOrder(order); console.log(JSON.stringify(result, null, 2)); break; } ``` The limit-order path uses the same insufficient validation pattern: ```js case 'limit-buy': case 'limit-sell': { const apexClient = await createPrivateClient(); const symbol = normalizeSymbol(args[1]); const size = args[2]; const price ...[truncated 3194 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Parse all monetary inputs with `BigNumber` before creating a private client or signing an order. 2. Reject values that are non-numeric, non-finite, zero, or negative. 3. Enforce the exchange-provided minimum quantity, maximum quantity, quantity step, price tick, and decimal-precision constraints. 4. Calculate order notional and compare it with available balance and total equity. 5. Reject or require additional explicit approval for trades exceeding a configured percentage of account equity. 6. Compare limit prices with a fresh market price and reject or reconfirm excessive deviations. 7. Add a maximum configurable order-notional limit that defaults to a conservative value. 8. Require an explicit, short-lived confirmation token containing the symbol, side, size, price, environment, and estimated notional. 9. Add tests covering negative numbers, zero, `NaN`, `Infinity`, exponential notation, excessive precision, oversized values, and malformed strings. 10. Treat downstream SDK and exchange validation as defense in depth rather than the primary validation mechanism. ]]>

T09 · Insecure Skill Coding Practices

Error
Location
scripts/apex.mjs:220
Finding
Documented position-closing workflow can reverse or increase exposure<![CDATA[ ## Vulnerability Details **File Location**: `scripts/apex.mjs:220-230`; related workflow in `SKILL.md:193-196` **Vulnerability Type**: Unsafe position-closing semantics **Risk Level**: High ### Vulnerable Code ```js const order = { pairId: symbolInfo.l2PairId, makerFeeRate, takerFeeRate, symbol, side, type: 'MARKET', size: String(size), price: String(price), limitFee, reduceOnly: false, timeInForce: 'IMMEDIATE_OR_CANCEL', expiration: Math.floor(Date.now() / 1000 + 30 * 24 * 60 * 60), }; ``` The Skill instructs the Agent to use this general order path to close positions: ```md **"Close my ETH position"** 1. Run `positions` to get current ETH position size 2. If long → market-sell, if short → market-buy 3. Execute with position size 4. Report result ``` ### Technical Analysis The documented close-position workflow reuses `market-buy` or `market-sell`, but those commands explicitly set `reduceOnly: false`. An opposite-side order is not equivalent to a reduce-only close. Between reading the current position and submitting the order, the position can change because of fills, liquidation, another client, or a concurrent Agent action. A duplicated command can likewise execute after the original close has completed. Without reduce-only enforcement, an order intended to reduce exposure can open a new position in the opposite direction or increase an already changed position. This is a time-of-check/time-of-use risk involving financial state. ### Attack Path 1. The user requests that an existing position be closed. 2. The Agent retrieves the current position and records its size and direction. 3. Before submission, the position changes through another fill, manual action, liquidation, or concurrent automation. 4. The Agent invokes the opposite-side market command using the previously observed size. 5. The order is submitted with `reduceOnly: false`. 6. Instead of being rejected or capped at the remaining position, it can establi ...[truncated 840 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Add a dedicated `close-position` command instead of implementing closes through general buy and sell commands. 2. Set `reduceOnly: true` for every close-position order. 3. Refresh the position immediately before signing the order. 4. Derive the closing side and maximum size from the refreshed server-side position rather than accepting them directly from the user. 5. Reject the operation if the position no longer exists or its direction has changed. 6. Cap the requested close quantity to the current absolute position size. 7. Where supported, use an exchange endpoint or SDK operation with atomic close semantics. 8. Include symbol, current position, closing quantity, `reduceOnly` status, and environment in the final confirmation. 9. Introduce an idempotency mechanism to prevent duplicate Agent invocations from creating repeated orders. 10. Add concurrency tests that simulate partial fills and position changes between inspection and submission. ]]>

T08 · Insecure Dependencies

Warning
Location
scripts/package.json:5
Finding
Sensitive signing operations depend on an alpha SDK and mixed package registries<![CDATA[ ## Vulnerability Details **File Location**: `scripts/package.json:5-8`; `scripts/package-lock.json:576-595,712`; installation instruction at `SKILL.md:15-19` **Vulnerability Type**: Supply-chain exposure in a credential-sensitive dependency path **Risk Level**: Medium ### Vulnerable Configuration ```json { "dependencies": { "apexomni-connector-node": "0.3.2-alpha.1", "bignumber.js": "^9.1.2", "node-fetch": "^3.3.2" } } ``` The lockfile pins an alpha SDK that receives the API credentials and signing seed: ```json "apexomni-connector-node": { "version": "0.3.2-alpha.1", "resolved": "https://registry.npmjs.org/apexomni-connector-node/-/apexomni-connector-node-0.3.2-alpha.1.tgz", "integrity": "sha512-8sd7UsWcCODinYD81FsRHthdCBHEtyRPYlv/kKdBZK1VwO3//XFUJijDInqw5hwg7K7/SjAcR4pjAM0SCwLiJQ==", "requires": { "axios": "^1.6.7", "big.js": "^6.2.1", "bigint-buffer": "^1.1.5", "bignumber.js": "^9.0.1", "crypto": "^1.0.1", "crypto-browserify": "^3.12.0", "crypto-js": "^4.2.0", "es6-promisify": "^7.0.0", "ethereum-cryptography": "0.1.3", "ethers": "5.5.4", "isomorphic-ws": "^4.0.1", "lodash": "^4.17.21", "qs": "^6.11.1", "viem": "^2.21.22", "web3": "1.7.4" } } ``` The same lockfile uses a second registry source: ```json "bignumber.js": { "version": "9.3.1", "resolved": "https://registry.npmmirror.com/bignumber.js/-/bignumber.js-9.3.1.tgz", "integrity": "sha512-Ko0uX15oIUS7wJ3Rb30Fs6SkVbLmPBAKdlm7q9+ak9bbIeFf0MwuBsQV6z7+X768/cHsfg+WlysDWJcmthjsjQ==" } ``` Installation is requested through: ```bash cd skills/apex/scripts && npm install ``` ### Technical Analysis The runtime passes the user's ApeX API key, API secret, passphrase, and Omni signing seed to `apexomni-connector-node`. That package is explicitly an alpha release and brings a broad transitive dependency graph into the same process as the signing material. The lockfile contains integrity hashes, which help de ...[truncated 1855 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Replace the alpha connector with a stable, vendor-supported, independently reviewed release where possible. 2. Review the SDK source and published archive before allowing it to handle signing material. 3. Regenerate the lockfile using one organization-approved registry and remove mixed registry URLs. 4. Use `npm ci` instead of `npm install` for reproducible installations. 5. Use `npm ci --ignore-scripts` where compatible, and explicitly review any dependency that requires installation scripts. 6. Pin all direct dependencies to exact versions rather than version ranges. 7. Run dependency vulnerability, provenance, and license checks in CI. 8. Minimize the dependency graph and remove packages not required by the executed scripts. 9. Isolate signing into a minimal restricted process with no unnecessary filesystem or network access. 10. Prefer scoped API credentials with the minimum required permissions, disable withdrawals, and rotate credentials after suspected compromise. 11. Avoid exposing a general wallet seed when a restricted API-specific signer or hardware-backed signing mechanism is available. 12. Monitor dependency changes and require manual approval for lockfile updates. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • 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
Findings (45)

Known Vulnerable Dependency: elliptic==6.5.4 — 7 advisory(ies): CVE-2024-48949 (Elliptic's verify function omits uniqueness validation); CVE-2024-42461 (Elliptic allows BER-encoded signatures); CVE-2025-14505 (Elliptic Uses a Cryptographic Primitive with a Risky Implementation) +4 more

Critical
Category
Supply Chain
Confidence
90% confidence
Finding
elliptic 6.6.1 is also flagged, though with a lower-severity advisory than 6.5.4. Because this skill handles blockchain and cryptographic ecosystems, even lower-severity cryptographic library weaknesses deserve attention, especially where signing or verification is central to operation.

Ae1

High
Category
analysis-evasion
Content
node scripts/apex.mjs price BTC
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
node scripts/apex.mjs price BTC
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
node scripts/apex.mjs price BTC
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
node scripts/apex.mjs price BTC
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
node scripts/apex.mjs price BTC
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
node scripts/apex.mjs price BTC
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
node scripts/apex.mjs price BTC
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
node scripts/apex.mjs price BTC
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
node scripts/apex.mjs price BTC
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
node scripts/apex.mjs price BTC
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
node scripts/apex.mjs price BTC
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
node scripts/apex.mjs price BTC
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
node scripts/apex.mjs price BTC
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
node scripts/apex.mjs price BTC
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Missing User Warnings

High
Confidence
97% confidence
Finding
The script exposes market-buy, market-sell, limit-buy, and limit-sell commands that immediately submit live orders using configured production credentials, but it provides no confirmation prompt, no explicit dry-run/simulation mode, and no risk acknowledgment before execution. In the context of an agent skill for trading, this is especially dangerous because an upstream agent, prompt injection, user misunderstanding, or malformed parameter could trigger real financial transactions and losses without a final human verification step.

Missing User Warnings

High
Confidence
96% confidence
Finding
The cancel-all command can cancel every open order, optionally across the entire account, with no confirmation step and no destructive-operation warning. In a trading skill, this can abruptly remove protective or strategic orders due to user error, agent misbehavior, or prompt injection, potentially exposing positions to unmanaged market risk.

Known Vulnerable Dependency: ws==3.3.3 — 2 advisory(ies): CVE-2024-37890 (ws affected by a DoS when handling a request with many HTTP headers); CVE-2026-48779 (ws: Memory exhaustion DoS from tiny fragments and data chunks)

High
Category
Supply Chain
Confidence
86% confidence
Finding
ws 3.3.3 is an outdated WebSocket library version with known denial-of-service issues. Since exchange and blockchain tooling often rely on long-lived WebSocket feeds for balances, positions, or market data, an attacker or malicious endpoint could exhaust memory or processing and disrupt trading workflows.

Known Vulnerable Dependency: axios==1.13.5 — 16 advisory(ies): CVE-2026-44494 (axios Vulnerable to Full Man-in-the-Middle via Prototype Pollution Gadget in `co); CVE-2026-44495 (axios Vulnerable to Credential Theft and Response Hijacking via Prototype Pollut); CVE-2025-62718 (Axios has a NO_PROXY Hostname Normalization Bypass that Leads to SSRF) +13 more

High
Category
Supply Chain
Confidence
88% confidence
Finding
axios 1.13.5 is flagged with multiple advisories including SSRF- and redirect-related issues. In a trading integration that likely performs outbound API calls to exchanges and blockchain services, HTTP client weaknesses can expose credentials, bypass proxy restrictions, or enable request redirection to attacker-controlled targets.

Known Vulnerable Dependency: bigint-buffer==1.1.5 — 1 advisory(ies): CVE-2025-3194 (bigint-buffer Vulnerable to Buffer Overflow via toBigIntLE() Function)

High
Category
Supply Chain
Confidence
81% confidence
Finding
bigint-buffer 1.1.5 is flagged for a buffer overflow issue in numeric conversion logic. In a crypto/web3-heavy skill, malformed binary or numeric data from external APIs, RPC responses, or encoded transaction material could trigger crashes or memory-safety issues in native-adjacent code paths.

Known Vulnerable Dependency: lodash==4.17.23 — 2 advisory(ies): CVE-2025-13465 (lodash vulnerable to Prototype Pollution via array path bypass in `_.unset` and ); CVE-2021-23337 (lodash vulnerable to Code Injection via `_.template` imports key names)

High
Category
Supply Chain
Confidence
85% confidence
Finding
lodash 4.17.23 is flagged for prototype pollution and code-injection-related issues in specific functions. In a skill that may process user parameters, market/order metadata, or API payloads, unsafe use of affected helpers could corrupt application state or, in some patterns, enable more severe exploitation chains.

Known Vulnerable Dependency: form-data==4.0.5 — 1 advisory(ies): CVE-2026-12143 (form-data: CRLF injection in form-data via unescaped multipart field names and f)

High
Category
Supply Chain
Confidence
83% confidence
Finding
form-data 4.0.5 is flagged for CRLF injection via multipart field names and filenames. If any part of the skill uploads files or constructs multipart requests using attacker-controlled field metadata, this can corrupt HTTP requests or smuggle unintended headers/content to downstream services.

Possible Typosquatting: 'ext' resembles popular package 'next'

High
Category
Supply Chain
Confidence
70% confidence
Finding
Package name closely resembles a popular package, suggesting possible typosquatting. Attackers publish malicious packages with similar names to trick developers into installing them.

Lp3

Medium
Category
MCP Least Privilege
Confidence
92% confidence
Finding
The skill performs credentialed trading actions and explicitly relies on environment secrets and network access, but it does not declare any tool scope or permission boundaries. In an agent environment, missing scope declarations can allow the skill to be invoked with broader-than-expected capabilities, increasing the risk of unauthorized account access, order placement, or secret exposure.

Vague Triggers

Medium
Confidence
94% confidence
Finding
The skill instructs the agent to default to reward ID `300001` when the user asks to enroll but does not provide an ID, which creates an implicit state-changing action based on incomplete user input. In a trading skill handling authenticated operations, this can lead to unintended enrollment in promotions or contests the user did not clearly authorize.

Static analysis

No suspicious patterns detected.