T09 · Insecure Skill Coding Practices
- Location
scripts/mx_self_select.py:144- Finding
Financial account data is written with ambient filesystem permissions
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill appears purpose-aligned, but it can change an authenticated financial watchlist from free-form input and handles account data with limited safeguards.
Review before installing. Use it only if you trust the Eastmoney API key workflow, keep MX_APIKEY out of shared project files, use a private output directory, and be careful with natural-language commands because non-query text may modify your watchlist without a separate confirmation step.
scripts/mx_self_select.py:144Financial account data is written with ambient filesystem permissions
scripts/requirements.txt:1Third-party dependency is not reproducibly pinned
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
}
try:
response = requests.post(QUERY_URL, headers=headers, json={}, timeout=30)
response.raise_for_status()
return response.json()
except Exception as e:
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
}
try:
response = requests.post(MANAGE_URL, headers=headers, json=data, timeout=30)
response.raise_for_status()
return response.json()
except Exception as e:
Falling back to a repo-adjacent .env file for API credentials increases the chance that long-lived secrets are stored insecurely on disk, accidentally committed, or exposed to other local users/processes. In this skill, those credentials authorize account-backed watchlist actions, so compromise could let an attacker query or modify the user's self-selected stocks.
apikey = os.environ.get("MX_APIKEY", "")
if not apikey:
# 尝试从.env文件读取
env_file = os.path.join(os.path.dirname(os.path.dirname(__file__)), ".env")
if os.path.exists(env_file):
try:
with open(env_file, "r") as f:
The skill documents access to environment variables, filesystem output, and external network endpoints, but it does not declare any explicit tool scope or permissions. This creates an authorization gap where the runtime may grant broader capabilities than reviewers or users expect, increasing the chance of unintended data access, credential use, or exfiltration through network/file operations.
The manifest describes a stock watchlist management skill that supports querying, adding, and deleting favorites. While calling backend APIs is expected, proactively reading secrets from environment variables and traversing to a local .env file introduces credential-access behavior beyond the user-facing purpose described in the manifest.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
}
try:
response = requests.post(QUERY_URL, headers=headers, json={}, timeout=30)
response.raise_for_status()
return response.json()
except Exception as e:
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
}
try:
response = requests.post(MANAGE_URL, headers=headers, json=data, timeout=30)
response.raise_for_status()
return response.json()
except Exception as e:
Natural-language input is routed directly into state-changing add/delete operations without a confirmation step, dry-run preview, or stricter intent validation. In an agent setting, ambiguous or adversarial prompts could cause unintended modification of a user's watchlist, which is especially risky because the action affects an authenticated account.
The natural-language content of the skill file is entirely Chinese, and the document does not indicate that users can choose another language or that the skill is restricted to a Chinese-speaking or region-specific audience. Under the policy rule, forcing a specific language without opt-in can be a locale-policy issue.
The skill inconsistently refers to the API key as both MX_APIKEY and EASTMONEY_APIKEY. This mismatch can cause operators to place secrets in the wrong variable or break expected secret-handling controls, leading to failed authentication, accidental disclosure during debugging, or insecure ad hoc workarounds.
The module docstring presents the skill's user-facing description entirely in Chinese, which may impose a language choice without offering localization or opt-in. Under the stated policy, forcing a specific language can be a natural-language policy violation unless the locale constraint is documented and justified.
The dependency is specified as requests>=2.31.0, which allows any future version to be installed and prevents reproducible builds. This creates supply-chain risk because a later vulnerable or breaking release could be pulled in without review, and in a skill that may handle account and market data, dependency behavior matters for confidentiality and integrity.
requests>=2.31.0
The manifest references requests without pinning an exact version, while known advisories exist for some releases of that package. Because the installed version is not fixed, it is impossible to verify from this file alone whether deployment will use a patched or vulnerable release, leaving a supply-chain exposure window.