T09 · Insecure Skill Coding Practices
- Location
scripts/code_validator.py:119- Finding
Strategy Validation Executes Untrusted Python Code
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This skill is a crypto trading code generator, but it needs review because it can lead users to run live trading code with real credentials and includes unsafe execution and unreliable API behavior.
Review this skill carefully before use. Do not run generated strategies with real exchange keys until the code and API wrapper are manually audited. Use testnet or paper trading first, use restricted no-withdrawal API keys with small limits, and treat every generated or downloaded strategy file as untrusted executable Python. Avoid running the validator or backtester on untrusted strategy files outside a sandbox, and be careful with the documented cleanup command because it permanently deletes local logs, sessions, and simulation results.
scripts/code_validator.py:119Strategy Validation Executes Untrusted Python Code
scripts/backtest_runner.py:23Backtest Interfaces Execute Strategy Files Without Isolation
api_wrappers/hyperliquid_api.py:82Live API Errors Silently Fall Back to Fabricated Market Data
The rm -rf logs/* simulation_results/* sessions/* command is a destructive shell instruction that can be abused or misused, especially if executed from an unexpected directory or modified by users. In a skill that encourages command copying from documentation, destructive commands deserve heightened scrutiny because users may run them without understanding the data-loss implications.
# 清理日志和临时文件
rm -rf logs/* simulation_results/* sessions/*
This finding describes the most dangerous mismatch: a skill framed as code generation may actually execute a live trading strategy, place/cancel orders, monitor markets continuously, read API credentials from environment variables, and write logs/status files. In the context of cryptocurrency trading, unexpected live order execution can directly cause financial loss, credential misuse, or unauthorized market activity, making the mismatch especially severe.
This finding describes the most dangerous mismatch: a skill framed as code generation may actually execute a live trading strategy, place/cancel orders, monitor markets continuously, read API credentials from environment variables, and write logs/status files. In the context of cryptocurrency trading, unexpected live order execution can directly cause financial loss, credential misuse, or unauthorized market activity, making the mismatch especially severe.
This finding describes the most dangerous mismatch: a skill framed as code generation may actually execute a live trading strategy, place/cancel orders, monitor markets continuously, read API credentials from environment variables, and write logs/status files. In the context of cryptocurrency trading, unexpected live order execution can directly cause financial loss, credential misuse, or unauthorized market activity, making the mismatch especially severe.
This finding describes the most dangerous mismatch: a skill framed as code generation may actually execute a live trading strategy, place/cancel orders, monitor markets continuously, read API credentials from environment variables, and write logs/status files. In the context of cryptocurrency trading, unexpected live order execution can directly cause financial loss, credential misuse, or unauthorized market activity, making the mismatch especially severe.
This finding describes the most dangerous mismatch: a skill framed as code generation may actually execute a live trading strategy, place/cancel orders, monitor markets continuously, read API credentials from environment variables, and write logs/status files. In the context of cryptocurrency trading, unexpected live order execution can directly cause financial loss, credential misuse, or unauthorized market activity, making the mismatch especially severe.
This finding describes the most dangerous mismatch: a skill framed as code generation may actually execute a live trading strategy, place/cancel orders, monitor markets continuously, read API credentials from environment variables, and write logs/status files. In the context of cryptocurrency trading, unexpected live order execution can directly cause financial loss, credential misuse, or unauthorized market activity, making the mismatch especially severe.
This finding describes the most dangerous mismatch: a skill framed as code generation may actually execute a live trading strategy, place/cancel orders, monitor markets continuously, read API credentials from environment variables, and write logs/status files. In the context of cryptocurrency trading, unexpected live order execution can directly cause financial loss, credential misuse, or unauthorized market activity, making the mismatch especially severe.
This finding describes the most dangerous mismatch: a skill framed as code generation may actually execute a live trading strategy, place/cancel orders, monitor markets continuously, read API credentials from environment variables, and write logs/status files. In the context of cryptocurrency trading, unexpected live order execution can directly cause financial loss, credential misuse, or unauthorized market activity, making the mismatch especially severe.
This finding describes the most dangerous mismatch: a skill framed as code generation may actually execute a live trading strategy, place/cancel orders, monitor markets continuously, read API credentials from environment variables, and write logs/status files. In the context of cryptocurrency trading, unexpected live order execution can directly cause financial loss, credential misuse, or unauthorized market activity, making the mismatch especially severe.
This finding describes the most dangerous mismatch: a skill framed as code generation may actually execute a live trading strategy, place/cancel orders, monitor markets continuously, read API credentials from environment variables, and write logs/status files. In the context of cryptocurrency trading, unexpected live order execution can directly cause financial loss, credential misuse, or unauthorized market activity, making the mismatch especially severe.
This finding describes the most dangerous mismatch: a skill framed as code generation may actually execute a live trading strategy, place/cancel orders, monitor markets continuously, read API credentials from environment variables, and write logs/status files. In the context of cryptocurrency trading, unexpected live order execution can directly cause financial loss, credential misuse, or unauthorized market activity, making the mismatch especially severe.
This finding describes the most dangerous mismatch: a skill framed as code generation may actually execute a live trading strategy, place/cancel orders, monitor markets continuously, read API credentials from environment variables, and write logs/status files. In the context of cryptocurrency trading, unexpected live order execution can directly cause financial loss, credential misuse, or unauthorized market activity, making the mismatch especially severe.
This finding describes the most dangerous mismatch: a skill framed as code generation may actually execute a live trading strategy, place/cancel orders, monitor markets continuously, read API credentials from environment variables, and write logs/status files. In the context of cryptocurrency trading, unexpected live order execution can directly cause financial loss, credential misuse, or unauthorized market activity, making the mismatch especially severe.
The file-level documentation claims this is a Hyperliquid API wrapper, but the implemented authenticated trading behavior follows another exchange’s model. That discrepancy can mislead downstream agents or users into generating and running production trading code under false assumptions, which is especially risky in an automated trading skill where trust in API semantics directly affects fund safety.
This wrapper advertises Hyperliquid support but implements Binance-style authentication headers and request-signing conventions for account and trading operations. In a code-generation skill for live trading bots, this mismatch is dangerous because users may believe orders and account actions are correctly integrated when they are not, leading to failed trades, undefined behavior, or accidental execution against an unintended API pattern.
The engine loads and executes an arbitrary Python file via importlib.util.spec_from_file_location(...).exec_module(), which gives the supplied strategy full code execution with the privileges of the running process. In this skill context, that is especially dangerous because the manifest presents the skill as code generation for trading strategies, not as a general-purpose executor for untrusted Python, so users may not expect arbitrary local code execution.
The function dynamically loads a Python file using importlib and executes it with spec.loader.exec_module(strategy_module), which runs top-level code from the supplied file. If an attacker can influence strategy_file, they can achieve arbitrary code execution on the host, which is especially dangerous in a code-generation/trading skill where users may supply or generate strategy code.
The runner dynamically imports and executes any Python file supplied as a strategy, which means arbitrary code in that file runs with the permissions of the user invoking the backtester. In this skill's context, strategies are generated from natural-language prompts and may be treated as data, so users could be tricked into executing malicious payloads disguised as trading logic.
Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.
for key, value in params.items():
instructions += "- **{key}**: {value}\n"
return instructions
The import-check routine dynamically imports the user-supplied strategy module in a subprocess, which executes module-level Python code. Because generated strategy files are effectively untrusted input in this skill, a crafted file can trigger arbitrary code execution, network access, filesystem changes, or secret exfiltration during 'validation', defeating the expectation of passive analysis.
The temporary test script imports the target module solely to detect import errors, but importing Python modules executes top-level code. In a code-generation skill for trading strategies, the produced file may contain arbitrary logic, so this check can unintentionally execute attacker-controlled code with the validator's privileges and environment.
The README explicitly instructs users to execute generated trading bot code, but provides no warning that the code may place real orders, use live API credentials, or cause financial loss. In the context of an automated trading code generator, this omission is especially risky because users may treat generated strategies as safe to run directly on a live exchange.
The README provides a destructive cleanup command using rm -rf against multiple directories without warning users about irreversible deletion or advising them to verify the target paths. Even though the paths appear scoped to project subdirectories, copy-paste use and directory confusion could still lead to accidental loss of logs, session data, or simulation outputs.
The skill advertises and documents capabilities that involve environment-variable access, filesystem reads/writes, shell execution, and network/API interaction, but it does not declare any explicit tool scope or permission boundaries. In a trading-oriented skill that can touch credentials and potentially execute generated or auxiliary scripts, missing scope declarations increase the risk of unintended high-impact actions and make review, enforcement, and least-privilege controls much harder.
No suspicious patterns detected.