Back to skill

Security audit

hectorlee-daily-precision-picker

Security checks for vulnerabilities and agentic risk

Overview

This stock-screening skill has a coherent finance purpose, but its script can turn stock-code input into shell commands, so it needs manual review before installation.

Install only after the publisher fixes the command-injection path by validating stock codes and using shell-free subprocess argument lists. Also consider requiring explicit invocation, reviewing or pinning the npm dependency with integrity controls, and limiting JSON output paths. This is not evidence of malicious intent, but the current package can expose the user's local account if a crafted stock code reaches the script.

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/precision_picker.py:55
Finding

Shell Command Injection Through Unvalidated Stock Codes

Content
View full analysis
1 else "" candidates.append({"code": code, "name": name}) ``` The resulting values are directly interpolated into command strings: ```python cmd = f"npx -y westock-data-skillhub@1.0.5 finance {','.join(working_codes)} --num 1" stdout, rc, success = run_cmd(cmd, cwd=str(SKILL_DIR), timeout=90) ``` ```python code_list = ",".join(codes) cmd = f"npx -y westock-data-skillhub@1.0.5 fund flow {code_list}" stdout, rc, success = run_cmd(cmd, cwd=str(SKILL_DIR), timeout=90) ``` These command strings are executed through a shell: ```python def run_cmd(cmd, cwd=None, timeout=60): """Execute a command and return stdout and a success indicator.""" try: result = subprocess.run( cmd, shell=True, capture_output=True, text=True, timeout=timeout, cwd=cwd ) return result.stdout.strip(), result.returncode, True except subprocess.TimeoutExpired: return "", -1, False except Exception: return "", -1, False ``` ### Technical Analysis The code treats stock identifiers as trusted command fragments. No strict allowlist, regular-expression validation, argument escaping, or shell-free process i ...[truncated 2655 chars]
Remediation
View remediation

T08 · Insecure Dependencies

Warning
Location
scripts/precision_picker.py:154
Finding

Runtime Download and Execution of an npm Package Without Integrity Verification

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (11)

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
98% confidence
Finding

This is the core command-injection issue: shell=True turns the shell into an interpreter for attacker-controlled text, and later code interpolates joined stock codes directly into shell command strings. A malicious code like 'sh600519; rm -rf ~' or shell substitution payloads could execute arbitrary commands when the finance or fund-flow layers run. Because the skill supports user-provided pools and files, the attack surface is direct and practical.

Content

Scanner excerpt · scripts/precision_picker.py (reported line 58)May include surrounding context.

python
def run_cmd(cmd, cwd=None, timeout=60):
    """执行命令并返回 stdout 和 success 标记"""
    try:
        result = subprocess.run(
            cmd, shell=True, capture_output=True, text=True,
            timeout=timeout, cwd=cwd
        )

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
93% confidence
Finding

The skill document includes explicit shell commands and describes file read/write behavior (such as generating JSON output and operating on local script directories) but declares no tool restrictions. In an agent environment, missing permissions or allowed-tools means the agent may execute broader capabilities than necessary, increasing the risk of unintended command execution, filesystem modification, or abuse if the skill is triggered in the wrong context.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The trigger phrases include generic terms like '精选', '每日优选', '深度筛选', and '资金确认', which can easily overlap with ordinary user conversation. Overbroad triggers can cause the skill to activate unintentionally, and because this skill can drive shell execution and file operations, accidental invocation increases the chance of unnecessary external data access or command execution.

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's description, tags, MCP requirement descriptions, and trigger phrases are entirely in Chinese, with no indication that users may choose another language or that the skill is intentionally restricted to a Chinese-language environment. This creates a natural-language locale constraint that is not presented as optional or explicitly justified.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The trigger phrases include very generic financial terms such as '精选', '每日优选', and '深度筛选', which are likely to collide with ordinary user discussion rather than clear intent to invoke this specific skill. In an agent ecosystem, overly broad triggers can cause accidental activation, leading the skill to provide financial screening output when the user did not explicitly request this tool, which is especially sensitive in a finance context.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
97% confidence
Finding

The helper executes shell commands via subprocess.run with shell=True, and the command strings are built using unsanitized stock-code input in later layers. If an attacker supplies a crafted --pool or pool-file value containing shell metacharacters, arbitrary OS commands can execute under the user's account. In this skill context, the script is explicitly intended to process externally supplied candidate codes, which makes the sink realistically reachable.

Content

Scanner excerpt · scripts/precision_picker.py (reported line 58)May include surrounding context.

python
def run_cmd(cmd, cwd=None, timeout=60):
    """执行命令并返回 stdout 和 success 标记"""
    try:
        result = subprocess.run(
            cmd, shell=True, capture_output=True, text=True,
            timeout=timeout, cwd=cwd
        )

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The layer2_fundamental docstring says missing westockdata data should not be treated as a fake pass and should be clearly disclosed. However, when data is unavailable, the implementation appends every working code to the passed list and continues them through the funnel, only tagging them as skipped. That behavior contradicts the stated intent of not effectively passing unverifiable candidates.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The layer4_sector_quality documentation states that sector scoring is based on keyword classification from stock names. In the actual code, each stock's name is set to an empty string and _get_industry is called with that empty value, causing all entries to fall back to '其他' rather than using name-based classification. This is an active contradiction between the documented method and the implemented behavior.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
82% confidence
Finding

The file title and all instructional content are written exclusively in Chinese, with no indication that language selection is optional or that the skill is region-specific. Under the policy, forcing a specific language without user opt-in can constitute a natural-language locale violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
94% confidence
Finding

SQP-3 applies to all file types and covers natural-language language/locale policy violations. The module docstring presents usage information entirely in Chinese, which effectively forces one language for users without opt-in or an explanation that the skill is region-specific.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
91% confidence
Finding

The CLI description, argument help strings, and error/usage output are all Chinese-only. Under SQP-3, this is a natural-language policy issue because the skill does not offer a language choice or clearly justify a locale-specific constraint.

Content

No source excerpt is available for this finding.