Back to skill

Security audit

Near Dca

Security checks for vulnerabilities and agentic risk

Overview

The skill is a NEAR DCA tool, but it advertises real automated investing while the code uses mock prices and fabricated transaction hashes, and it still asks for wallet credentials.

Treat this as a review-required prototype, not a safe investing automation skill. Do not provide real NEAR private keys, do not enable scheduled execution on a funded account, and do not rely on its purchase history or transaction hashes until real on-chain submission, receipt verification, secure signing, clear simulation labeling, confirmations, and dependency updates are implemented.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • Tool Hijacking and SpoofingModifies or replaces tools so legitimate-looking calls execute attacker logic
  • 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)

T07 · Tool Hijacking and Spoofing

Error
Location
src/dca-manager.js:50
Finding

Fabricated DCA Purchases and Transaction Records

Content
View full analysis

Vulnerability Details

File Location: src/dca-manager.js:50-159
Vulnerability Type: Transaction and tool-output spoofing
Risk Level: Critical

Vulnerable Code:

js
async fetchFromBinance(symbol) {
  // Mock implementation
  return 6.52;
}

async fetchFromCoinbase(symbol) {
  // Mock implementation
  return 6.48;
}

async executeSwap(accountId, privateKey, exchange, amountUSD) {
  const nearPrice = await this.getNearPrice();
  const nearAmount = amountUSD / nearPrice;

  const exchangeInstance = this.exchanges[exchange];
  if (!exchangeInstance) {
    throw new Error(`Unknown exchange: ${exchange}`);
  }

  const result = await exchangeInstance.swap({
    accountId,
    privateKey,
    amountUSD,
    nearAmount,
    nearPrice
  });

  return {
    txHash: result.txHash,
    nearAmount,
    nearPrice,
    usdSpent: amountUSD,
    timestamp: new Date().toISOString(),
    exchange
  };
}
js
class RefFinanceExchange {
  constructor(config) {
    this.poolId = 4; // NEAR/USDT pool on Ref Finance
  }

  async swap({ accountId, privateKey, nearAmount, nearPrice }) {
    // Implement Ref Finance swap logic
    // This would use near-api-js to interact with Ref Finance contract
    const txHash = crypto.randomBytes(32).toString('hex');

    return {
      txHash,
      success: true,
      nearReceived: nearAmount * 0.997,
      slippage: 0.001
    };
  }
}

class JumboExchange {
  constructor(config) {
    this.routerAddress = 'token.jumbo_exchange.near';
  }

  async swap({ accountId, privateKey, nearAmount, nearPrice }) {
    const txHash = crypto.randomBytes(32).toString('hex');

    return {
      txHash,
      success: true,
      nearReceived: nearAmount * 0.997,
      slippage: 0.001
    };
  }
}

class BancorExchange {
  constructor(config) {
    this.poolId = 'near-usdt';
  }

  async swa
...[truncated 2535 chars]
Remediation
View remediation

Remediation Suggestions

