Back to skill

Security audit

DEX Agent

Security checks for vulnerabilities and agentic risk

Overview

This skill is a real on-chain trading wallet tool, but it handles private keys and automated trades in ways users should review carefully before installing.

Only install this after treating it as a high-risk mainnet trading tool. Do not fund its generated wallet with meaningful assets unless you accept plaintext local key storage, unlimited token approvals, no pre-broadcast confirmations, and incomplete documented risk controls. Prefer a test wallet with tiny amounts, review and pin dependencies, and consider modifying the code to use encrypted key storage, exact approvals, explicit confirmations, and enforced slippage/risk limits.

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

T09 · Insecure Skill Coding Practices

Error
Location
scripts/wallet.py:18
Finding

Trading Wallet Private Key Is Stored in Plaintext

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/wallet.py:18
Finding

Wallet Generation Silently Overwrites an Existing Private Key

Content
View full analysis
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Error
Location
scripts/swap.py:145
Finding

Swaps Grant a Permanent Unlimited Token Allowance

Content
View full analysis
= amount: return True print(f" 📝 Approving router to spend tokens...") max_approval = 2**256 - 1 # Max approval tx = token.functions.approve(router_addr, max_approval).build_transaction({ "from": self.address, "chainId": CHAIN_ID, "gas": 100_000, "nonce": self.w3.eth.get_transaction_count(self.address), "maxFeePerGas": self.w3.eth.gas_price * 2, "maxPriorityFeePerGas": self.w3.to_wei(0.001, "gwei"), }) signed = self.w3.eth.account.sign_transaction(tx, self.private_key) tx_hash = self.w3.eth.send_raw_transaction(signed.raw_transaction) receipt = self.w3.eth.wait_for_transaction_receipt(tx_hash, timeout=60) if receipt.status == 1: print(f" ✅ Approved! Tx: {tx_hash.hex()}") return True else: print(f" ❌ Approval failed!") return False ``` ### Technical Analysis A swap requiring approval grants the configured router the maximum possible ERC-20 allowance rather than limiting authorization to the current trade amount. The allowance persists after the transaction and applies to tokens subsequently deposited into the wallet. The configured address appears intended to be Uniswap SwapRouter02, but permanent unlimited authorization still violates least privilege and expands the impact of contract compromise, incorrect configuration, chain mismatch, ...[truncated 787 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/swap.py:179
Finding

Advertised Risk Controls and Maximum Slippage Are Not Enforced

Content
View full analysis
5 else 100 fee = int(sys.argv[6]) if len(sys.argv) > 6 else 3000 if token_in.upper() == "ETH": result = swapper.swap_eth_for_token(token_out, amount, slippage, fee) else: result = swapper.swap(token_in, token_out, amount, slippage, fee) ``` ```python # Apply slippage min_out = int(quote * (10000 - slippage_bps) / 10000) min_out_human = min_out / (10 ** out_info["decimals"]) print(f" Min out (with slippage): {min_out_human:.6f} {out_info['symbol']}") ``` ### Technical Analysis `MAX_SLIPPAGE_BPS` is declared but never checked during transaction execution. User-controlled basis points are passed directly into the minimum-output calculation. A value close to 10,000 p ...[truncated 1457 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/price_monitor.py:151
Finding

Triggered Protective Orders Are Disabled Before Successful Execution

Content
View full analysis
= order["trigger_price"]: print(f"🎉 TAKE-PROFIT TRIGGERED: {token} at ${current_price:.6f} (trigger: ${order['trigger_price']:.6f})") order["status"] = "triggered" order["triggered_price"] = current_price order["triggered_at"] = time.time() triggered.append(order) else: pct_from_trigger = ((current_price - order["trigger_price"]) / order["trigger_price"]) * 100 direction = "above" if pct_from_trigger > 0 else "below" print(f" {order['type'].upper()} {token}: ${current_price:.6f} ({abs(pct_from_trigger):.1f}% {direction} trigger)") self.save_orders() return triggered ``` ```python elif cmd == "monitor": from price_monitor import PriceMonitor monitor = PriceMonitor() triggered = monitor.check_orders() if triggered: # Auto-execute triggered orders from swap import DexSwapper swapper = DexSwapper() for order in triggered: print(f"\n⚡ Executing {order['type']}: selling {order['amount']} {order['token']}") result = swapper.swap(order['token'], "USDC", order['amount']) if result and result["status"] == "success": print(f" ✅ Sold! Tx: {result['tx_hash']}") ``` ### Technical Analysis An active order is changed to `triggered` and persisted before its swap is attempted. Future monitoring skips all orders whose status is ...[truncated 1155 chars]
Remediation
View remediation

T08 · Insecure Dependencies

Warning
Location
SKILL.md:20
Finding

Installation Instructions Use Unpinned Third-Party Dependencies

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
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (15)

