Back to skill

Security audit

StockEarning

Security checks for vulnerabilities and agentic risk

Overview

This stock portfolio skill is coherent, but it should be reviewed because it can change financial account records and has unsafe shell handling around credentials and transaction payloads.

Install only if you trust StockEarning with your API key, portfolio data, and trade-record changes. Use a least-privilege API key if available, review every trade or position-adjustment confirmation carefully, keep the API-key file private, and prefer a version that parses credentials safely and serializes JSON with a proper encoder.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (3)

T09 · Insecure Skill Coding Practices

Warning
Location
reference/runtime.sh:14
Finding

Credential files are executed as shell code

Content
View full analysis
Remediation
View remediation
`, rejecting all other lines and shell syntax. 3. Validate the value against the expected API-key character set and length. 4. Require the file to be owned by the effective user. 5. Reject symbolic links and files with group or other permissions instead of merely warning. 6. Prefer a platform credential store or pass the secret directly through the process environment. A safer parser can read a single literal line without evaluating it: ```bash se_try_load_env_file() { local file="$1" local line key value [ -f "$file" ] || return 1 [ ! -L "$file" ] || { echo "Error: refusing to load an API key from a symbolic link." >&2 return 1 } [ "$(se_get_file_perm "$file")" = "600" ] || [ "$(se_get_file_perm "$file")" = "400" ] || { echo "Error: API-key file permissions must be 600 or 400." >&2 return 1 } IFS= read -r line < "$file" || return 1 key="${line%%=*}" value="${line#*=}" [ "$key" = "STOCK_API_KEY" ] || return 1 [[ "$value" =~ ^[A-Za-z0-9._-]+$ ]] || return 1 STOCK_API_KEY="$value" export STOCK_API_KEY } ``` If compatibility with the existing `export STOCK_API_KEY="..."` format is required, parse that exact format without invoking a shell. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
reference/runtime.sh:107
Finding

Predictable temporary-file fallback permits symlink-based file overwrite

Content
View full analysis
/dev/null || echo "/tmp/stockearning_body.$$")" local http_code="" local curl_exit=0 if [ "$method" = "GET" ]; then http_code="$(curl -sS -o "$tmp_body" -w "%{http_code}" -H "X-API-Key: $STOCK_API_KEY" "$url")" curl_exit=$? elif [ "$method" = "POST" ] || [ "$method" = "PUT" ]; then if [ -n "$json_data" ]; then http_code="$(curl -sS -o "$tmp_body" -w "%{http_code}" -X "$method" -H "Content-Type: application/json" -H "X-API-Key: $STOCK_API_KEY" -d "$json_data" "$url")" curl_exit=$? else http_code="$(curl -sS -o "$tmp_body" -w "%{http_code}" -X "$method" -H "X-API-Key: $STOCK_API_KEY" "$url")" curl_exit=$? fi else echo "Error: Unsupported HTTP method $method" >&2 rm -f "$tmp_body" >/dev/null 2>&1 || true return 1 fi local body body="$(cat "$tmp_body" 2>/dev/null || true)" rm -f "$tmp_body" >/dev/null 2>&1 || true ``` ### Technical Analysis `mktemp` ordinarily creates a unique file safely. However, when it fails, the implementation falls back to `/tmp/stockearning_body.$$`, where `$$` is the predictable process ID. The fallback path is returned without atomically and exclusively creating a new file. `curl -o` subsequently opens the path for writing and can follow a pre-existing symbolic link. A local attacker who predicts or observes the process ID can create that path as a symbolic link to another file. If the Skill process can write to the target, the API response can truncate or overwrite that target. Exploitation requires both a failure of `mktemp` and local access sufficient to prepare the predictable path. Consequently, this is primarily a local file-integrity weakness rather than a remotely exploitable issue. ### Attack Path 1. A local attacker identifie ...[truncated 999 chars]
Remediation
View remediation
&2 return 1 } trap 'rm -f -- "$tmp_body"' RETURN ``` Alternatively, capture the response without a temporary file if response-size constraints make that safe and practical. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
trade-execution/scripts/create_trade.sh:40
Finding

Manual JSON interpolation permits malformed or attacker-altered transaction payloads

Content
View full analysis
Remediation
View remediation
&2 exit 1 } [[ "$QUANTITY" =~ ^([0-9]+)(\.[0-9]+)?$ ]] || { echo "Error: QUANTITY must be a positive number" >&2 exit 1 } [[ "$PRICE" =~ ^([0-9]+)(\.[0-9]+)?$ ]] || { echo "Error: PRICE must be a positive number" >&2 exit 1 } JSON_DATA="$( jq -n \ --arg symbol "$SYMBOL" \ --arg name "$NAME" \ --arg market "$MARKET" \ --arg currency "$CURRENCY" \ --arg trade_type "$TRADE_TYPE" \ --argjson quantity "$QUANTITY" \ --argjson price "$PRICE" \ --argjson commission "$COMMISSION" \ --arg notes "$NOTES" \ --arg trade_date "$TRADE_DATE" \ '{ symbol: $symbol, name: $name, market: $market, currency: $currency, trade_type: $trade_type, quantity: $quantity, price: $price, commission: $commission, notes: $notes ...[truncated 59 chars]
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Rogue AgentSelf-Modification, Session Persistence
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (50)

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

Initializing or modifying broker defaults via POST is another state-changing financial action that deserves prominent disclosure and explicit permissioning. When combined with a user-provided API key and generic top-level wording, this creates risk of unauthorized configuration changes or accidental account mutation.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

Initializing or modifying broker defaults via POST is another state-changing financial action that deserves prominent disclosure and explicit permissioning. When combined with a user-provided API key and generic top-level wording, this creates risk of unauthorized configuration changes or accidental account mutation.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

Initializing or modifying broker defaults via POST is another state-changing financial action that deserves prominent disclosure and explicit permissioning. When combined with a user-provided API key and generic top-level wording, this creates risk of unauthorized configuration changes or accidental account mutation.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

Initializing or modifying broker defaults via POST is another state-changing financial action that deserves prominent disclosure and explicit permissioning. When combined with a user-provided API key and generic top-level wording, this creates risk of unauthorized configuration changes or accidental account mutation.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

Initializing or modifying broker defaults via POST is another state-changing financial action that deserves prominent disclosure and explicit permissioning. When combined with a user-provided API key and generic top-level wording, this creates risk of unauthorized configuration changes or accidental account mutation.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

Initializing or modifying broker defaults via POST is another state-changing financial action that deserves prominent disclosure and explicit permissioning. When combined with a user-provided API key and generic top-level wording, this creates risk of unauthorized configuration changes or accidental account mutation.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

Initializing or modifying broker defaults via POST is another state-changing financial action that deserves prominent disclosure and explicit permissioning. When combined with a user-provided API key and generic top-level wording, this creates risk of unauthorized configuration changes or accidental account mutation.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
93% confidence
Finding

Initializing or modifying broker defaults via POST is another state-changing financial action that deserves prominent disclosure and explicit permissioning. When combined with a user-provided API key and generic top-level wording, this creates risk of unauthorized configuration changes or accidental account mutation.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

Initializing or modifying broker defaults via POST is another state-changing financial action that deserves prominent disclosure and explicit permissioning. When combined with a user-provided API key and generic top-level wording, this creates risk of unauthorized configuration changes or accidental account mutation.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

Initializing or modifying broker defaults via POST is another state-changing financial action that deserves prominent disclosure and explicit permissioning. When combined with a user-provided API key and generic top-level wording, this creates risk of unauthorized configuration changes or accidental account mutation.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

Initializing or modifying broker defaults via POST is another state-changing financial action that deserves prominent disclosure and explicit permissioning. When combined with a user-provided API key and generic top-level wording, this creates risk of unauthorized configuration changes or accidental account mutation.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
93% confidence
Finding

Initializing or modifying broker defaults via POST is another state-changing financial action that deserves prominent disclosure and explicit permissioning. When combined with a user-provided API key and generic top-level wording, this creates risk of unauthorized configuration changes or accidental account mutation.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
88% confidence
Finding

Initializing or modifying broker defaults via POST is another state-changing financial action that deserves prominent disclosure and explicit permissioning. When combined with a user-provided API key and generic top-level wording, this creates risk of unauthorized configuration changes or accidental account mutation.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

Initializing or modifying broker defaults via POST is another state-changing financial action that deserves prominent disclosure and explicit permissioning. When combined with a user-provided API key and generic top-level wording, this creates risk of unauthorized configuration changes or accidental account mutation.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

Initializing or modifying broker defaults via POST is another state-changing financial action that deserves prominent disclosure and explicit permissioning. When combined with a user-provided API key and generic top-level wording, this creates risk of unauthorized configuration changes or accidental account mutation.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

Initializing or modifying broker defaults via POST is another state-changing financial action that deserves prominent disclosure and explicit permissioning. When combined with a user-provided API key and generic top-level wording, this creates risk of unauthorized configuration changes or accidental account mutation.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

Initializing or modifying broker defaults via POST is another state-changing financial action that deserves prominent disclosure and explicit permissioning. When combined with a user-provided API key and generic top-level wording, this creates risk of unauthorized configuration changes or accidental account mutation.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

Initializing or modifying broker defaults via POST is another state-changing financial action that deserves prominent disclosure and explicit permissioning. When combined with a user-provided API key and generic top-level wording, this creates risk of unauthorized configuration changes or accidental account mutation.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
94% confidence
Finding

The skill advertises network-backed stock queries and trade-management capabilities, but the manifest does not declare any explicit tool scope such as allowed tools or permissions. That makes the trust boundary unclear and can cause the agent runtime to grant broader shell/network access than users expect, especially since the skill can perform both read and write operations against an external API.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The skill description and all user-facing instructions are written in Chinese, including the primary description and usage guidance, but there is no indication that users may choose another language or that the skill is intentionally limited to Chinese-speaking users for compliance or regional reasons. This creates a natural-language locale policy concern because it effectively imposes a language requirement without explicit opt-in or justification.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · install.sh (reported line 15)May include surrounding context.

sh
if [ ! -d "$TARGET_DIR" ]; then
    echo "Creating directory $TARGET_DIR..."
    mkdir -p "$TARGET_DIR"
fi

# 2. 复制技能文件夹 (遵循 AgentSkills 规范,每个技能一个文件夹)

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · install.sh (reported line 15)May include surrounding context.

sh
if [ ! -d "$TARGET_DIR" ]; then
    echo "Creating directory $TARGET_DIR..."
    mkdir -p "$TARGET_DIR"
fi

# 2. 复制技能文件夹 (遵循 AgentSkills 规范,每个技能一个文件夹)

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The file's natural-language instructions are in Chinese and describe the skill as a dedicated assistant in that language, with no indication that users may choose another language. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale restriction is documented and justified.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill explicitly depends on an API key and an external base URL, which means user stock queries and related metadata will be transmitted to a third-party service. Because the skill does not disclose this network transfer or obtain user awareness/consent, it creates a real privacy and data-handling risk, even if the queried data seems low sensitivity.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The instructions tell the agent to construct and execute curl commands, causing outbound network access, but they provide no warning to the user that external requests will occur. This is dangerous because it can silently exfiltrate user-provided queries and operational metadata to the remote API, reducing transparency and user control.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.