Back to skill

Security audit

Financial data fetcher

Security checks for vulnerabilities and agentic risk

Overview

This skill is mostly a TongdaXin finance-data toolkit, but it also includes under-disclosed live trading, destructive client-state changes, and unsafe file-writing capabilities that require user review before installation.

Install only if you intentionally want an agent to control a local TongdaXin TQ environment, and treat it as write-capable rather than read-only. Avoid using it with a logged-in trading account unless trading functions are removed or separately gated, and review sector deletion/clearing plus print_to_tdx file export behavior before allowing automated use.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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 (3)

T09 · Insecure Skill Coding Practices

Error
Location
lib/tqcenter.py:725
Finding

Path Traversal Enables Arbitrary File Deletion and Overwrite

Content
View full analysis
Remediation
View remediation
Path: if Path(supplied_name).name != supplied_name: raise ValueError("Only simple filenames are permitted") if not supplied_name.lower().endswith(extension): raise ValueError(f"Filename must end with {extension}") root = root.resolve() destination = (root / supplied_name).resolve() destination.relative_to(root) return destination ``` 4. Write directly to a validated destination rather than first creating a file in the current working directory. 5. Use a securely created temporary file in the validated target directory and perform an atomic `os.replace()` only after serialization succeeds. 6. Do not automatically delete an existing file unless replacement is explicitly requested and authorized. 7. Run the exporter under a low-privilege account that has write access only to the required TongdaXin data directories. 8. Add automated tests covering absolute paths, Windows drive paths, UNC paths, mixed separators, encoded traversal, and repeated `..` components. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
lib/tqcenter.py:677
Finding

Unescaped Values Permit TongdaXin XML and SP Configuration Injection

Content
View full analysis
''' ``` DataFrame column names and JSON filenames are also interpolated into XML attributes without escaping: ```python sp_names = current_df.columns[1:].tolist() for j, fname in enumerate(sp_names, 1): col_name = f"code_g{group_idx + 1}_t1_{j}" xml_content += f'\t\t\t\t\t\t\t\t\n' xml_content += f''' ''' ``` SP configuration values are similarly inserted without format-aware escaping: ```python sp_file = f"{sp_name}.sp" if sp_name else "python.sp" sp_path = os.path.join(pad_dir, sp_file) sp_content = f'''[DEAFULTGP] Name={sp_name} ShowName= CmdNum=2 UnitNum=1 KeyGuyToExtern=0 ForceUseDS=0 PadMaxCx=0 PadMaxCy=0 PadHelpStr=运行时间:{run_time} # 记录运行时间 PadHelpUrl= HasProcessBtn=0 UnSizeMode=0 HQGridNoCode=0 crTipWord=0 Fix ...[truncated 2593 chars]
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Error
Location
lib/tqcenter.py:2240
Finding

Data-Fetching Skill Exposes an Undeclared Native Order-Submission Interface

Content
View full analysis
0: result_str = ptr.decode('utf-8') data_json = json.loads(result_str) if data_json.get("ErrorId") != "0": print(f"下单{stock_code}数据错误: {data_json}") return -1 return data_json return -1 except Exception as e: print(f"下单{stock_code}数据异常: {e}") import traceback traceback.print_exc() return -1 ``` ...[truncated 2299 chars]
Remediation
View remediation
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (104)

Context-Inappropriate Capability

Critical
Category
Not specified by scanner
Confidence
99% confidence
Finding

The order_stock function invokes dll.SetNewOrder with user-supplied account, symbol, size, and price parameters, which appears to submit live trading orders. In a skill presented as data-fetching, this creates a severe integrity and financial-risk issue because any agent or user expecting read-only behavior could trigger real transactions without realizing the capability exists.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

A tool advertised as data retrieval also includes commands that modify custom sectors and other persistent state. That kind of description-behavior mismatch is dangerous because automated selection logic may invoke the skill for ordinary finance queries without anticipating side effects.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
93% confidence
Finding

A tool advertised as data retrieval also includes commands that modify custom sectors and other persistent state. That kind of description-behavior mismatch is dangerous because automated selection logic may invoke the skill for ordinary finance queries without anticipating side effects.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
95% confidence
Finding

The send_user_block function modifies the user's watchlist/custom sector state through SetResToMain, which is a persistent client-side side effect unrelated to simple data retrieval. This can silently alter a user's environment, mislead downstream workflows, or be abused to inject unwanted symbols into monitored lists.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The skill is described as a financial data fetcher, but this file exposes capabilities well beyond read-only data access, including order placement and client-state modification. This mismatch is dangerous because a caller or orchestrator may grant the skill broader trust than intended, enabling unauthorized trades or persistent client changes under the guise of data retrieval.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
96% confidence
Finding

