Back to skill

Security audit

Trade Tracker

Security checks for vulnerabilities and agentic risk

Overview

This is a local trading CSV analysis skill with some documentation and input-hardening gaps, but no evidence of hidden network access, persistence, credential use, or destructive behavior.

Install only if you are comfortable with a Chinese-language local CLI reading your trade CSVs. Use trusted CSV files, choose --output paths carefully because they can overwrite local files you can write to, and treat reports from untrusted CSVs cautiously until terminal-output sanitization is added.

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

Warning
Location
scripts/trade_tracker.py:368
Finding

Untrusted CSV Values Are Printed Without Terminal Control-Sequence Sanitization

Content
View full analysis
5} {s['pnl']:>+12.2f} {s['win_rate']:>6.1f}%") ``` ```python for tag in sorted(tags, key=lambda t: -tags[t]["pnl"]): t = tags[tag] print(f" {tag:<12} {t['trades']:>5} {t['pnl']:>+12.2f} {t['win_rate']:>6.1f}% {t['avg_pnl']:>+10.2f}") ``` ### Technical Analysis The `stock` and `tag` values originate from user-supplied CSV fields and are interpolated directly into terminal output. The application does not remove escape characters, carriage returns, newlines, C0/C1 control characters, or ANSI/OSC/CSI terminal sequences before printing these values. A malicious CSV can therefore contain terminal instructions in a stock name, symbol, strategy, or tag. When the report is displayed in a compatible terminal emulator, those sequences may alter colors, move the cursor, overwrite previously displayed text, create deceptive hyperlinks, clear parts of the screen, or trigger other emulator-specific behavior. The issue does not provide direct shell command execution through the Python application. Its practical effect depends on the terminal emulator and its enabled features. ### Attack Path 1. An attacker creates or modifies a trade CSV accepted by the application. 2. The attacker inserts terminal control sequences into a `stock`, `代码`, `symbol`, `name`, `tag`, `strategy`, or `策略` field. 3. A user invokes the tracker on that file. 4. The value is retained by `parse_trades()` and later printed by `print_analysis()` or `print_tag_analysis()`. 5. The user's terminal emulator interprets the embedded sequence rather than displaying it as ordinary text. 6. The attacker can consequently forge or obscure report content and potentially facilitate social-enginee ...[truncated 553 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Note
Location
scripts/trade_tracker.py:165
Finding

Malformed Commission Records Can Cause Division by Zero

Content
View full analysis
0] avg_commission_rate = ( sum(t["commission"] / (t["price"] * t["shares"]) * 100 for t in trades_with_commission) / len(trades_with_commission) if trades_with_commission and total_turnover > 0 else 0 ) ``` ### Technical Analysis The condition checks whether at least one commissioned trade exists and whether aggregate `total_turnover` is positive. It does not ensure that every member of `trades_with_commission` has a nonzero `price * shares` denominator. Consequently, one valid trade can make `total_turnover > 0`, while another trade with a positive commission and a missing or zero price or share count remains in `trades_with_commission`. The generator expression then evaluates: ```python t["commission"] / (t["price"] * t["shares"]) ``` with a zero denominator and raises `ZeroDivisionError`. Because this exception is not caught, the process terminates without completing cost analysis. ### Attack Path 1. An attacker or malformed data source provides a CSV containing at least two retained trades. 2. One trade has valid nonzero price and share values, causing aggregate turnover to be positive. 3. Another trade has a positive commission but a zero or missing price or share value. 4. The user runs the application with `--cost`. 5. The second trade is included in `trades_with_commission`. 6. Calculation of its commission rate divides by zero and terminates the process. ### Impact Assessment A crafted or malformed local CSV can reliably deny service to the cost-analysis operation for that invocation. The user receives no completed cost report or JSON result from the affected execution. The impact is limited to application availability ...[truncated 149 chars]
Remediation
View remediation
0 and t.get("price", 0) > 0 and t.get("shares", 0) > 0 ] avg_commission_rate = ( sum( t["commission"] / (t["price"] * t["shares"]) * 100 for t in valid_commission_trades ) / len(valid_commission_trades) if valid_commission_trades else 0 ) ``` Additional hardening should include: 1. Validate numeric fields during CSV parsing and distinguish missing values from legitimate zero values. 2. Reject or explicitly report records with positive commission but invalid price or quantity. 3. Check for finite numeric values using `math.isfinite()` to prevent `NaN` or infinity from contaminating results. 4. Report the number of skipped malformed records. 5. Add tests covering zero price, zero shares, missing fields, negative quantities, `NaN`, infinity, and mixed valid/invalid records. ]]>
Vulnerability Patterns
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (7)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
90% confidence
Finding

The skill advertises local CSV analysis and demonstrates both reading input files and writing JSON output, but it does not declare any explicit tool scope such as permissions or allowed-tools. That mismatch weakens least-privilege controls and can let the runtime grant broader file capabilities than users expect, increasing the risk of unintended file access or overwrite if the implementation is changed or abused.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The manifest includes a locale/region constraint via "region": "cn", which indicates the skill is tied to a specific region. In this file, there is no accompanying natural-language justification or indication that users can opt into or choose a different locale, so this may violate the language/locale policy requirement.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

The natural-language content in the README, including section headings and feature descriptions, is presented only in Chinese. Under the policy, forcing a specific language without user opt-in is a locale/language policy violation unless the restriction is clearly documented and justified.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
86% confidence
Finding

The natural-language description, usage guidance, and examples are predominantly presented in Chinese, which can impose a language constraint on users without explicitly offering alternatives. The policy only allows such constraints when the skill offers a language/locale choice or clearly justifies the restriction.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

The module docstring and all user-facing usage/help text are written in Chinese, and the script continues this pattern throughout its CLI output. Because the file is a code file and it does not provide any user opt-in or locale selection, this is a natural-language locale policy concern under the stated rule.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

The argparse description, epilog, argument help text, disclaimer, status messages, and printed reports are all hard-coded in Chinese. This enforces a specific language for interaction without documented justification or user choice, which matches the policy-violation category for locale handling.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

The manifest frames the skill as a local analytics tool for reviewing CSV trade records, but the code also supports persisting results to a user-specified JSON file via --output. While still local, file creation/modification is a broader behavior than the read-and-analyze description emphasizes.

Content

No source excerpt is available for this finding.