Back to skill

Security audit

Torch Prediction Market Kit

Security checks for vulnerabilities and agentic risk

Overview

This is a real autonomous Solana market bot, but its key/linking flow, spending controls, and package provenance are too under-scoped for automatic approval.

Review this before installing or running it with real funds. Use an exact pinned package and lockfile, confirm the runtime imports the reviewed SDK, run with a low-funded dedicated vault, restrict who can edit markets.json, require manual approval or budgets for batches, and avoid providing a valuable private key.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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
Findings (4)

T09 · Insecure Skill Coding Practices

Error
Location
lib/torchsdk/tokens.js:272
Finding

Unrestricted On-Chain Metadata Fetch Enables Server-Side Request Forgery

Content
View full analysis
{ const controller = new AbortController(); const timer = setTimeout(() => controller.abort(), timeoutMs); const opts = { ...options, signal: controller.signal }; try { // If it's an Irys gateway URL, use uploader directly (gateway has SSL issues) if ((0, exports.isIrysUrl)(url)) { const uploaderUrl = (0, exports.irysToUploader)(url); return await fetch(uploaderUrl, opts); } // For non-Irys URLs, fetch normally return await fetch(url, opts); ``` ### Technical Analysis The `getToken()` implementation retrieves the metadata URI from on-chain bonding-curve state and passes it directly to `fetchWithFallback()`. The latter accepts arbitrary non-Irys URLs and calls `fetch()` without validating: - The URL scheme - The destination hostname - Resolved IP addresses - Loopback, private, link-local, or cloud metadata address ranges - Redirect destinations - Response content type - Maximum response size The bot invokes `getToken()` from `snapshotMarket()` for each active market. Consequently, metadata retrieval is part of normal continuous operation rather than an explicitly authorized metadata-fetching action. The local allowlist applied to pending market definitions does not fully mitigate this issue. Already-active market entries are not revalidated, and an allowl ...[truncated 1743 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
lib/kit/markets.js:112
Finding

Non-Atomic Market Lifecycle Can Repeat On-Chain Spending After Partial Success

Content
View full analysis
{ // create the torch token const createResult = await (0, utils_1.withTimeout)((0, torchsdk_1.buildCreateTokenTransaction)(connection, { creator: agentKeypair.publicKey.toBase58(), name: market.name, symbol: market.symbol, metadata_uri: market.metadataUri, }), SDK_TIMEOUT_MS, 'buildCreateTokenTransaction'); createResult.transaction.sign(agentKeypair); const createSig = await (0, utils_1.withTimeout)(connection.sendRawTransaction(createResult.transaction.serialize()), SDK_TIMEOUT_MS, 'sendRawTransaction(create)'); await (0, utils_1.withTimeout)((0, torchsdk_1.confirmTransaction)(connection, createSig, agentKeypair.publicKey.toBase58()), SDK_TIMEOUT_MS, 'confirmTransaction(create)'); const mintAddress = createResult.mint.toBase58(); // seed liquidity via vault buy if (market.initialLiquidityLamports > 0) { const buyResult = await (0, utils_1.withTimeout)((0, torchsdk_1.buildBuyTransaction)(connection, { mint: mintAddress, buyer: agentKeypair.publicKey.toBase58(), amount_sol: market.initialLiquidityLamports, slippage_bps: 500, vault: vaultCreator, }), SDK_TIMEOUT_MS, 'buildBuyTransaction'); buyResult.transaction.sign(agentKeypair); const buySig = await (0, utils_1.withTimeout)(connection.sendRawTransaction(buyResult.transaction.serialize()), SDK_TIMEOUT_MS, 'sendRawTransaction(buy)'); await (0, utils_1.withTimeout)((0, torchsdk_1.confirmTransaction)(connection, buySig, agentKeypair.publicKey.toBase58()), SDK_TIMEOUT_MS, 'confirm ...[truncated 3596 chars]
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Error
Location
lib/kit/markets.js:56
Finding

Per-Market Liquidity Limit Does Not Prevent Aggregate Vault Depletion

Content
View full analysis
{ if (lamports < 0) { throw new Error(`initialLiquidityLamports cannot be negative for market "${marketId}"`); } if (lamports > MAX_LIQUIDITY_LAMPORTS) { throw new Error(`initialLiquidityLamports ${lamports} exceeds max ${MAX_LIQUIDITY_LAMPORTS} (10 SOL) for market "${marketId}"`); } }; ``` ```js // lib/kit/index.js:32-45 const marketCycle = async (connection, log, marketsPath, vaultCreator, agentKeypair) => { const markets = (0, markets_1.loadMarkets)(marketsPath); let dirty = false; for (const market of markets) { try { // --- create pending markets --- if (market.status === 'pending') { log('info', `CREATING | ${market.id} — "${market.question}"`); const mint = await (0, markets_1.createMarket)(connection, market, agentKeypair, vaultCreator); market.mint = mint; market.status = 'active'; ``` ### Technical Analysis The code limits `initialLiquidityLamports` to 10 SOL for each individual market. It does not limit: - The number of pending markets - Total spending in one cycle - Total spending over a time window - Total lifetime spending - The percentage of the vault balance that may be used - A minimum reserve that must remain in the vault The controller processes every pending market autonomously. Therefore, a file containing many individually valid entries can authorize spending far beyond 10 SOL in aggregate. This exceeds minimum-privilege expectations for a disposable autonomous controller. The local 10 ...[truncated 1582 chars]
Remediation
View remediation

T08 · Insecure Dependencies

Warning
Location
SKILL.md:35
Finding

Runtime Dependency Resolution Does Not Match the Bundled Audited SDK

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • System Prompt LeakageDirect Leakage, Indirect Extraction, Tool-Based Exfiltration
  • Memory PoisoningPersistent Context Injection, Context Window Stuffing, Memory Manipulation
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (49)

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

A documented autonomous bot that does not actually implement the claimed controls, lifecycle, and linkage logic is a security problem because users may deploy it expecting bounded automated behavior and safety properties that are absent. In financial automation, false assurances around vault routing and oracle resolution can directly affect fund safety and operational decisions.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

A documented autonomous bot that does not actually implement the claimed controls, lifecycle, and linkage logic is a security problem because users may deploy it expecting bounded automated behavior and safety properties that are absent. In financial automation, false assurances around vault routing and oracle resolution can directly affect fund safety and operational decisions.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

A documented autonomous bot that does not actually implement the claimed controls, lifecycle, and linkage logic is a security problem because users may deploy it expecting bounded automated behavior and safety properties that are absent. In financial automation, false assurances around vault routing and oracle resolution can directly affect fund safety and operational decisions.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

A documented autonomous bot that does not actually implement the claimed controls, lifecycle, and linkage logic is a security problem because users may deploy it expecting bounded automated behavior and safety properties that are absent. In financial automation, false assurances around vault routing and oracle resolution can directly affect fund safety and operational decisions.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

A documented autonomous bot that does not actually implement the claimed controls, lifecycle, and linkage logic is a security problem because users may deploy it expecting bounded automated behavior and safety properties that are absent. In financial automation, false assurances around vault routing and oracle resolution can directly affect fund safety and operational decisions.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

A documented autonomous bot that does not actually implement the claimed controls, lifecycle, and linkage logic is a security problem because users may deploy it expecting bounded automated behavior and safety properties that are absent. In financial automation, false assurances around vault routing and oracle resolution can directly affect fund safety and operational decisions.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

A documented autonomous bot that does not actually implement the claimed controls, lifecycle, and linkage logic is a security problem because users may deploy it expecting bounded automated behavior and safety properties that are absent. In financial automation, false assurances around vault routing and oracle resolution can directly affect fund safety and operational decisions.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

A documented autonomous bot that does not actually implement the claimed controls, lifecycle, and linkage logic is a security problem because users may deploy it expecting bounded automated behavior and safety properties that are absent. In financial automation, false assurances around vault routing and oracle resolution can directly affect fund safety and operational decisions.

Content

No source excerpt is available for this finding.

Direct Prompt Extraction

High
Category
System Prompt Leakage
Confidence
85% confidence
Finding

Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.

Content

Scanner excerpt · audit.md (reported line 146)May include surrounding context.

if (!vault) throw new Error(...)

const link = await getVaultForWallet(connection, agentKeypair.publicKey.toBase58()) // index.ts:144 if (!link) { /* print instructions, exit */ }

text

The bot verifies both vault existence and agent linkage before entering the market cycle.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
96% confidence
Finding

The interface includes explicit asset-movement and privilege-management operations such as withdraw_vault, withdraw_tokens, link_wallet, unlink_wallet, and transfer_authority. Those capabilities are not inherently malicious in a protocol, but they are high-risk to expose through an autonomous bot skill because they enable direct custody changes, withdrawal of funds, and expansion of who can spend from a vault if an agent is tricked, misconfigured, or over-permissioned. The skill context makes this more dangerous because it claims safety through a vault model while simultaneously exposing the exact administrative operations that can drain or reassign control of that vault.

Content

No source excerpt is available for this finding.

Memory Manipulation

High
Category
Memory Poisoning
Confidence
85% confidence
Finding

Skill manipulates agent memory, state, or stored context. Memory corruption can alter personality, override safety rules, or cause unpredictable behavior.

Content

Scanner excerpt · lib/torchsdk/transactions.js (reported line 1270)May include surrounding context.

js
})))
            .instruction();
    };
    // Helper: build the swap instruction
    const buildSwapIx = async () => {
        return program.methods
            .swapFeesToSol(new anchor_1.BN(minimum_amount_out.toString()))

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding

The skill declares environment and network requirements but does not define an explicit tool/permission scope. In an agent ecosystem, that creates ambiguity about what capabilities the skill is expected to exercise and weakens policy enforcement, especially for a skill that can initiate blockchain transactions and external HTTP requests.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
88% confidence
Finding

Using npx torch-prediction-market-bot without pinning an exact version allows whatever package version is current at execution time to be fetched and run. This introduces supply-chain risk and can result in unexpected behavior or malicious code being executed if the package is updated or compromised.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

Line L034 states the bot performs no trading, yet the same document later describes buildBuyTransaction usage and agent signing of buy transactions at L131 and L154-L160. A buy is a trading action, so the documentation actively contradicts the behavior it documents.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
78% confidence
Finding

The audit minimizes oracle resolution as having 'no financial impact' even though the skill metadata describes markets that resolve at a deadline, making resolution a core state transition. If operators trust this claim, they may under-secure oracle inputs or manual resolution flows, which could allow incorrect market outcomes, disputes, or downstream fund/accounting errors depending on protocol behavior.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
70% confidence
Finding

npx commands without a version suffix (e.g. @1.0.0) create a rug-pull risk if the upstream server is compromised and publishes a malicious update.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

createMarket signs and submits raw blockchain transactions for token creation, liquidity purchase, and possible migration via sendRawTransaction. These are irreversible external actions, but this file provides no confirmation prompt, user-facing disclosure, or warning text around the transaction execution.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · SKILL.md (reported line 464)May include surrounding context.

md
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.checkOracle = exports.checkPriceFeed = void 0;
const COINGECKO_API = 'https://api.coingecko.com/api/v3/simple/price';
const ALLOWED_ORACLE_ASSETS = new Set([
    'solana',
    'bitcoin',

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · audit.md (reported line 229)May include surrounding context.

md
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.checkOracle = exports.checkPriceFeed = void 0;
const COINGECKO_API = 'https://api.coingecko.com/api/v3/simple/price';
const ALLOWED_ORACLE_ASSETS = new Set([
    'solana',
    'bitcoin',

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · design.md (reported line 164)May include surrounding context.

md
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.checkOracle = exports.checkPriceFeed = void 0;
const COINGECKO_API = 'https://api.coingecko.com/api/v3/simple/price';
const ALLOWED_ORACLE_ASSETS = new Set([
    'solana',
    'bitcoin',

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · lib/kit/oracle.js (reported line 10)May include surrounding context.

js
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.checkOracle = exports.checkPriceFeed = void 0;
const COINGECKO_API = 'https://api.coingecko.com/api/v3/simple/price';
const ALLOWED_ORACLE_ASSETS = new Set([
    'solana',
    'bitcoin',

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The comment claims the ephemeral key has 'zero risk', but the returned object exposes the raw keypair to any caller, which directly exposes private key material in process memory. In a vault-signing bot, misleading safety claims can cause integrators to handle the object less carefully, increasing the chance of key misuse, logging, serialization, or unintended exfiltration while the process is running.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

This index re-exports broad protocol capabilities including token creation, borrowing, repayment, liquidation, rewards claims, and general vault operations that exceed the stated prediction-market-bot scope. In an agent-skill setting, exposing unnecessary high-impact primitives increases the attack surface and raises the risk that downstream agent logic, prompts, or tool routing could invoke financially dangerous actions outside the intended use case.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The manifest describes a Solana prediction-market bot that creates and manages Torch markets and routes funds through a vault. This file adds an external integration to query SAID Protocol for wallet reputation and trust tier, which is not mentioned in the skill description and is not an obvious implementation detail of running Torch markets.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · agent.json (reported line 202)May include surrounding context.

json
Object.defineProperty(exports, "__esModule", { value: true });
exports.confirmTransaction = exports.verifySaid = void 0;
const constants_1 = require("./constants");
const SAID_API_URL = 'https://api.saidprotocol.com/api';
// ============================================================================
// Verify
// ============================================================================

Static analysis

No suspicious patterns detected.