T09 · Insecure Skill Coding Practices
- Location
SKILL.md:87- Finding
Unvalidated Stock Symbol Can Enable Shell Command Injection
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This stock-analysis skill is purpose-aligned but should be reviewed carefully because it collects and stores a reusable billing key and documents unsafe shell-based API calls.
Install only if you are comfortable giving this skill an AgentPit consumerKey that can be used for billable API calls. Prefer a short-lived or low-balance key if available, confirm each paid call before it runs, and avoid analyzing untrusted or malformed ticker strings until the skill adds strict ticker validation and safer credential storage.
SKILL.md:87Unvalidated Stock Symbol Can Enable Shell Command Injection
SKILL.md:51Consumer Key Is Collected Through Conversation and Stored in Plaintext
L003 写明“当用户提到分析股票、买不买某股票、股票行情时触发”,其中“股票行情”这类表述非常常见且范围宽,缺少更明确的触发边界。文件也没有给出排除条件或负例,无法清楚区分一般聊天提及股票与真正希望调用该 skill 的场景。
The skill instructs the agent to solicit a reusable billing credential from the user and persist it locally, which expands the skill from stock analysis into credential handling and secret storage. This increases exposure of a sensitive token and creates a durable authentication foothold that could be abused by the skill itself, other skills, or anyone with access to the host account.
Persisting a reusable billing credential in ~/.openclaw/secrets/agentpit.cpk is not essential to producing stock analysis results and creates ongoing risk beyond the immediate task. If the token is later read by another process, leaked in backups, or reused silently, it can authorize billable external actions and account access without fresh user approval.
This duplicate finding points to the same session-persistence behavior: writing a reusable billing token to ~/.openclaw/secrets and exporting it for ongoing reuse. The stock-analysis context does not justify durable token residency, so the persistence meaningfully increases the chance of silent future use and credential theft.
mkdir -p ~/.openclaw/secrets
printf '%s' "$USER_CPK" > ~/.openclaw/secrets/agentpit.cpk
chmod 600 ~/.openclaw/secrets/agentpit.cpk
export AGENTPIT_CPK="$USER_CPK"
This duplicate finding points to the same session-persistence behavior: writing a reusable billing token to ~/.openclaw/secrets and exporting it for ongoing reuse. The stock-analysis context does not justify durable token residency, so the persistence meaningfully increases the chance of silent future use and credential theft.
mkdir -p ~/.openclaw/secrets
printf '%s' "$USER_CPK" > ~/.openclaw/secrets/agentpit.cpk
chmod 600 ~/.openclaw/secrets/agentpit.cpk
export AGENTPIT_CPK="$USER_CPK"
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
mkdir -p ~/.openclaw/secrets
printf '%s' "$USER_CPK" > ~/.openclaw/secrets/agentpit.cpk
chmod 600 ~/.openclaw/secrets/agentpit.cpk
export AGENTPIT_CPK="$USER_CPK"
This call transmits user-selected stock data together with a bearer credential to an external third-party API for paid processing. External transmission is expected for this skill's purpose, but it remains security-relevant because it sends a reusable authentication token off-host and initiates billable actions; users must clearly understand and consent to that behavior.
提交异步任务:
curl -s -X POST "https://api.agentpit.io/api/v1/skill-invoke/stock-analyze" \
-H "Authorization: Bearer $AGENTPIT_CPK" \
-H "Content-Type: application/json" \
-d '{"stock_code":"TICKER","async_mode":true}'
This call transmits user-selected stock data together with a bearer credential to an external third-party API for paid processing. External transmission is expected for this skill's purpose, but it remains security-relevant because it sends a reusable authentication token off-host and initiates billable actions; users must clearly understand and consent to that behavior.
提交异步任务:
curl -s -X POST "https://api.agentpit.io/api/v1/skill-invoke/stock-analyze" \
-H "Authorization: Bearer $AGENTPIT_CPK" \
-H "Content-Type: application/json" \
-d '{"stock_code":"TICKER","async_mode":true}'
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
得到 task_id 后每 10 秒轮询一次(注意 taskId 走 query 参数):
curl -s "https://api.agentpit.io/api/v1/skill-invoke/stock-status?taskId=TASK_ID" \
-H "Authorization: Bearer $AGENTPIT_CPK"
This endpoint sends ticker, analysis depth, language preference, and bearer credentials to a third-party service for potentially expensive processing. The skill context makes outbound analysis expected, but the combination of external transmission and reusable billing authorization still creates meaningful risk if invoked unexpectedly or without clear informed consent.
curl -s --max-time 600 -X POST "https://api.agentpit.io/api/v1/skill-invoke/trading-sync" \
-H "Authorization: Bearer $AGENTPIT_CPK" \
-H "Content-Type: application/json" \
-d '{"ticker":"TICKER","depth":"full","language":"zh"}'
L131 在调用 TradingAgents 时将 language 固定为 zh,而文档整体也默认以中文与用户交互,没有说明可根据用户偏好切换语言。根据规则,未经用户选择而强制特定语言/locale 属于自然语言策略违规。
This request sends stock symbols and a reusable authorization token to an external hedge-fund analysis service, again triggering billable third-party processing. While aligned with the feature's purpose, it is dangerous if the token is overprivileged or persistently stored because unauthorized reuse could lead to account abuse and financial cost.
curl -s --max-time 300 -X POST "https://api.agentpit.io/api/v1/skill-invoke/hedgefund-quick-run" \
-H "Authorization: Bearer $AGENTPIT_CPK" \
-H "Content-Type: application/json" \
-d '{"tickers":["TICKER"],"analyst":"aswath_damodaran"}'