T09 · Insecure Skill Coding Practices
- Location
scripts/_gateway.py:18- Finding
API Credentials and User Data Can Be Sent to an Arbitrary Gateway
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
Stocki fits its financial-analysis purpose, but its repair and install flows can replace or delete the installed skill from mutable remote sources without clear confirmation, and its API key is sent to whichever gateway URL is configured.
Review before installing. Use only the official Stocki gateway unless you intentionally trust another endpoint, avoid running doctor unless you are comfortable with it changing the installed skill, and do not use the rm -rf manual install path without backing up local changes. Treat Stocki responses as remote service output, and only include portfolio details after explicit user consent.
scripts/_gateway.py:18API Credentials and User Data Can Be Sent to an Arbitrary Gateway
scripts/stocki.py:181Doctor Command Performs Destructive and Unpinned Remote Code Replacement
INSTALL.md:5Installation Instructions Encourage Destructive Updates from Mutable Sources
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
req = Request(url, data=data, headers=headers, method=method)
try:
with urlopen(req, timeout=timeout) as resp:
raw = resp.read().decode()
return json.loads(raw) if raw else {}
except HTTPError as e:
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
req = Request(url, data=data, headers=headers, method=method)
try:
with urlopen(req, timeout=timeout) as resp:
raw = resp.read().decode()
return json.loads(raw) if raw else {}
except HTTPError as e:
The install instructions include rm -rf ~/.openclaw/workspace/skills/stocki, a forceful recursive deletion command that removes the existing local skill directory without validation or confirmation. In an installation guide for an AI agent skill, users are likely to copy-paste commands directly, which increases the chance of accidental deletion, path confusion, or loss of local modifications and data stored in that directory.
rm -rf ~/.openclaw/workspace/skills/stocki
git -c http.postBuffer=524288000 -c http.lowSpeedLimit=0 -c http.lowSpeedTime=300 clone https://github.com/stocki-ai/open-stocki.git ~/.openclaw/workspace/skills/stocki
The install instructions include rm -rf ~/.openclaw/workspace/skills/stocki, a forceful recursive deletion command that removes the existing local skill directory without validation or confirmation. In an installation guide for an AI agent skill, users are likely to copy-paste commands directly, which increases the chance of accidental deletion, path confusion, or loss of local modifications and data stored in that directory.
rm -rf ~/.openclaw/workspace/skills/stocki
git -c http.postBuffer=524288000 -c http.lowSpeedLimit=0 -c http.lowSpeedTime=300 clone https://github.com/stocki-ai/open-stocki.git ~/.openclaw/workspace/skills/stocki
The instruction to present instant-mode output directly with no processing or commentary encourages blind relay of untrusted remote content from the Stocki service into the agent's final response. If the upstream service returns prompt-injection text, unsafe links, data-exfiltration requests, or misleading instructions, the agent is being told not to filter or contextualize it, which weakens downstream safety controls.
---
## Output Rules
- **Instant mode:** Present output directly. No attribution, no processing.
- **Quant mode:** Prefix with "以下分析来自Stocki:". Preserve content, clean up formatting for mobile.
Automatically deleting the installed skill directory without confirmation is a clear unsafe operation. If triggered unexpectedly or if path validation fails, it can erase local files and replace them with remote content, causing both availability loss and integrity compromise.
The doctor command performs setup repair actions, network connectivity checks, file integrity decisions, directory creation, and may trigger destructive reinstall logic. In the context of a financial-analysis CLI, this is excessive local system modification and creates opportunities for unintended state changes, supply-chain compromise, and user surprise.
The manual installation path instructs users to delete an existing skill directory with rm -rf before cloning, but provides no warning, confirmation step, backup guidance, or validation of the target path. While the path is scoped to the skill directory rather than arbitrary filesystem locations, destructive shell commands in install documentation can still cause unintended data loss if copied blindly, expanded unexpectedly, or modified in the wrong environment.
The skill invokes Python scripts, uses environment variables for secrets, writes to a local workspace, and communicates with a remote gateway, but it does not declare any explicit tool scope or permission boundaries. That mismatch can cause the host agent to grant broader capabilities than reviewers expect, increasing the risk of unintended shell, file, network, and secret access.
The skill hardcodes Asia/Shanghai in diagnostic/API requests and also uses it as the default timezone in CLI arguments. This imposes a specific locale setting without explicit user choice or justification in the code shown, which can violate language/locale policy expectations.
The skill contains self-update and local repair behavior unrelated to its stated financial-analysis purpose. This makes the skill more dangerous in context because users expect market-data functionality, not code lifecycle management that can modify or replace local files.
This subprocess call invokes an external package-management style command from within the skill's doctor flow. Even though arguments are passed safely as a list and there is no shell injection here, it still performs privileged local state changes by reinstalling code from an external source, which expands the skill's trust boundary and can execute attacker-controlled code if the upstream distribution is compromised.
"""Try to reinstall skill via clawhub, then GitHub."""
print(" Reinstalling skill...")
try:
r = subprocess.run(["clawhub", "install", "stocki", "--force"],
capture_output=True, text=True, timeout=30)
if r.returncode == 0:
print(" -> Reinstalled via clawhub")
This command recursively deletes the skill directory with no user confirmation before reinstalling. The code attempts a weak path sanity check, but it is insufficient defense against unexpected path resolution, symlink issues, or logic errors, making destructive data loss possible during a routine doctor run.
print(" -> Reinstall aborted: unexpected skill directory path")
return False
try:
subprocess.run(["rm", "-rf", SKILL_DIR], check=True)
r = subprocess.run(
["git", "-c", "http.postBuffer=524288000", "-c", "http.lowSpeedLimit=0",
"-c", "http.lowSpeedTime=300", "clone",
This subprocess clones and reinstalls code directly from GitHub during a repair operation. That creates a software supply-chain risk because the local environment will trust and run newly fetched code without signature verification, version pinning, or user review.
return False
try:
subprocess.run(["rm", "-rf", SKILL_DIR], check=True)
r = subprocess.run(
["git", "-c", "http.postBuffer=524288000", "-c", "http.lowSpeedLimit=0",
"-c", "http.lowSpeedTime=300", "clone",
"https://github.com/stocki-ai/open-stocki.git", SKILL_DIR],
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
if not api_key:
print("[1/6] API Key.............. FAIL")
print(" No API key set. Register at:")
print(" https://api.stocki.com.cn/wechat")
print(' Then: export STOCKI_API_KEY="sk_your_key_here"')
failed += 1
elif not api_key.startswith("sk_"):
Detected: suspicious.destructive_delete_command