Back to skill

Security audit

Stock Price Alert

Security checks for vulnerabilities and agentic risk

Overview

This stock alert skill has a coherent purpose, but it needs Review because its shell script can execute commands from malformed alert values and exposes SMTP credentials in process arguments.

Review before installing. Use only a trusted, locally controlled config file; do not let other tools generate or modify thresholds unsafely. Prefer a dedicated Alpha Vantage key and app-specific SMTP password, and understand that watched symbols and alerts may be sent to external services or local Sonos devices. The publisher should fix numeric validation and avoid passing SMTP credentials on the command line before this is treated as low risk.

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 (2)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/stock_alert.sh:119
Finding

Arbitrary Command Execution Through AWK Expression Injection

Content
View full analysis
= $alert_pct)}"; then local sign="" awk "BEGIN{if($change_pct>=0) exit 0; exit 1}" && sign="+" || sign="" alerts+=("涨幅${sign}${change_pct}%超阈值(${alert_pct}%)") fi fi # Price above if [[ "$price_above" != "null" && -n "$price_above" ]]; then if awk "BEGIN{exit !($price > $price_above)}"; then alerts+=("价格${price}上穿${price_above}") fi fi # Price below if [[ "$price_below" != "null" && -n "$price_below" ]]; then if awk "BEGIN{exit !($price < $price_below)}"; then alerts+=("价格${price}下穿${price_below}") fi fi if [[ ${#alerts[@]} -gt 0 ]]; then local alert_msg=$(IFS=','; echo "${alerts[*]}") local sign="" awk "BEGIN{if($change_pct>=0) exit 0; exit 1}" && sign="+" || sign="" echo "[$ts] $symbol \$$price ${sign}${change_pct}% ⚠️ $alert_msg" ``` ### Technical Analysis Configuration values and remote quote values are inserted directly into AWK source code inside double-quoted shell strings. They are therefore parsed as AWK expressions rather than treated strictly as data. AWK implementations provide executable functions such as `system()`. A malicious value can consequently introduce an additional expression that invokes an operating ...[truncated 2070 chars]
Remediation
View remediation
rhs + 0) }'; then alerts+=("price ${price} crossed above ${price_above}") fi ``` 3. Apply the same pattern to `alert_pct`, `price_below`, and every sign comparison involving `change_pct`. 4. Reject invalid configuration at startup instead of silently passing malformed values into alert logic. 5. Validate the API response schema with `jq`, including the type and allowed numeric format of every quote field, before using it. 6. Run the Skill under a dedicated, minimally privileged account with access only to its configuration and required credentials. This limits impact if another injection defect is introduced. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/stock_alert.sh:88
Finding

SMTP Password Exposed in Process Command-Line Arguments

Content
View full analysis
/dev/null; then echo " → 邮件已发送至 $to" else echo " → 邮件发送失败,降级为控制台输出" fi ``` ### Technical Analysis The SMTP username and password are supplied to `curl` through the `--user` command-line argument. This places the credential in the process argument vector. Depending on operating-system process visibility, isolation settings, monitoring software, audit logging, and diagnostic tooling, another local user or service may be able to observe the argument while `curl` is running. Process accounting or telemetry may also retain the command line after execution. The SMTP connection itself uses `--ssl-reqd`, which appropriately requires transport encryption. The identified issue concerns local secret handling rather than plaintext transmission over the network. Sending SMTP credentials to the explicitly configured SMTP server is necessary for the declared email feature, but exposing the password through process arguments is not necessary. ### Attack Path 1. Email notifications are enabled and the required SMTP environment variables are configured. 2. A stock-price condition triggers an alert. 3. The script launches `curl` with `${smtp_user}:${smtp_pass}` in the `--user` argument. 4. A local process observer, monitoring agent, or process-accounting facility captures the command-line arguments while or after `curl` runs. 5. The observer extracts and reuses the SMTP credential. This attack requires local process-observation capability or access to retained process telemetry; ...[truncated 565 chars]
Remediation
View remediation
"$credential_file" curl --config "$credential_file" \ --silent \ --ssl-reqd \ --url "smtp://${smtp_host}:${smtp_port}" \ --mail-from "$smtp_user" \ --mail-rcpt "$to" \ --upload-file "$message_file" rm -f "$credential_file" ``` If this approach is used, create the file in a private directory, install a cleanup trap, prevent symlink attacks, and ensure temporary files are never world-readable. 2. Prefer a dedicated secret-management or SMTP client mechanism that does not expose credentials through the process argument vector. 3. Use an application-specific SMTP password with only the permissions needed to send alerts. Do not reuse a primary mailbox password. 4. Run the script under a dedicated account and restrict process visibility where the operating system supports it. 5. Ensure diagnostic logs, shell tracing, process accounting, and monitoring systems do not retain secret-bearing command lines. 6. Continue requiring encrypted SMTP transport and configure certificate verification normally; do not use options that disable TLS certificate checks. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (6)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
90% confidence
Finding

The skill documents shell-based execution (bash scripts/stock_alert.sh) and external command dependencies (curl, jq, optionally sonos) but does not declare any explicit tool scope such as permissions or allowed-tools. This can cause the agent runtime to grant broader-than-necessary shell capability implicitly, increasing the risk of command execution, network access, and secret misuse if the skill or its scripts are invoked in an automated environment.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The natural-language content of the skill, including the description and usage instructions, is presented entirely in Chinese. This imposes a specific language on users without offering an explicit language choice, which matches the locale/language policy concern for natural-language content.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script's title and multiple user-facing messages are written in Chinese, while the file does not provide a language selection mechanism or state that it is intentionally limited to Chinese-speaking users. This creates a natural-language locale policy issue because the skill imposes one language by default without opt-in.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The script reads a credential from an environment variable and embeds it directly in the outbound HTTP query string for the stock quote request. Although the code logs failures, there is no user-facing warning or comment disclosing that a credential and requested stock symbols are sent to an external service.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
78% confidence
Finding

The natural-language description and usage guidance are provided in Chinese only, with no indication that other languages are supported or that Chinese is an intentional, region-specific requirement. This can constitute a language policy issue when users are not offered a language choice or informed of the constraint.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
89% confidence
Finding

This markdown file states that the skill automatically sends email and/or Sonos voice alerts, which can transmit portfolio-related or system-generated data to external services. The description does not include any warning about privacy implications, external delivery, or reviewing notification content before enabling these channels.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.