Order placement is exposed as a direct function call with no user-facing warning, confirmation, or secondary approval step. This makes accidental, coerced, or policy-bypassing trade execution much easier, especially in an agent context where tools may be invoked automatically.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The docstring for the order interface says it has no actual function, yet the implementation calls SetNewOrder and processes the returned result as if the order were real. Misleading documentation around a destructive financial action is dangerous because reviewers, operators, or policy layers may underestimate the risk and allow code that can place trades.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The example code exposes arbitrary local file transmission via tq.send_file(file), while the skill is described only as a financial data fetcher. A capability to send local files to a client can be abused for unintended data exfiltration or movement of sensitive local content, especially when users do not expect file-transfer behavior from this skill.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

A local file upload primitive is not justified by the stated purpose of fetching financial data, so it represents unnecessary and risky functionality. In the context of an agent skill, this mismatch is especially dangerous because operators may authorize the skill for benign market-data tasks while unknowingly enabling transfer of arbitrary local files to an external client.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
96% confidence
Finding

The code packages buy/sell signals into structured warnings via send_warn and the surrounding instructions say users can quickly open lightning buy/sell interfaces from those signals. Even if it does not place orders directly, it materially shortens the path from model output to trade execution, increasing the risk of unintended, manipulated, or insufficiently reviewed trading actions.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The script performs a destructive state-changing operation (clear_sector) that removes all constituents from a custom sector, which conflicts with the skill's stated purpose as a financial data retrieval tool. This mismatch increases the risk of accidental or unexpected destructive use, especially if operators assume the package is read-only and run it in automation or with elevated access.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The script performs a destructive action by deleting a custom sector via tq.delete_sector, which conflicts with the stated skill purpose of financial data retrieval. This mismatch increases the risk of unintended or hidden destructive behavior, especially if the skill is installed or invoked under the assumption that it is read-only.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
83% confidence
Finding

The skill documents commands that can write to the local system or modify application state, but it does not declare any explicit tool scope or permission boundary. In an agent setting, missing scope declarations increases the chance that file-writing or state-changing actions are invoked without clear authorization or review.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The documented command set mixes data-fetching operations with management actions such as custom-sector modification, cache refresh, and downloading files. In a security-sensitive agent ecosystem, combining safe and mutating actions under one broad finance skill increases accidental misuse and weakens the principle of least privilege.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The trigger conditions are extremely broad, covering essentially any stock, market, or financial-data-related request. Overbroad triggers make unintended activation more likely, which is especially risky when the same skill includes write, download, refresh, or subscription capabilities beyond simple lookup behavior.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The custom-sector commands include create, delete, rename, add-members, and clear operations, but the documentation provides no warning that these are destructive or persistent changes. A user or agent could unintentionally alter watchlists or sector organization, causing loss of user configuration and downstream decision errors.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The print_to_tdx function creates, overwrites, deletes, and moves XML/JSON/SP files into client directories, changing local application state rather than merely returning fetched data. In a supposedly read-only financial data skill, hidden filesystem writes increase the risk of persistence, configuration tampering, or unanticipated client behavior.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The file export logic overwrites existing files, removes targets, and moves generated artifacts into application directories without clear disclosure at the API boundary. Undisclosed destructive filesystem operations can damage user configuration, create persistence, or surprise higher-level systems that assumed the skill was read-only.

Content

No source excerpt is available for this finding.

Whitespace Padding

Medium
Category
Prompt Injection
Confidence
70% confidence
Finding

Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.

Content

Scanner excerpt · lib/tqcenter.py (reported line 1107)May include surrounding context.

python
for i, date in enumerate(dates):
                        if i < len(values):
                            ts = f"{date}{int(times[i]):06d}" if i < len(times) and times[i] not in ("0", "000000",
                                                                                                     "0000") else date
                            if ts in ts_to_idx:
                                try:
                                    v = float(values[i]) if values[i] else np.nan

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The quote subscription docstring claims there is no actual function, but the code registers callbacks and subscribes through the DLL, enabling ongoing external data flow into the process. While less severe than order placement, misleading documentation about active subscriptions can bypass review expectations and create hidden runtime behavior and trust-boundary issues.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The delete_sector function can remove a custom sector with no confirmation or destructive-action warning. In a tool marketed for data fetching, exposing silent deletion of user state raises the risk of accidental loss or misuse by automated workflows.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The clear_sector function can wipe a custom sector's contents without an explicit warning or approval step. This can destroy user-curated watchlist state and is especially risky when bundled inside a skill whose declared purpose does not imply destructive client mutations.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The markdown file presents all headings, parameter descriptions, and example outputs in Chinese only, including sample categorical text values such as industry/concept labels. Under the policy rule, forcing a specific language without opt-in or a documented regional justification is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The documented API performs state-changing client actions by adding or clearing stocks in user-defined sectors, which exceeds the skill's stated purpose of financial data fetching. This mismatch can mislead users or calling agents into invoking a mutating operation when they expect read-only behavior, increasing the risk of unintended portfolio/watchlist modification.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The documentation states that providing an existing block_code with an empty stock list will clear all stocks in that block, but it does not present this as a destructive action or warn users about the consequence. In an agent-driven workflow, this could lead to accidental deletion of user-maintained custom sector contents through parameter mistakes or misunderstood defaults.

Content

No source excerpt is available for this finding.