T09 · Insecure Skill Coding Practices
- Location
scripts/invoke_vnstock.py:58- Finding
Unrestricted Dynamic Invocation Enables Arbitrary Local Command Execution
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill is mostly a Vietnam stock-analysis workflow, but one helper exposes overly broad local Python invocation and the credential handling can leak API keys into logs or output files.
Review before installing. Use this only in an isolated environment, avoid passing API keys with --api-key, do not feed untrusted arguments to invoke_vnstock.py, and pin/review vnstock dependencies before following the install docs.
scripts/invoke_vnstock.py:58Unrestricted Dynamic Invocation Enables Arbitrary Local Command Execution
scripts/run_pipeline.py:9API Keys May Be Exposed Through Process Arguments, Logs, and Invocation Artifacts
references/vnstock/11-best-practices.md:43Documentation Recommends Unsafe Pickle Deserialization from Predictable Cache Files
references/vnstock/02-installation.md:11Installation Guidance Uses Unpinned Packages and a Mutable Git Repository Head
If the implemented behavior is only ranking/scoring from preexisting CSVs while the description promises vnstock API usage and free-tier safety enforcement, the mismatch is still a true vulnerability because it conceals the real operational boundaries. Misleading descriptions reduce the effectiveness of human and automated review and can mask stale-data workflows or unvalidated downstream assumptions.
If the implemented behavior is only ranking/scoring from preexisting CSVs while the description promises vnstock API usage and free-tier safety enforcement, the mismatch is still a true vulnerability because it conceals the real operational boundaries. Misleading descriptions reduce the effectiveness of human and automated review and can mask stale-data workflows or unvalidated downstream assumptions.
If the implemented behavior is only ranking/scoring from preexisting CSVs while the description promises vnstock API usage and free-tier safety enforcement, the mismatch is still a true vulnerability because it conceals the real operational boundaries. Misleading descriptions reduce the effectiveness of human and automated review and can mask stale-data workflows or unvalidated downstream assumptions.
If the implemented behavior is only ranking/scoring from preexisting CSVs while the description promises vnstock API usage and free-tier safety enforcement, the mismatch is still a true vulnerability because it conceals the real operational boundaries. Misleading descriptions reduce the effectiveness of human and automated review and can mask stale-data workflows or unvalidated downstream assumptions.
If the implemented behavior is only ranking/scoring from preexisting CSVs while the description promises vnstock API usage and free-tier safety enforcement, the mismatch is still a true vulnerability because it conceals the real operational boundaries. Misleading descriptions reduce the effectiveness of human and automated review and can mask stale-data workflows or unvalidated downstream assumptions.
Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.
**Trạng thái:** Chưa triển khai đầy đủ
- **Layer 5 (Analytics)**: Chỉ số kỹ thuật, mô hình định giá, vv (chưa đầy đủ) - có thư viện vnstock_ta cung cấp tính toán bộ chỉ báo kỹ thuật.
- **Layer 6 (Macro)**: Chỉ số kinh tế, hàng hóa - chỉ có trong thư viện vnstock_data yêu cầu tham gia gói tài trợ Vnstock.
- **Layer 7 (Insights)**: Screener, rankings top stocks, vv - (Chưa đầy đủ) - chỉ có trong thư viện vnstock_data yêu cầu tham gia gói tài trợ Vnstock.
The documentation recommends installing directly from a GitHub repository using 'pip install git+https://...', which executes setup/build logic from a remote source outside a pinned, reviewed package release. In an agent skill context, remote bootstrap instructions are more dangerous because users may follow them automatically, increasing supply-chain risk if the repository, dependency chain, or branch state is compromised.
pip install vnstock
pip install git+https://github.com/vnstock-lab/vnstock.git
# Clone hoặc copy thư mục private_packages
pip install git+https://github.com/vnstock-lab/vnstock.git
VNStock phụ thuộc vào các package sau:
pandas>=1.3.0 # Xử lý DataFrame
requests>=2.25.0 # HTTP requests
beautifulsoup4>=4.9.0 # Web scraping
lxml>=4.6.0 # XML parsing
pydantic>=1.8.0 # Data validation
tenacity>=8.0.0 # Retry logic
python-dateutil>=2.8.0 # Date utilities
aiohttp>=3.7.0
The snippet shows external API keys stored in a .env file, which is a legitimate pattern, but the documentation does not sufficiently warn that these values are credentials requiring protection. In a skill used by agents and users, this can lead to secret leakage through accidental commits, logs, prompt sharing, or unsafe local storage.
Nếu sử dụng external APIs như FMP, XNO, DNSE:
# .env file
FMP_API_KEY=your_fmp_api_key_here
XNO_API_KEY=your_xno_api_key_here
DNSE_API_KEY=your_dnse_api_key_here
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
FMP_API_KEY = os.getenv('FMP_API_KEY')
if not FMP_API_KEY: print("❌ Please set FMP_API_KEY in .env") else: print("✅ FMP_API_KEY configured")
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
FMP_API_KEY = os.getenv('FMP_API_KEY')
if not FMP_API_KEY: print("❌ Please set FMP_API_KEY in .env") else: print("✅ FMP_API_KEY configured")
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
FMP_API_KEY = os.getenv('FMP_API_KEY')
if not FMP_API_KEY: print("❌ Please set FMP_API_KEY in .env") else: print("✅ FMP_API_KEY configured")
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
FMP_API_KEY = os.getenv('FMP_API_KEY')
if not FMP_API_KEY:
print("❌ Please set FMP_API_KEY in .env")
else:
print("✅ FMP_API_KEY configured")
```
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
if env_key:
return env_key.strip()
# Skill-local fallback: <skill_root>/.env
# scripts/common.py -> skill root is parents[1]
env_path = Path(__file__).resolve().parents[1] / ".env"
values = _read_env_file(env_path)
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
if env_key:
return env_key.strip()
# Skill-local fallback: <skill_root>/.env
# scripts/common.py -> skill root is parents[1]
env_path = Path(__file__).resolve().parents[1] / ".env"
values = _read_env_file(env_path)
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
if env_key:
return env_key.strip()
# Skill-local fallback: <skill_root>/.env
# scripts/common.py -> skill root is parents[1]
env_path = Path(__file__).resolve().parents[1] / ".env"
values = _read_env_file(env_path)
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
if env_key:
return env_key.strip()
# Skill-local fallback: <skill_root>/.env
# scripts/common.py -> skill root is parents[1]
env_path = Path(__file__).resolve().parents[1] / ".env"
values = _read_env_file(env_path)
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
if env_key:
return env_key.strip()
# Skill-local fallback: <skill_root>/.env
# scripts/common.py -> skill root is parents[1]
env_path = Path(__file__).resolve().parents[1] / ".env"
values = _read_env_file(env_path)
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
if env_key:
return env_key.strip()
# Skill-local fallback: <skill_root>/.env
# scripts/common.py -> skill root is parents[1]
env_path = Path(__file__).resolve().parents[1] / ".env"
values = _read_env_file(env_path)
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
if env_key:
return env_key.strip()
# Skill-local fallback: <skill_root>/.env
# scripts/common.py -> skill root is parents[1]
env_path = Path(__file__).resolve().parents[1] / ".env"
values = _read_env_file(env_path)
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
if env_key:
return env_key.strip()
# Skill-local fallback: <skill_root>/.env
# scripts/common.py -> skill root is parents[1]
env_path = Path(__file__).resolve().parents[1] / ".env"
values = _read_env_file(env_path)
The implementation contradicts the skill description by exposing arbitrary module/class/method invocation and serializing whatever result is returned. That mismatch is dangerous because operators may trust the skill as a narrowly scoped, free-tier-safe stock workflow while it actually behaves as a general-purpose reflection wrapper with file output.
Allowing an arbitrary module path to be imported is unjustified for a Vietnam stock analysis skill and greatly broadens the attack surface. It enables the script to load non-VNStock modules and combine them with reflective class/method access, effectively escaping the intended domain constraints.
The skill advertises executable scripts, shell commands, filesystem outputs, optional environment-variable loading from .env, and internet-backed API usage, but it declares no explicit tool scope or permissions boundaries. In an agent environment, that mismatch can allow broader-than-expected shell, file, and secret access, increasing the risk of unsafe execution paths or unintended exposure of local data and API keys.
The API key example shows direct key configuration without any warning about secure secret handling, storage, rotation, or redaction. In practice, users may hardcode credentials in code, logs, notebooks, or skill configs, increasing the risk of credential leakage and unauthorized third-party API usage.
The document describes web scraping and third-party API access, but does not clearly warn that using the skill will initiate outbound network requests to external services. In an agent skill context, this can cause users or downstream systems to unknowingly transmit metadata, prompts, symbols, or credentials to third parties, creating privacy, compliance, and trust risks.