T09 · Insecure Skill Coding Practices
- Location
scripts/statistical_arbitrage.py:2- Finding
Deliberately Obfuscated Implementation Reduces Auditability
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill is a real statistical-arbitrage tool, but its documented user controls do not match the executable behavior, which can produce misleading financial analysis.
Review before installing. Use only in an isolated virtual environment, do not rely on its results for investment decisions, and require fixes for argument parsing, removal of hard-coded securities/dates, readable source, accurate reporting claims, and pinned dependencies before treating it as a trustworthy analysis tool.
scripts/statistical_arbitrage.py:2Deliberately Obfuscated Implementation Reduces Auditability
scripts/install_deps.sh:28Unpinned Third-Party Dependencies Are Installed from Mutable Upstream Sources
scripts/statistical_arbitrage.py:21Documented User Parameters Are Silently Ignored in Favor of Hard-Coded Securities and Dates
The code is clearly related to statistical arbitrage and pair-trading backtesting, so the overall domain matches. However, several key declared capabilities are overstated or inaccurate. The description says it calculates dynamic hedge ratios, but the code fits a single OLS regression on the training data and reuses that constant beta throughout both train and test backtests. The description also says it generates a complete report, yet the implementation only prints textual summaries to stdout and does not create any structured report artifact. Finally, the claimed multi-market support is not really implemented as dedicated support logic; the script merely passes ticker strings into yfinance and is configured with a single hard-coded pair. These are material description-versus-behavior discrepancies, though not unrelated or malicious extra capabilities.
Suspicious Unicode normalization or mixed-script content
All user-facing instructions, examples, and warnings are presented in Traditional Chinese, and the document does not state that the skill supports other languages or that Chinese is an intentional region-specific constraint. This can constitute a language policy issue because it effectively forces a specific language without user opt-in.
Using npx clawhub@latest install statistical-arbitrage pulls and executes the latest published package version at install time, which creates a supply-chain risk if the package is compromised or updated maliciously. In a skill installation context, this can lead users to run unreviewed code with their local user permissions.
The README shows the skill being invoked by generic conversational phrases like '幫我分析 AAPL 和 GOOGL 的統計套利策略' rather than documenting a specific trigger syntax or activation scope. Because the file does not clarify what exact phrases activate the skill or provide negative examples, the trigger condition is ambiguous and could overlap with ordinary requests for analysis.
Examples such as '分析工行和建行的配對交易' and '分析2022年到現在的騰訊和阿里的配對交易' are natural conversational requests, but the README does not specify whether these are merely sample prompts or the exact activation mechanism. Without explicit trigger constraints, the skill description leaves invocation behavior overly broad.
The skill directs the agent to perform runtime package installation with pip, which expands its capabilities beyond analysis into software modification and network retrieval. This creates supply-chain and environment-integrity risk: unpinned dependencies can change over time, malicious packages or compromised mirrors could be installed, and the runtime environment may be altered in ways the user did not intend.
The package description is written entirely in Traditional Chinese, which creates a natural-language locale constraint in user-facing metadata. There is no indication of multilingual support, user opt-in, or a documented reason that this skill must be Chinese-only.
The script’s user-facing comments and output strings are entirely in Chinese, including the example invocation phrase shown to users. For a general-purpose install script, this imposes a language/locale constraint without opt-in or justification, which matches the policy-violation category for language or locale restrictions.
The manifest description and usage guidance combine Chinese text with English phrasing, effectively steering interactions toward specific languages without explicitly stating that users may choose their preferred language. The policy requires avoiding language constraints unless the skill offers an opt-in or clearly justified locale limitation.
The documentation states '所有數據處理在本地進行' and '不收集或上傳用戶數據', yet elsewhere the skill explicitly relies on yfinance and mentions public API data downloads. While market-data retrieval is expected for this skill, the security note overstates locality by implying a fully local operation despite network access being part of execution.
The dependency is specified with a minimum version only, which allows future unresolved versions to be installed. This weakens build reproducibility and can unintentionally introduce vulnerable or breaking upstream releases into the skill's execution environment.
yfinance>=0.2.28
pandas>=2.0.0
numpy>=1.24.0
statsmodels>=0.14.0
Using pandas>=2.0.0 permits installation of any newer pandas release, making the deployed package set non-deterministic. In a security context this increases supply-chain risk because a vulnerable or compromised upstream release could be pulled without changes to the manifest.
yfinance>=0.2.28
pandas>=2.0.0
numpy>=1.24.0
statsmodels>=0.14.0
matplotlib>=3.7.0
Dependency has known vulnerabilities (CVEs). Using packages with unpatched security flaws exposes the environment to known exploits.
The unpinned numpy requirement allows dependency resolution to select arbitrary newer releases over time. That creates avoidable supply-chain and stability risk, especially for numerical packages that may receive frequent binary and security-related updates.
yfinance>=0.2.28
pandas>=2.0.0
numpy>=1.24.0
statsmodels>=0.14.0
matplotlib>=3.7.0
Dependency has known vulnerabilities (CVEs). Using packages with unpatched security flaws exposes the environment to known exploits.
Specifying statsmodels with only a lower bound means future installs are not reproducible and may pick up vulnerable or incompatible releases. This is a genuine dependency hygiene issue even though it is not an immediate exploit by itself.
yfinance>=0.2.28
pandas>=2.0.0
numpy>=1.24.0
statsmodels>=0.14.0
matplotlib>=3.7.0
matplotlib is not pinned to a specific release, so the environment can drift over time and ingest unreviewed upstream versions. This increases supply-chain uncertainty and can complicate incident response or reproducibility.
pandas>=2.0.0
numpy>=1.24.0
statsmodels>=0.14.0
matplotlib>=3.7.0
Lines L015-L016 hard-code plotting font preferences to specific Chinese-capable fonts, which imposes a locale/language presentation choice at runtime. Under the policy, forcing a specific language or locale without user choice should be flagged unless it is clearly justified as region-specific, which is not documented here.
No suspicious patterns detected.