T09 · Insecure Skill Coding Practices
- Location
scripts/wallet.py:18- Finding
Trading Wallet Private Key Is Stored in Plaintext
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
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.
scripts/wallet.py:18Trading Wallet Private Key Is Stored in Plaintext
scripts/wallet.py:18Wallet Generation Silently Overwrites an Existing Private Key
scripts/swap.py:145Swaps Grant a Permanent Unlimited Token Allowance
scripts/swap.py:179Advertised Risk Controls and Maximum Slippage Are Not Enforced
scripts/price_monitor.py:151Triggered Protective Orders Are Disabled Before Successful Execution
SKILL.md:20Installation Instructions Use Unpinned Third-Party Dependencies
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.
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.
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.
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.
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.
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.
monitor = PriceMonitor()
triggered = monitor.check_orders()
if triggered:
# Auto-execute triggered orders
from swap import DexSwapper
swapper = DexSwapper()
for order in triggered:
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.
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.
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.
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.
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.
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.
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.
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.
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.