Back to skill

Security audit

AI Stock Research Team

Security checks for vulnerabilities and agentic risk

Overview

The stock-analysis skill mostly matches its stated purpose, but it ships scripts that can persistently change AI-client MCP configuration and, if run, publish the whole repository to a public GitHub repo.

Install only if you are comfortable with a setup script that installs Python packages and persistently registers a local MCP server in your AI client. Review setup.sh before running it, avoid running publish.sh unless you intentionally want to create and push a public GitHub repository, and treat generated financial reports as informational rather than investment advice.

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)

T08 · Insecure Dependencies

Warning
Location
references/requirements.txt:1
Finding
Unpinned Executable Dependencies Allow Supply-Chain Drift<![CDATA[ ## Vulnerability Details **File Location**: `references/requirements.txt:1-3`; dependency installation occurs at `scripts/setup.sh:101-108` **Vulnerability Type**: Unpinned third-party dependencies without integrity verification **Risk Level**: Medium ### Vulnerable Code `references/requirements.txt:1-3`: ```text mcp[cli]>=1.0.0 akshare>=1.14.0 yfinance>=0.2.40 ``` `scripts/setup.sh:101-108`: ```bash info "安装 Python 依赖..." if command -v uv &>/dev/null; then uv pip install --python "$VENV_PYTHON" -r "$REQUIREMENTS" else "$VENV_PYTHON" -m pip install --upgrade pip -q "$VENV_PYTHON" -m pip install -r "$REQUIREMENTS" -q fi ``` ### Technical Analysis All three dependencies use minimum-version constraints rather than exact, reviewed versions. Consequently, each installation can resolve a different dependency graph, including future releases that were not part of this audit. The installation process also lacks package hashes or another integrity-verification mechanism. Python packages and their transitive dependencies may execute build-backend or installation-related code during resolution and installation. They are subsequently imported by the MCP server, allowing malicious runtime initialization code to execute as well. This creates a supply-chain exposure if an allowed upstream release or transitive dependency is compromised. The README additionally recommends `npx clawhub@latest`, which similarly resolves a mutable package version, although the confirmed Python dependency issue is directly represented by the requirements file and setup script. ### Attack Path 1. An attacker compromises one of the permitted Python packages, its distribution account, or a transitive dependency. 2. A malicious version is published with a version satisfying the broad `>=` constraint. 3. A user runs `scripts/setup.sh`. 4. `pip` or `uv` resolves and downloads the malicious version because no exact lock or hash restricts it. 5. Malicious code executes du ...[truncated 930 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Replace minimum-version constraints with exact, reviewed versions, including relevant transitive dependencies. 2. Generate and commit a reproducible lock file using a tool such as `pip-compile`, Poetry, or `uv lock`. 3. Require cryptographic hashes for downloaded artifacts, such as through `pip install --require-hashes`. 4. Pin the package installer and build tooling used by the installation process. 5. Replace documentation references to mutable `@latest` releases with a reviewed version. 6. Establish a controlled dependency-update process that includes vulnerability scanning, changelog review, and testing before lock-file updates. 7. Prefer binary wheels from trusted registries where appropriate, and explicitly configure the accepted package index to reduce dependency-confusion exposure. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
assets/report-template.html:890
Finding
Unsanitized Report Data Is Inserted Through innerHTML<![CDATA[ ## Vulnerability Details **File Location**: `assets/report-template.html:890-900` **Vulnerability Type**: DOM-based HTML injection **Risk Level**: Medium ### Vulnerable Code ```javascript // Debate if (data.bullPoints) { document.getElementById('bull-points').innerHTML = data.bullPoints.map(p => `<li>${p}</li>`).join(''); } if (data.bearPoints) { document.getElementById('bear-points').innerHTML = data.bearPoints.map(p => `<li>${p}</li>`).join(''); } if (data.debateResult) document.getElementById('debate-result').innerHTML = '⚖️ ' + data.debateResult; // Conclusion if (data.conclusion) document.getElementById('conclusion-text').innerHTML = data.conclusion; ``` ### Technical Analysis The `renderReport(data)` function inserts `bullPoints`, `bearPoints`, `debateResult`, and `conclusion` into the document using `innerHTML`. These values are neither escaped nor sanitized before the browser parses them as markup. If any field contains attacker-controlled HTML, the supplied content can introduce arbitrary elements and event-handler attributes. For example, a payload containing an image element with an error handler could run JavaScript when the browser renders the report. The risk is especially relevant if report data incorporates model-generated text, external financial/news content, or user-controlled company names and commentary without a strict trust boundary. Other fields in the same function use `textContent`, demonstrating that HTML parsing is not necessary for most report values. ### Attack Path 1. An attacker causes malicious markup to enter a report field, such as a bullish point, bearish point, debate result, or conclusion. 2. The application or user passes that field to `renderReport(data)`. 3. The renderer assigns the value to an element’s `innerHTML`. 4. The browser parses the value as active HTML rather than plain text. 5. An injected event handler or equivalent browser-supported payload executes in the report document’s origin. ...[truncated 1086 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Replace `innerHTML` with `textContent` for the debate result and conclusion whenever rich formatting is unnecessary. 2. Construct list entries with DOM APIs instead of interpolated HTML: ```javascript function replaceList(elementId, values) { const list = document.getElementById(elementId); list.replaceChildren(); for (const value of values) { const item = document.createElement('li'); item.textContent = String(value); list.appendChild(item); } } ``` 3. If limited rich formatting is a requirement, sanitize content with a maintained sanitizer using a strict allowlist of harmless tags and no event-handler, script, style, iframe, or unsafe URL attributes. 4. Validate the structure and maximum length of every `renderReport` field before rendering. 5. Add a restrictive Content Security Policy that disallows inline scripts and event handlers and limits outbound connections. 6. Treat model-generated, user-provided, and externally retrieved text as untrusted even when it is expected to contain only financial commentary. 7. Add regression tests containing HTML and event-handler payloads to confirm they are rendered as inert text. ]]>
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
Findings (35)

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
Behavior that deletes virtual environments, edits MCP configuration files, or unregisters servers is materially unrelated to end-user stock analysis and can alter or damage the local agent environment. In this context, hidden install/uninstall or cleanup actions increase the risk of persistence changes, denial of service, and confusing side effects outside the skill’s stated purpose.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding
Behavior that deletes virtual environments, edits MCP configuration files, or unregisters servers is materially unrelated to end-user stock analysis and can alter or damage the local agent environment. In this context, hidden install/uninstall or cleanup actions increase the risk of persistence changes, denial of service, and confusing side effects outside the skill’s stated purpose.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
Behavior that deletes virtual environments, edits MCP configuration files, or unregisters servers is materially unrelated to end-user stock analysis and can alter or damage the local agent environment. In this context, hidden install/uninstall or cleanup actions increase the risk of persistence changes, denial of service, and confusing side effects outside the skill’s stated purpose.

Missing User Warnings

High
Confidence
99% confidence
Finding
The script creates a public GitHub repository and pushes content without an explicit warning that the upload is public or that data exposure may be irreversible once indexed or cloned. Because it runs under the user's authenticated GitHub CLI session, a single execution can publish the entire repository contents broadly and immediately.

Missing User Warnings

Medium
Confidence
87% confidence
Finding
The README advertises real-time stock analysis via MCP tools backed by akshare and yfinance, but it does not warn users that their queried tickers and related requests may be sent to external data providers or services. In a finance-oriented workflow, query patterns can reveal user interests, strategies, or sensitive research activity, so omission of this disclosure creates a privacy and transparency risk.

Rp1

Medium
Category
MCP Rug Pull
Confidence
88% confidence
Finding
The README instructs users to run `npx clawhub@latest install stock-research-team`, which pulls and executes the latest package version at install time rather than a reviewed, pinned release. This creates a supply-chain risk: if the upstream package is compromised or a breaking/malicious update is published, users may execute untrusted code during installation.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
The README tells users to run setup and later uninstall shell scripts that create virtual environments, install packages, and register/remove an MCP server, but it does not clearly warn about the system changes these scripts perform. This increases the risk of users executing impactful local changes without informed consent, especially because shell scripts can modify files, environment configuration, and tool registrations.

Rp1

Medium
Category
MCP Rug Pull
Confidence
88% confidence
Finding
The uninstall command also uses `npx clawhub@latest`, which again relies on an unpinned executable fetched at runtime. Although this is an uninstall path, it still executes code from the network and could be abused via a compromised upstream release or dependency chain.

Lp3

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding
The skill requests users to run a local setup script and declares no explicit tool scope or permissions, while the package appears to include file read/write capabilities. In an agent ecosystem, missing scope declarations reduce transparency and can permit broader-than-expected local file operations during setup or execution, which is risky for a stock-analysis skill that should not need unrestricted filesystem access.

Natural-Language Policy Violations

Medium
Confidence
89% confidence
Finding
The skill is defined entirely as a Chinese-language experience and does not state that the user may choose another language. This creates a language/locale policy concern because the skill appears to enforce a specific language without explicit user opt-in or an offered alternative.

Vague Triggers

Medium
Confidence
92% confidence
Finding
The activation description includes broad natural-language phrases like "帮我看看 XXX 这只股票" and "XXX 值不值得买", which are common conversational requests rather than tightly scoped commands. Because the skill does not provide exclusion conditions or clearer trigger boundaries, this could cause unintended invocation during ordinary discussion about stocks.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
The document hard-codes `lang="zh-CN"`, and the visible interface text throughout the template is fixed in Simplified Chinese. This imposes a specific language/locale on users without offering opt-in, fallback, or explaining that the skill is intentionally region-specific.

Intent-Code Divergence

Medium
Confidence
98% confidence
Finding
The template’s script injects untrusted data into the DOM with innerHTML for bullPoints, bearPoints, debateResult, and conclusion. If any of these fields are derived from LLM output, MCP tool results, or user-controlled stock/report content, an attacker can inject arbitrary HTML/JavaScript, leading to stored or reflected XSS in the generated report.

Context-Inappropriate Capability

Medium
Confidence
96% confidence
Finding
The script performs GitHub authentication, creates a repository, and pushes local contents to a public remote, which is unrelated to the runtime purpose of a stock research skill. In this context, bundling publication behavior increases supply-chain and data-exposure risk because users may run a convenience script that unexpectedly publishes all local skill files under their authenticated GitHub account.

Description-Behavior Mismatch

Medium
Confidence
96% confidence
Finding
The script stages all files, commits them, and publishes them to a public GitHub repository, behavior that does not match the declared stock-analysis functionality of the skill. This mismatch is dangerous because users evaluating a financial-analysis skill would not reasonably expect repository publication logic, making accidental disclosure of source, secrets, or local artifacts more likely.

Missing User Warnings

Medium
Confidence
98% confidence
Finding
Using `git add -A` and committing immediately captures every tracked and untracked file in the directory without user review or confirmation. This can inadvertently include credentials, local notes, build artifacts, or environment files, creating a straightforward path to accidental sensitive-data publication once the later push step runs.

Natural-Language Policy Violations

Medium
Confidence
92% confidence
Finding
Natural-language descriptions and tool documentation in this file consistently force Chinese-language output and interaction context, with no indication that users may choose another language. Under the stated policy, mandating a specific language without opt-in is a locale/language policy violation.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
echo ""
    echo "  请安装 Python 3.10+:"
    echo "    macOS:  brew install python@3.12"
    echo "    Ubuntu: sudo apt install python3.12 python3.12-venv"
    echo "    通用:   https://www.python.org/downloads/"
    echo ""
    exit 1
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Description-Behavior Mismatch

Medium
Confidence
95% confidence
Finding
The setup script modifies host MCP client configuration files and registers a server automatically, which exceeds simple local environment setup for a stock-analysis skill. This is risky because it changes persistent client behavior on the user's machine and expands the skill's execution surface without explicit confirmation or narrowly scoped consent.

Missing User Warnings

Medium
Confidence
97% confidence
Finding
The script writes directly to user MCP configuration files without prior confirmation, backup, or an explicit warning that persistent client settings will be changed. Silent modification of trusted tool configuration is dangerous because it can cause an AI client to start invoking new local code paths the user did not intentionally authorize.

Intent-Code Divergence

Medium
Confidence
90% confidence
Finding
The header comment states the script removes `stock-analyzer`, which conflicts with the declared skill name `stock-research-team`. Misleading uninstall metadata increases the chance that maintainers or users run the script under false assumptions, leading to removal of unrelated configuration entries and making review of the script less reliable.

Description-Behavior Mismatch

Medium
Confidence
96% confidence
Finding
The uninstall script belongs to the `stock-research-team` skill but removes an MCP server named `stock-analyzer`. This mismatch can cause the script to alter or break a different tool installation than the one the user intended to remove, especially in an environment where multiple skills or MCP servers coexist.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The script performs `rm -rf` on a virtual environment directory without interactive confirmation or a dry-run warning. Although the target path is quoted and derived from the script location, recursive deletion is still destructive and could remove data unexpectedly if the directory layout is not what the user expects or if the script is launched from a tampered installation.

Missing User Warnings

Medium
Confidence
89% confidence
Finding
The script edits MCP configuration files in place and may remove entries automatically via CLI or direct JSON rewriting, without clear up-front notice, backup, or confirmation. This can unexpectedly change user environment configuration and break other workflows, especially because the server name mismatch raises the risk of deleting the wrong entry.

Rp1

Medium
Category
MCP Rug Pull
Confidence
70% confidence
Finding
npx commands without a version suffix (e.g. @1.0.0) create a rug-pull risk if the upstream server is compromised and publishes a malicious update.

Static analysis

No suspicious patterns detected.