  • Remove or disable all purchase actions and scheduled execution until genuine transaction support is implemented.
  • If the code is intended as a simulator, rename actions and response fields to identify them explicitly as simulations.
  • Use testnet-only defaults for development and prevent simulated transactions from being recorded as real purchases.
  • Retrieve prices from authenticated or otherwise validated market-data providers, with timeouts and stale-price checks.
  • Construct and sign transactions through a supported NEAR SDK.
  • Submit transactions only to an explicitly configured network and validated contract allowlist.
  • Record success only after obtaining and verifying a finalized on-chain receipt.
  • Validate the receipt’s signer, receiver, method, token amounts, status, and network.
  • Return simulation identifiers separately; never format random bytes as an on-chain transaction hash.
  • Add tests that query transaction receipts and reject fabricated or unconfirmed hashes.

T05 · Unauthorized Access and Privilege Escalation

Error
Location
actions/index.js:89
Finding

Wallet Private Key Accepted and Propagated Without Operational Need

Content
View full analysis

Vulnerability Details

File Location: actions/index.js:89-99; src/dca-manager.js:64-76; src/dca-manager.js:292-313
Vulnerability Type: Excessive credential access and violation of least privilege
Risk Level: High

Vulnerable Code:

js
async function executePurchase(params, context) {
  const { strategy_id, account_id, private_key } = params;
  const config = context.config || {};

  const manager = getManager(config);

  try {
    const result = await manager.executePurchase(
      strategy_id,
      account_id,
      private_key
    );
js
async executeSwap(accountId, privateKey, exchange, amountUSD) {
  const nearPrice = await this.getNearPrice();
  const nearAmount = amountUSD / nearPrice;

  const exchangeInstance = this.exchanges[exchange];
  if (!exchangeInstance) {
    throw new Error(`Unknown exchange: ${exchange}`);
  }

  const result = await exchangeInstance.swap({
    accountId,
    privateKey,
    amountUSD,
    nearAmount,
    nearPrice
  });
}
js
const result = await this.nearIntegration.executeSwap(
  accountId || this.config.account_id,
  privateKey || this.config.private_key,
  strategy.exchange,
  strategy.amount
);

Technical Analysis

The action accepts a raw wallet private key and passes it through the manager into exchange adapters. The current adapters do not use the private key because they do not construct or sign real transactions.

Access to a wallet signing credential is therefore unnecessary for the functionality actually implemented. This exceeds minimum privilege and unnecessarily exposes the credential to action-parameter processing, configuration handling, manager state, and adapter call frames.

Although the audited code does not persist, log, or transmit the private key, accepting it enlarges the sensitive-data exposure surface. The README also presents plaintext private_key configuratio ...[truncated 1254 chars]

Remediation
View remediation

Remediation Suggestions

  • Remove private_key and account_id from the simulation action and internal adapter interfaces.
  • Reject private-key input while the Skill remains simulation-only.
  • Do not recommend plaintext private keys in README examples or ordinary Skill configuration.
  • For a real implementation, use the platform’s secure credential provider or a scoped external signer.
  • Prefer narrowly scoped function-call keys where the NEAR security model and intended contracts permit them.
  • Restrict signing authority to an allowlist of contracts, methods, networks, and spending limits.
  • Redact credential fields in all action traces, errors, telemetry, and debug logs.
  • Keep secret values out of persisted strategy state and returned action objects.
  • Add automated tests confirming that credentials are neither logged nor serialized.

T07 · Tool Hijacking and Spoofing

Error
Location
skill.yaml:56
Finding

Declared Financial and Notification Capabilities Do Not Match the Implementation

Content
View full analysis

Vulnerability Details

File Location: README.md:5-12; README.md:174-186; README.md:212-230; skill.yaml:56-66; skill.yaml:136-143
Vulnerability Type: Misleading tool capability declaration
Risk Level: High

Vulnerable Configuration and Documentation:

md
- 💱 **Multiple Exchanges** - Integration with Ref Finance, Jumbo, Bancor,
  and on-chain swaps
- 📈 **Cost Basis Tracking** - Automatic calculation of average cost basis
  across all purchases
- 🔔 **Alerts** - Configurable notifications on successful and failed
  executions
yaml
- name: execute-purchase
  description: Manually execute a DCA purchase for a strategy
  input:
    type: object
    properties:
      strategy_id:
        type: string
    required:
      - strategy_id
yaml
triggers:
  - type: schedule
    name: dca-executor
    description: Checks and executes scheduled DCA purchases
    config:
      schedule: "*/5 * * * *"
      action: execute-scheduled-purchases

The alert implementation is only local logging:

js
async sendToChannel(channel, message) {
  // This would integrate with OpenClaw's notification system
  // For now, just log the message
  console.log(`[DCA Alert - ${channel}] ${message}`);
}

Technical Analysis

The manifest and README advertise real exchange integrations, purchase execution, external notification channels, actual execution prices, transaction fees, slippage handling, and network-failure behavior.

The implementation instead uses fixed prices, simulated adapters, random transaction hashes, and console logging for alerts. The scheduled trigger compounds the issue by automatically invoking behavior described as financial execution and then storing generated results as successful purchases.

This discrepancy can cause an agent to select and invoke the Skill based on capabilities that do not exist. It also makes the fabricate ...[truncated 1228 chars]

Remediation
View remediation

Remediation Suggestions

  • Change the Skill name, action descriptions, responses, and documentation to state clearly that it is simulation-only.
  • Remove the automatic purchase trigger while no real transaction implementation exists.
  • Do not claim support for an exchange until transaction construction, submission, and receipt verification are implemented and tested.
  • Do not advertise Discord, Telegram, or email delivery while alerts only use console.log().
  • Mark all generated prices and transaction identifiers as mock data.
  • Separate simulation history from real transaction history using distinct schemas and storage.
  • Add capability tests that validate every manifest claim against implemented behavior.
  • Require explicit user confirmation before enabling any future mainnet financial execution.

T09 · Insecure Skill Coding Practices

Warning
Location
src/dca-manager.js:190
Finding

Non-Atomic and Unawaited State Persistence Can Corrupt Financial Records

Content
View full analysis

Vulnerability Details

File Location: src/dca-manager.js:190-205; src/dca-manager.js:231-235; src/dca-manager.js:390-419
Vulnerability Type: Race condition and unsafe state-file replacement
Risk Level: Medium

Vulnerable Code:

js
async save() {
  const state = {
    strategies: Object.fromEntries(
      Array.from(this.strategies.entries()).map(([id, s]) => [
        id,
        { ...s, nextExecution: s.nextExecution.toISOString() }
      ])
    ),
    history: this.history,
    alerts: Object.fromEntries(this.alerts)
  };

  const dir = path.dirname(this.storagePath);
  await fs.mkdir(dir, { recursive: true });
  await fs.writeFile(
    this.storagePath,
    JSON.stringify(state, null, 2)
  );
}
js
this.strategies.set(id, strategy);
this.save();

return strategy;
js
pauseStrategy(id) {
  const strategy = this.strategies.get(id);
  if (!strategy) {
    throw new Error(`Strategy not found: ${id}`);
  }

  strategy.status = 'paused';
  this.save();
  return strategy;
}

deleteStrategy(id) {
  const deleted = this.strategies.delete(id);
  if (!deleted) {
    throw new Error(`Strategy not found: ${id}`);
  }
  this.save();
  return { success: true, id };
}

Technical Analysis

Several state-mutating methods call the asynchronous save() function without awaiting it. Callers can therefore receive a successful response before persistence completes or fails.

Multiple unawaited calls may overlap and replace the same JSON file concurrently. The implementation writes directly to the final state path without file locking, write serialization, a temporary file, atomic rename, or durability synchronization.

Process termination during a write can leave a truncated file. Concurrent writes can also persist stale snapshots in an order different from the logical mutation order. The included test-data/test_state.json conta ...[truncated 1258 chars]

Remediation
View remediation

Remediation Suggestions

  • Make every state-mutating method asynchronous and await save() before reporting success.
  • Serialize writes through a single promise queue or mutex.
  • Write state to a temporary file in the same directory, flush it as appropriate, and atomically rename it over the destination.
  • Restrict state-file permissions because transaction history and account metadata may be sensitive.
  • Add schema validation when loading state.
  • Preserve a known-good backup and implement explicit recovery for malformed JSON.
  • Avoid silently continuing with empty state after parse or I/O failures.
  • Add concurrency, interrupted-write, malformed-state, and restart-recovery tests.
  • Consider a transactional embedded database if concurrent operations are expected.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
Findings (31)

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

The core purpose mostly aligns with the description: the code implements DCA strategy creation, scheduling-related execution, history/performance via cost basis, and pause/delete controls that correspond to cancellation/support. However, there are material undeclared capabilities. Most notably, the skill can execute live purchases and accepts sensitive signing credentials (account_id and private_key), which is a significant operational capability absent from the declared permissions. The code also supports alert configuration, which is not described. Additionally, it exposes scheduled execution behavior despite the declaration listing no triggers. Therefore the description does not fully and accurately represent the actual behavior.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
91% confidence
Finding

The code largely matches the declared DCA purpose: it creates and schedules NEAR purchase strategies, executes scheduled purchases, tracks history and cost basis, and supports pause/resume/delete behavior consistent with cancellation support. However, the description omits several material capabilities present in the code: it can execute swaps using blockchain credentials, persist operational data to disk, and send alerts/notifications. Since declared permissions are empty, these resource-accessing behaviors are undeclared and represent a meaningful description/behavior mismatch even though the overall domain purpose is aligned.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
88% confidence
Finding

The code is broadly related to a NEAR DCA skill, so the general domain matches the declared purpose. It tests features consistent with flexible scheduling, performance tracking, and cancellation/deletion support. However, the specific supplied chunk is not the implementation of the skill itself but a test suite. It also exercises alert configuration to Discord and Telegram, which is an undeclared capability. Additionally, pause/resume management is present and may be considered beyond the explicitly stated cancellation support. Because the primary behavior of this chunk is automated testing plus an undeclared alerting feature, there is a moderate mismatch between the description and the actual code shown.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
93% confidence
Finding

This action performs a purchase operation immediately when called and returns success/failure, but there is no explicit confirmation, preview, or user-facing warning in this code path before an irreversible financial transaction is attempted. In the context of a DCA trading skill, accidental invocation, parameter manipulation, or prompt-driven misuse could directly trigger unauthorized asset purchases and financial loss.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The action accepts a raw private key as an input parameter and passes it directly into purchase execution, which creates a high risk of credential exposure through logs, tracing, debugging, memory inspection, or downstream components. In a wallet/asset-management skill, handling private keys this way is especially dangerous because compromise of the key can lead to complete loss of funds, not just a single transaction.

Content

No source excerpt is available for this finding.

Known Vulnerable Dependency: brace-expansion==1.1.12 — 4 advisory(ies): CVE-2026-13149 (brace-expansion: DoS via exponential-time expansion of consecutive non-expanding); CVE-2026-33750 (brace-expansion: Zero-step sequence causes process hang and memory exhaustion); CVE-2026-14257 (brace-expansion: DoS via unbounded expansion length causing an out-of-memory pro) +1 more

High
Category
Supply Chain
Confidence
80% confidence
Finding

Dependency has known vulnerabilities (CVEs). Using packages with unpatched security flaws exposes the environment to known exploits.

Content

No source excerpt is available for this finding.

Known Vulnerable Dependency: flatted==3.3.3 — 2 advisory(ies): CVE-2026-32141 (flatted vulnerable to unbounded recursion DoS in parse() revive phase); CVE-2026-33228 (Prototype Pollution via parse() in NodeJS flatted)

High
Category
Supply Chain
Confidence
80% confidence
Finding

Dependency has known vulnerabilities (CVEs). Using packages with unpatched security flaws exposes the environment to known exploits.

Content

No source excerpt is available for this finding.

Known Vulnerable Dependency: js-yaml==4.1.1 — 4 advisory(ies): CVE-2026-84375 (js-yaml: maxTotalMergeKeys does not limit CPU use for empty merge sources); CVE-2026-59869 (js-yaml: YAML merge-key chains can force quadratic CPU consumption); GHSA-5p4m-2wfm-xmqj (JS-YAML: Quadratic CPU consumption in !!omap resolution (3.x and 4.x) — CVE-2026) +1 more

High
Category
Supply Chain
Confidence
80% confidence
Finding

Dependency has known vulnerabilities (CVEs). Using packages with unpatched security flaws exposes the environment to known exploits.

Content

No source excerpt is available for this finding.

Known Vulnerable Dependency: minimatch==3.1.2 — 3 advisory(ies): CVE-2026-27904 (minimatch ReDoS: nested *() extglobs generate catastrophically backtracking regu); CVE-2026-26996 (minimatch has a ReDoS via repeated wildcards with non-matching literal in patter); CVE-2026-27903 (minimatch has ReDoS: matchOne() combinatorial backtracking via multiple non-adja)

High
Category
Supply Chain
Confidence
80% confidence
Finding

Dependency has known vulnerabilities (CVEs). Using packages with unpatched security flaws exposes the environment to known exploits.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The scheduled trigger runs every 5 minutes to execute purchases automatically, but the skill does not surface an explicit warning that it performs autonomous trading on mainnet. In a DeFi trading context, unattended execution can cause real financial loss from misconfiguration, compromised strategy state, price volatility, repeated purchases, or unauthorized activation.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The skill claims to perform NEAR DCA purchases, but the core execution path only simulates swaps and returns fabricated execution data. In a financial automation context this is dangerous because it creates false trade history, inaccurate portfolio state, and misplaced trust that scheduled investments are actually being executed.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The swap implementations fabricate transaction hashes and success results instead of submitting real on-chain transactions. Because the surrounding skill records these as successful purchases, users may believe funds were invested when no trade occurred, undermining financial integrity and potentially triggering downstream actions based on false execution history.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The README documents both scheduled and manual purchase execution but does not prominently warn that these actions can trigger real on-chain trades and movement of funds on mainnet. In a financial automation skill, unclear disclosure increases the risk of unintended transactions, especially for users testing or enabling the scheduler without fully understanding the consequences.

Content

No source excerpt is available for this finding.

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
81% confidence
Finding

The documented scheduled trigger performs autonomous purchase execution, which is a meaningful security and safety concern in a trading skill because it can initiate transactions without per-action user review. While automation is the intended feature, the absence of strong user-consent and safety framing makes accidental or misconfigured fund movement more likely.

Content

Scanner excerpt · README.md (reported line 187)May include surrounding context.

Automatic Execution

The skill includes a scheduled trigger that automatically executes due purchases:

yaml
triggers:

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
70% confidence
Finding

Without declared permissions the skill's intent is opaque and cannot be validated.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill describes creating recurring DCA plans but does not prominently warn that this may cause repeated financial transactions over time. In a financial automation context, omission of this warning is dangerous because users may trigger automated purchases without fully understanding the ongoing monetary commitment and transaction risk.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
84% confidence
Finding

The skill explicitly supports creating and listing DCA plans and later discloses storage in a local plans file, which means user-defined financial strategies persist across sessions. Session persistence is security-relevant here because retained account-linked trading instructions can be reused, inspected, or modified on disk, especially on multi-user or compromised hosts.

Content

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

md
## Features

- Create DCA plans
- Cancel DCA plans
- List all DCA plans
- Track DCA performance

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

The scheduled execution trigger automatically runs purchase operations with no visible disclosure in this action layer that it can initiate live trades. While automation is expected in a DCA skill, hidden or insufficiently disclosed autonomous execution increases the risk of users enabling recurring financial actions without understanding that real purchases will occur on a schedule.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill markets itself as providing NEAR dollar-cost averaging, but it only stores local metadata and never performs blockchain purchases or any NEAR interaction. This is dangerous because users may believe automated investing is occurring and make financial decisions based on false assumptions, leading to missed trades, unmanaged exposure, or operational misuse.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The code accepts and stores a schedule string but never parses, validates, or enforces it, despite advertising flexible scheduling. In this skill context, that mismatch is risky because users may rely on nonexistent automation for recurring purchases, creating financial and operational harm.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill exposes a destructive delete-strategy action with no indication of confirmation, soft-delete, or undo safeguards. In a financial automation context, accidental or unauthorized deletion can remove trading configurations and disrupt investment plans, potentially causing missed executions or loss of historical state needed for tracking and audits.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The code presents price retrieval as multi-source market data for accuracy, but all three sources are hardcoded mock values. In a trading automation skill, this can mislead users into believing purchases are priced from live markets, causing materially incorrect decisions, false performance reporting, and unsafe automation based on fabricated data.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The executePurchase flow performs a financial asset swap and will fall back to this.config.account_id and this.config.private_key when explicit arguments are not provided. Although the file contains internal comments, there is no user-facing confirmation, warning, or disclosure message near this safety-critical operation despite it potentially spending funds automatically.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

This code accesses a sensitive credential, this.config.private_key, to authorize swaps, but the file provides no visible user disclosure about reading and using wallet credentials. For code-file warning checks, comments about implementation are not sufficient notice for credential use in a fund-moving workflow.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

The alerting section encourages sending execution notifications to Discord, Telegram, and email but does not warn that transaction metadata, balances, strategy names, or failure details may be disclosed to third-party services. This can leak sensitive financial activity and operational information beyond the local environment.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.