Back to skill

Security audit

stock-rumors-zh

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly matches its market-rumor purpose, but it can send the AISA API key and prompts to an arbitrary endpoint through an undocumented environment override.

Use this only if you intend to send market-rumor scan requests to AISA. Before installing, remove or lock down AISA_BASE_URL, use a narrowly scoped and revocable AISA_API_KEY, and consider pinning the OpenAI SDK dependency.

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/rumor_scanner.py:147
Finding

API Credential Can Be Redirected to an Arbitrary Network Endpoint

Content
View full analysis

Vulnerability Details

File Location: scripts/rumor_scanner.py, lines 147–154 and 174–181
Vulnerability Type: Unvalidated credential destination
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)
        print("   Set it with: export AISA_API_KEY=your_key_here", 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)

The resulting client transmits an authenticated request here:

python
response = client.chat.completions.create(
    model=model,
    messages=[
        {"role": "system", "content": SYSTEM_PROMPT},
        {"role": "user", "content": prompt},
    ],
    temperature=0.2,
)

Technical Analysis

The code obtains the sensitive AISA_API_KEY credential and supplies it to an OpenAI-compatible client. The request destination is selected through the undocumented AISA_BASE_URL environment variable without validating its scheme, hostname, port, or trust relationship.

An attacker who can influence the process environment can set this variable to an attacker-controlled endpoint. The SDK will then use the AISA credential when making a request to that endpoint. The implementation also does not explicitly reject plaintext HTTP, creating a potential credential-disclosure risk if an insecure URL is accepted by the SDK.

The default endpoint, https://api.aisa.one/v1, is consistent with the Skill's declared remote market-scanning functionality. Sending authentication to that service is necessary. Allowing unrestricted endpoint substitution, however, exceeds the minimum privileges required by the documented behavior.

Attack Path

  1. An attacker, compromised launcher, wrapper script ...[truncated 1233 chars]
Remediation
View remediation

Remediation Suggestions

  1. Remove the AISA_BASE_URL override if custom endpoints are not required:

    python
    return OpenAI(
        api_key=api_key,
        base_url="https://api.aisa.one/v1",
    )
    
  2. If endpoint customization is a legitimate requirement, parse and validate the URL before creating the client:

    • Require https.
    • Reject embedded credentials.
    • Require an exact allowlist of trusted hostnames and ports.
    • Reject loopback, link-local, private-network, and unapproved hosts.
    • Avoid permissive suffix checks that can accept deceptive domains.
  3. Ensure credentials are not forwarded across redirects to a different origin. Disable redirects where possible or validate every redirect destination before retaining authentication headers.

  4. Document the endpoint override and its security implications if it must remain supported.

  5. Use a narrowly scoped, revocable API key with usage limits and monitoring. Rotate the key immediately if endpoint manipulation or credential exposure is suspected.

  6. Add automated tests confirming that plaintext HTTP and unapproved destinations are rejected before any authenticated network request occurs.

T08 · Insecure Dependencies

Warning
Location
scripts/rumor_scanner.py:3
Finding

Unbounded Third-Party SDK Version Creates Supply-Chain Risk

Content
View full analysis

Vulnerability Details

File Location: scripts/rumor_scanner.py, lines 3–7
Vulnerability Type: Broad and unpinned third-party 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 every future version of the openai package greater than or equal to version 1.0.0, including future major releases. No lockfile, exact version, or package hash is included in the audited project.

When the script is executed using a dependency-aware runner such as the documented uv run rumor_scanner.py invocation, the runner may resolve and install a package release that was not present when this Skill was reviewed. Consequently, the executable dependency graph is neither reproducible nor fully represented by the audited artifact.

The package name is legitimate, and the reviewed code does not establish that the current package is malicious. The security weakness is the unconstrained supply-chain trust granted to future releases and their transitive dependencies.

Attack Path

  1. The script is run through a tool that processes its inline PEP 723 dependency metadata.
  2. The dependency resolver queries its configured package index for a version satisfying openai>=1.0.0.
  3. The resolver selects a newer, potentially unreviewed release and any associated transitive dependencies.
  4. The runner installs and imports that code under the user's account.
  5. If a selected release or transitive dependency is compromised, malicious code can execute with the privileges of the user running the Skill.
  6. Such code could access environment variables, including AISA_API_KEY, as well as files and network resources available to that user.

Impact Assessment

A compromised dependency could execute arbitrary Python code with the invoking user's operating-sys ...[truncated 371 chars]

Remediation
View remediation

Remediation Suggestions

  1. Pin the SDK to an exact, reviewed version:

    python
    # dependencies = [
    #     "openai==<reviewed-version>",
    # ]
    
  2. Commit a lockfile covering direct and transitive dependencies when supported by the selected execution workflow.

  3. Enforce package integrity hashes and use a trusted package index under organizational control where practical.

  4. Configure automated dependency scanning and review updates before changing pinned versions.

  5. Avoid resolving dependencies dynamically during production execution. Build and test a fixed environment in advance.

  6. Keep the documented execution method consistent with dependency provisioning so users do not need to install ad hoc package versions.

Vulnerability Patterns
  • 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
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (6)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
83% confidence
Finding

The skill requires access to an environment secret (AISA_API_KEY) and can invoke python3, but it does not declare an explicit tool scope such as permissions or allowed-tools. This creates an authorization ambiguity where an agent may grant broader execution or secret access than intended, increasing the risk of overprivileged use or accidental secret exposure through the referenced script.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The trigger text is broad enough to match many generic finance questions, which can cause the agent to invoke this skill in contexts the user did not intend. Because the skill uses an external API and market-rumor workflow, overbroad activation can unnecessarily expose user queries to third-party processing and produce speculative outputs where a more appropriate skill or no tool use would be safer.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The manifest sets the skill language to "zh", which indicates a fixed locale choice. In this file there is no indication that the user can opt into another language or that the Chinese-only constraint is justified by a region-specific purpose.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
87% confidence
Finding

The code is explicitly configured to transmit data to an external service at https://api.aisa.one/v1, which creates a real data egress path. By itself this is expected functionality rather than malicious behavior, but in a security review it is still a valid issue when the skill can send potentially sensitive prompts or market research context to a third-party API without stronger trust controls or disclosure.

Content

Scanner excerpt · scripts/rumor_scanner.py (reported line 162)May include surrounding context.

python
print("❌ Error: AISA_API_KEY environment variable is not set.", file=sys.stderr)
        print("   Set it with: export AISA_API_KEY=your_key_here", 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)

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The script sends prompts to an external AISA/OpenAI-compatible API but does not clearly disclose to the user, at the point of execution, what content will be transmitted or that the request leaves the local environment. In an agent-skill context, this matters because user interests, tickers, or future prompt additions could include sensitive trading research or proprietary watchlists that are silently exfiltrated to a third-party service.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
86% confidence
Finding

The user-facing instructions and examples are entirely in Chinese, and the file does not indicate that the skill is region-specific or that users may choose another language. This can violate language/locale policy when a skill implicitly forces one language without opt-in.

Content

No source excerpt is available for this finding.