Missing User Warnings

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The documented commands include live swap execution, but the safety language does not clearly and prominently warn that these commands can create irreversible on-chain transactions using the user’s wallet and funds. In a self-custodial DeFi context, insufficient disclosure materially increases the risk of accidental asset loss, mistaken trades, and user misunderstanding about the finality of execution.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

When triggered orders are found, the code immediately executes swaps without a just-in-time confirmation, review step, or dry-run mode. In a DeFi wallet context, this can directly spend user assets due to bad configuration, manipulated price signals, or logic errors, making the risk substantially higher than a normal CLI convenience issue.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The module claims private keys are stored encrypted locally, but the implementation writes the raw private key directly into a JSON file. This is dangerous because users may rely on the false security claim and fund the wallet, while any local compromise, backup leak, log collection, or accidental file exposure would immediately expose the private key and allow theft of funds.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The skill’s trigger conditions are broad enough to activate on generic crypto-related requests, including cases where a user may only want information rather than transaction execution. In the context of a trading skill that can access a wallet and perform on-chain actions, overbroad routing increases the chance of unintended invocation and risky escalation from informational queries to trading workflows.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The README gives direct commands for generating wallets, funding them, and executing live on-chain swaps, stop-losses, and take-profit orders, but it does not warn users that these actions are irreversible, involve real funds, and may incur slippage, smart-contract, or market risks. In a trading skill, omission of clear risk and safety disclosures can cause users to treat examples as safe defaults and unintentionally lose funds.

Content

No source excerpt is available for this finding.

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
95% confidence
Finding

The code performs autonomous decision making by taking triggered monitoring results and converting them into live market sales. In the context of an agent skill for DeFi trading, autonomous action is especially dangerous because external price inputs, order logic mistakes, or malicious configuration can cause real asset loss without human review.

Content

Scanner excerpt · scripts/agent.py (reported line 125)May include surrounding context.

python
monitor = PriceMonitor()
        triggered = monitor.check_orders()
        if triggered:
            # Auto-execute triggered orders
            from swap import DexSwapper
            swapper = DexSwapper()
            for order in triggered:

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

Wallet generation is initiated directly from the CLI without any visible warning about private key creation, storage location, backup requirements, or the consequences of insecure handling. In a crypto-trading tool, poor key handling can lead to irreversible loss of funds, so the missing warning is security-relevant rather than merely a usability issue.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The CLI help text documents trading-oriented commands but omits the scan behavior, while the implementation advertises 'auto-trade via DEX Agent'. In a financial tool that can move funds, understating or hiding automation materially increases the chance a user triggers behavior they did not fully understand or consent to.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The module advertises itself as a 'DIY stop-loss and take-profit system', but it never executes any trade when a trigger condition is met; it only prints alerts, updates local JSON state, and tells the user to 'Execute swaps manually or via swap.py'. In a trading context, this mismatch is dangerous because users may rely on it for automated loss protection and suffer avoidable financial losses during rapid market moves.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The docstring advertises 'Our fee: 0.3%' but the code contains no fee-transfer, fee accounting, or recipient logic beyond the Uniswap pool fee parameter. This is misleading financial behavior: users may believe the tool is charging or handling fees in a way it does not, which can conceal economic misrepresentation or cause unsafe assumptions during review and operation.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The approval flow grants the router an unlimited ERC-20 allowance (2**256 - 1) whenever current allowance is insufficient, without a specific per-swap cap or explicit user confirmation. If the configured router address is wrong, upgraded maliciously, or later exploited, all approved token balances can be drained, making this substantially riskier than approving only the needed amount.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The code signs and broadcasts an irreversible swap transaction immediately after building it, with no final user confirmation step displaying the resolved token addresses, amount, minimum output, spender/router, and gas cost. In an agent skill context, that increases the chance of accidental or manipulated transactions being sent on-chain without the operator noticing parameter substitution or unsafe slippage settings.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The ETH swap path signs and submits a transaction carrying native value immediately, again without explicit confirmation. Because ETH transfers are direct and irreversible and this path sends value=amount_raw, any mistaken token mapping, router misconfiguration, or malicious invocation can cause immediate loss of funds with less recoverability than an approval-only mistake.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The code persists the wallet's private key to disk in plaintext, and file permission hardening alone does not provide cryptographic protection. In the context of a trading wallet skill that explicitly instructs users to fund the wallet with ETH and USDC, disclosure of this file would let an attacker fully control the wallet and drain assets.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The skill advertises direct on-chain trading, self-custodial wallet management, and automated order features, but the description does not clearly warn users that actions can execute real blockchain trades, consume gas, and cause irreversible financial loss. In a DeFi trading context, this omission materially increases the risk that users or downstream agents invoke the skill without understanding that it can move funds on-chain.

Content

No source excerpt is available for this finding.