T09 · Insecure Skill Coding Practices
- Location
scripts/utils/predictor/evaluation.py:25- Finding
Unsafe PyTorch Checkpoint Deserialization Enables Arbitrary Code Execution
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This finance forecasting skill is purpose-aligned, but it needs review because it caches market/news data locally and has unsafe model-checkpoint loading that could run code if an untrusted model file is used.
Review this before installing. Use it only in an environment where model directories are controlled, do not place untrusted .pt checkpoint files under exports/models, and prefer fixing the loaders to require weights_only=True or a non-executable format. Expect local caching of stock, search, news, and signal data, plus outbound calls to market data, search, model, and configured LLM providers.
scripts/utils/predictor/evaluation.py:25Unsafe PyTorch Checkpoint Deserialization Enables Arbitrary Code Execution
scripts/utils/predictor/training.py:121Untrusted Search and News Content Is Directly Embedded into LLM Instructions
If the actual behavior is stock data collection/caching and database operations rather than forecasting, that is a meaningful capability mismatch. Undeclared data collection and persistence can have privacy, compliance, and integrity implications, especially in financial contexts where cached data may be stale, licensed, or sensitive.
If the actual behavior is stock data collection/caching and database operations rather than forecasting, that is a meaningful capability mismatch. Undeclared data collection and persistence can have privacy, compliance, and integrity implications, especially in financial contexts where cached data may be stale, licensed, or sensitive.
If the actual behavior is stock data collection/caching and database operations rather than forecasting, that is a meaningful capability mismatch. Undeclared data collection and persistence can have privacy, compliance, and integrity implications, especially in financial contexts where cached data may be stale, licensed, or sensitive.
If the actual behavior is stock data collection/caching and database operations rather than forecasting, that is a meaningful capability mismatch. Undeclared data collection and persistence can have privacy, compliance, and integrity implications, especially in financial contexts where cached data may be stale, licensed, or sensitive.
If the actual behavior is stock data collection/caching and database operations rather than forecasting, that is a meaningful capability mismatch. Undeclared data collection and persistence can have privacy, compliance, and integrity implications, especially in financial contexts where cached data may be stale, licensed, or sensitive.
If the actual behavior is stock data collection/caching and database operations rather than forecasting, that is a meaningful capability mismatch. Undeclared data collection and persistence can have privacy, compliance, and integrity implications, especially in financial contexts where cached data may be stale, licensed, or sensitive.
If the actual behavior is stock data collection/caching and database operations rather than forecasting, that is a meaningful capability mismatch. Undeclared data collection and persistence can have privacy, compliance, and integrity implications, especially in financial contexts where cached data may be stale, licensed, or sensitive.
If the actual behavior is stock data collection/caching and database operations rather than forecasting, that is a meaningful capability mismatch. Undeclared data collection and persistence can have privacy, compliance, and integrity implications, especially in financial contexts where cached data may be stale, licensed, or sensitive.
If the actual behavior is stock data collection/caching and database operations rather than forecasting, that is a meaningful capability mismatch. Undeclared data collection and persistence can have privacy, compliance, and integrity implications, especially in financial contexts where cached data may be stale, licensed, or sensitive.
If the actual behavior is stock data collection/caching and database operations rather than forecasting, that is a meaningful capability mismatch. Undeclared data collection and persistence can have privacy, compliance, and integrity implications, especially in financial contexts where cached data may be stale, licensed, or sensitive.
If the actual behavior is stock data collection/caching and database operations rather than forecasting, that is a meaningful capability mismatch. Undeclared data collection and persistence can have privacy, compliance, and integrity implications, especially in financial contexts where cached data may be stale, licensed, or sensitive.
If the actual behavior is stock data collection/caching and database operations rather than forecasting, that is a meaningful capability mismatch. Undeclared data collection and persistence can have privacy, compliance, and integrity implications, especially in financial contexts where cached data may be stale, licensed, or sensitive.
If the actual behavior is stock data collection/caching and database operations rather than forecasting, that is a meaningful capability mismatch. Undeclared data collection and persistence can have privacy, compliance, and integrity implications, especially in financial contexts where cached data may be stale, licensed, or sensitive.
If the actual behavior is stock data collection/caching and database operations rather than forecasting, that is a meaningful capability mismatch. Undeclared data collection and persistence can have privacy, compliance, and integrity implications, especially in financial contexts where cached data may be stale, licensed, or sensitive.
If the actual behavior is stock data collection/caching and database operations rather than forecasting, that is a meaningful capability mismatch. Undeclared data collection and persistence can have privacy, compliance, and integrity implications, especially in financial contexts where cached data may be stale, licensed, or sensitive.
If the actual behavior is stock data collection/caching and database operations rather than forecasting, that is a meaningful capability mismatch. Undeclared data collection and persistence can have privacy, compliance, and integrity implications, especially in financial contexts where cached data may be stale, licensed, or sensitive.
If the actual behavior is stock data collection/caching and database operations rather than forecasting, that is a meaningful capability mismatch. Undeclared data collection and persistence can have privacy, compliance, and integrity implications, especially in financial contexts where cached data may be stale, licensed, or sensitive.
If the actual behavior is stock data collection/caching and database operations rather than forecasting, that is a meaningful capability mismatch. Undeclared data collection and persistence can have privacy, compliance, and integrity implications, especially in financial contexts where cached data may be stale, licensed, or sensitive.
The execute_query method accepts arbitrary SQL and runs it directly against the application's SQLite database, allowing any caller to perform reads, writes, schema changes, or destructive operations. In an agent skill context, this materially increases risk because any upstream prompt-influenced or user-controlled input reaching this method could become a full database manipulation primitive.
The skill advertises capabilities that imply environment access, file reads, and possible network/model downloads, but it does not declare any explicit tool scope or permissions. This creates an authorization and transparency gap: a host agent may invoke the skill without clear least-privilege boundaries, increasing the chance of overbroad access or unsafe execution assumptions.
The trigger text is broad: 'use when user needs finance market time-series forecasting or news-aware finance market adjustments.' Without stricter invocation boundaries, an agent may over-apply the skill to loosely related finance queries, causing unnecessary external access, model loading, or speculative outputs in inappropriate contexts. Broad triggers are especially risky in finance because outputs may influence decisions despite uncertain applicability.
The natural-language guidance in the class docstring is written entirely in Chinese and references following instructions in a related prompt file, which suggests a Chinese-language interaction pattern without offering any user language choice. Per policy, forcing a specific language or locale without opt-in is a natural-language policy concern.
The natural-language documentation is written entirely in Chinese and presents the utility's behavior in that locale without any indication that language selection is configurable or intentionally region-scoped. Under the policy, forcing a specific language without user opt-in is a locale policy issue.
The code claims reduced supply-chain risk but still auto-selects the newest kronos_news_*.pt file from a writable local directory and may deserialize it unsafely. This creates a practical model-poisoning and code-execution path: an attacker can drop a newer malicious checkpoint that will be preferred automatically at startup.
The fallback torch.load(latest_model, map_location=device) performs legacy PyTorch deserialization, which can execute attacker-controlled pickle payloads when loading a malicious .pt file. In this skill, the file is chosen automatically as the newest matching checkpoint from a local directory, so anyone who can place or replace files there may gain code execution during model initialization.
except (TypeError, RuntimeError, AttributeError):
# Fallback for older torch versions or complex objects if necessary
logger.warning(f"⚠️ Safe loading failed. Falling back to legacy load for {latest_model}")
checkpoint = torch.load(latest_model, map_location=device)
# The checkpoint contains 'news_proj_state_dict'
if 'news_proj_state_dict' in checkpoint:
if not hasattr(model, 'news_proj') or model.news_proj is None: