T09 · Insecure Skill Coding Practices
- Location
research_workflow.py:66- Finding
Path Traversal Enables Arbitrary Python File Modification or Relocation
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This skill is an autonomous trading-strategy workflow that can repeatedly create, run, rewrite, and promote code with too little user control.
Only install this in a disposable or tightly sandboxed auto-trading workspace. Treat backtest reports as trusted inputs only if their producer is controlled, and add validation, backups, review gates, resource limits, and a manual approval step before running generated strategies or moving files into the formal strategy directory.
research_workflow.py:66Path Traversal Enables Arbitrary Python File Modification or Relocation
research_workflow.py:132Untrusted Report Content Is Persisted into Agent Memory
SKILL.md:137Unbounded Autonomous Workflow Executes Generated Code Without Approval
The declared purpose says the skill performs a full research workflow and must use a specific search assistant, but the described behavior also includes autonomous source modification, file movement, and workflow triggering that are materially different and more sensitive than the summary suggests. This mismatch can mislead a user into approving a skill that changes trading code and operational state beyond the advertised scope.
The skill instructs autonomous directory creation, file creation, and background execution of backtesting and workflow scripts without requiring user confirmation or presenting safety warnings. In a trading-code context, this can alter the repository and launch persistent processes unexpectedly, creating operational and integrity risks.
The sub-agent template directs repeated autonomous execution in a loop, including searching, implementing, running backtests, and continuing without confirmation. This creates an uncontrolled automation pattern that can repeatedly modify code, consume resources, and propagate errors without human review.
The manifest requires use of market-intel-assistant, but the sub-agent template tells spawned agents to use web_search instead. This contradiction weakens policy control and can cause downstream agents to bypass intended tool restrictions or use less-governed data sources during an automated workflow.
The script automatically rewrites strategy source files based only on backtest metrics, with no confirmation, backup, integrity checks, or review gate. In this skill context, code under TEST_DIR is trading logic, so blind text replacement can silently corrupt strategy behavior or operational safeguards and can be triggered by untrusted report content selecting a target strategy name.
The skill directs reading and writing project files, but the manifest does not declare any explicit tool scope or permissions boundaries. That makes the effective capabilities opaque to users and enforcement layers, increasing the risk of unintended file access or modification when the skill is invoked.
The skill mandates a specific tool choice ('must use market-intel-assistant') without user opt-in. While not inherently malicious, forced tooling can override user preferences or organizational policy and becomes more concerning here because the skill already drives autonomous workflow steps around code and trading research.
The manifest describes a complete autonomous strategy research workflow with required use of market-intel-assistant for searching, plus search→implement→backtest→evaluate→decide→record→loop. The code and module docstring show this file only listens for completed backtest reports, evaluates them, makes a simple decision, moves/modifies files, records results, and logs a report; there is no search step, no use of market-intel-assistant, and no implementation/backtest execution logic.
The module docstring, usage guidance, and user-facing runtime messages are written in Chinese, which imposes a specific language on users. There is no indication that the skill is region-specific or that users can select their preferred language, so this is a natural-language locale policy concern.
Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.
python3 research_workflow.py
# 后台运行
nohup python3 research_workflow.py > logs/research_workflow.log &
"""
import os
Automatically promoting a test strategy into the formal strategy directory without approval or validation weakens change-control and can move flawed or unsafe trading code into a production-like location. In an automated trading environment, this increases the risk of accidental deployment of unreviewed logic with financial consequences.
The top-level docstring presents the script as a main program for 'Research Strategy', which suggests end-to-end strategy research behavior consistent with the skill purpose. In practice, the functions only consume existing JSON reports and then evaluate, decide, mutate strategy files, move files, and record outcomes; the documented framing overstates what the code actually does.
The record_to_memory function persistently appends entries to MEMORY.md, which modifies user project data. While this behavior is part of the workflow, the file-writing side effect is not clearly disclosed in a user-facing warning beyond a brief feature list.