Back to skill

Security audit

stock-watchlist-zh

Security checks for vulnerabilities and agentic risk

Overview

This skill mostly does what it claims, but it needs review because an undocumented endpoint override could send the AISA API key and watchlist tickers to another server.

Review this before installing. Use it only in a controlled environment, keep AISA_BASE_URL unset unless you intentionally trust the replacement endpoint, and avoid committing the generated .clawdbot watchlist file if your watched tickers or alert levels are private.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
Findings (2)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/watchlist.py:57
Finding

Configurable API endpoint can redirect credentials and watchlist data to an arbitrary server

Content
View full analysis

Vulnerability Details

File Location: scripts/watchlist.py, lines 57-62
Vulnerability Type: Arbitrary API endpoint configuration and credential disclosure
Risk Level: High

Vulnerable Code:

python
def get_client() -> OpenAI:
    api_key = os.environ.get("AISA_API_KEY")
    if not api_key:
        print("❌ Error: AISA_API_KEY environment variable is not set.", file=sys.stderr)
        sys.exit(1)
    base_url = os.environ.get("AISA_BASE_URL", "https://api.aisa.one/v1")
    return OpenAI(api_key=api_key, base_url=base_url)

Technical Analysis

The Skill requires AISA_API_KEY to access the declared AISA service, but it permits AISA_BASE_URL to select an arbitrary API endpoint. The supplied URL is not restricted to the expected api.aisa.one host, nor does the code enforce an approved scheme or endpoint allowlist.

The OpenAI client uses the AISA API key to authenticate requests against the selected base URL. Consequently, changing AISA_BASE_URL can cause the credential to be presented to an unintended server. During the check command, the complete ticker list is also included in the API prompt and sent to that endpoint.

Supporting request construction occurs in scripts/watchlist.py, lines 66-95:

python
def fetch_watchlist_data(tickers: list[str]) -> dict:
    """Fetch current price + signal for each ticker via AIsa API."""
    if not tickers:
        return {}
    client = get_client()
    model = os.environ.get("AISA_MODEL", "gpt-4o")
    ticker_str = ", ".join(tickers)
    prompt = (
        f"For each of these tickers: {ticker_str}\n\n"
        "Fetch the current price and generate a quick BUY/HOLD/SELL signal based on "
        "RSI, trend, and recent price action.\n\n"
        "Return ONLY a JSON object. Example:\n"
        "{\n"
        "  \"AAPL\": {\"price\": 195.50, \"signal\": \"BUY\", \"change_1d\": 1.2, \"rsi\": 58},\n"
        "  \"TSLA\
...[truncated 2146 chars]
Remediation
View remediation

Remediation Suggestions

  • Remove AISA_BASE_URL configurability if custom endpoints are not required.
  • If endpoint customization is necessary, parse the URL and enforce:
    • The https scheme.
    • An explicit allowlist of approved hostnames, such as api.aisa.one.
    • An approved port and path prefix.
    • Rejection of embedded credentials, redirects to unapproved hosts, and malformed URLs.
  • Do not reuse AISA_API_KEY for custom endpoints. Require a distinct credential explicitly associated with each approved service.
  • Ensure HTTP redirects cannot forward authorization headers to an unapproved origin.
  • Document in SKILL.md that checking the watchlist transmits all ticker symbols to AISA.
  • Apply restrictive environment and deployment configuration permissions so untrusted users cannot alter endpoint variables.
  • Rotate the API key if the Skill has previously run with an untrusted AISA_BASE_URL.

T08 · Insecure Dependencies

Warning
Location
scripts/watchlist.py:3
Finding

Unpinned third-party dependency creates mutable supply-chain exposure

Content
View full analysis

Vulnerability Details

File Location: scripts/watchlist.py, lines 3-7
Vulnerability Type: Unpinned runtime dependency
Risk Level: Medium

Vulnerable Code:

python
# /// script
# requires-python = ">=3.10"
# dependencies = [
#     "openai>=1.0.0",
# ]
# ///

Technical Analysis

The PEP 723 dependency declaration permits any available openai package release at or above version 1.0.0. The project contains no exact version pin, lock file, or integrity hash.

A metadata-aware runner such as uv run, which is explicitly shown in the script's usage documentation, may resolve and install a different package version on later executions. This means the code that ultimately executes is not fully represented by the audited project contents and can change without a corresponding change to the Skill.

Importing the dependency occurs at module initialization:

python
from openai import OpenAI

Python package initialization code executes with the same permissions as the watchlist process. Therefore, a compromised or unexpectedly replaced dependency release could access the process environment, including AISA_API_KEY, and files available to the invoking user.

No evidence was found that the currently named openai package is malicious. The issue is the mutable and insufficiently reproducible dependency policy rather than a confirmed malicious package.

Attack Path

  1. The Skill is invoked through a PEP 723-aware runner in an environment where the dependency is not already locked and verified.
  2. The runner resolves a package version satisfying openai>=1.0.0.
  3. A compromised future release, registry compromise, or unauthorized package-source substitution supplies malicious package content.
  4. Python imports openai before command processing begins.
  5. Malicious package initialization code executes with the Skill process's privileges.
  6. The code can read accessible envir ...[truncated 673 chars]
Remediation
View remediation

Remediation Suggestions

  • Pin the dependency to a reviewed exact version rather than using an open-ended lower bound.
  • Generate and commit a lock file that records all transitive dependency versions.
  • Use package hashes or another integrity-verification mechanism where supported.
  • Install packages only from a trusted, explicitly configured registry.
  • Review dependency updates before changing the lock file, and use automated vulnerability and provenance scanning.
  • Prefer a controlled virtual environment or prebuilt artifact so routine Skill execution does not dynamically resolve new package releases.
  • Apply least privilege to the runtime environment and expose only the API credential required by this Skill.
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (6)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
89% confidence
Finding

The skill declares access to environment variables and describes reading/writing persistent local state, but it does not define an explicit tool scope such as permissions or allowed-tools. This increases the risk of overbroad execution because an agent may invoke file and environment capabilities without a clearly documented boundary, making unintended file modification or secret exposure more likely.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill name and all user-facing documentation are in Chinese, with no indication that other languages are supported or that the locale restriction is intentional and justified. This can violate language or locale policy when users are not given an explicit opt-in or alternative.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The trigger language is broad enough to match many generic investing requests, which can cause the skill to be selected in contexts the user did not intend. That can lead to unnecessary state changes, API use, or use of a finance-focused workflow when a narrower or safer skill would be more appropriate.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The documentation states that the skill persists watchlist state to a local file in the repository, but it does not prominently warn users that invoking the skill modifies local files. Hidden persistence can surprise users, create unwanted repository changes, and expose sensitive trading interests if the workspace is shared or later committed.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The manifest explicitly sets the skill language to Chinese, which can override or constrain the user's expected locale without an explicit opt-in mechanism. This is primarily a trust and usability issue: users may misunderstand prompts, instructions, or outputs if the agent invokes the skill in an unexpected language, which can be more sensitive in a finance-related workflow involving stock watchlists and alerts.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · scripts/watchlist.py (reported line 60)May include surrounding context.

python
if not api_key:
        print("❌ Error: AISA_API_KEY environment variable is not set.", file=sys.stderr)
        sys.exit(1)
    base_url = os.environ.get("AISA_BASE_URL", "https://api.aisa.one/v1")
    return OpenAI(api_key=api_key, base_url=base_url)