Back to skill

Security audit

跨境多国税务速查

Security checks for vulnerabilities and agentic risk

Overview

This looks like a real tax report generator, but it should be reviewed because it can auto-trigger broadly and writes persistent HTML reports containing unescaped user input.

Install only if you are comfortable with a Chinese-language tax lookup skill that may activate on broad tax terms and saves HTML reports in your home directory. Treat the tax data as reference material, not professional advice, and avoid running it on queries supplied by untrusted parties until the HTML escaping issue is fixed.

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 (1)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/cross_border_tax.py:1007
Finding

HTML Injection in Generated Report Title

Content
View full analysis

Vulnerability Details

File Location: scripts/cross_border_tax.py, lines 1007 and 1064; input and output flow at lines 1166 and 1207–1210
Vulnerability Type: Unescaped user input in generated HTML
Risk Level: Medium

Vulnerable Code

python
query = result.get("query", "")

title = f"跨境税务速查 · {query[:30]}"
if not query:
    title = "跨境多国税务速查报告"
html
<title>{title}</title>

The relevant input and output flow is:

python
query = sys.argv[1]

# Parse query
result = parse_query(query)
result["query"] = query

# Generate HTML
html = build_html(result)

safe_name = re.sub(r'[^\w\-]', '_', query)[:40] or "tax_report"
output_path = os.path.join(output_dir, f"{safe_name}.html")
with open(output_path, "w", encoding="utf-8") as f:
    f.write(html)

Technical Analysis

The command-line query is attacker-controlled and is copied into the HTML document's <title> element without context-appropriate escaping. The filename sanitization only affects output_path; it does not sanitize the HTML content.

An input containing a closing </title> sequence can terminate the title element and inject additional HTML markup. Browser-executable markup may consequently run when a user opens the generated report. The 30-character truncation reduces payload length but does not prevent injection because short breakout payloads and externally referenced browser behaviors may still fit within that limit.

The generated reports do not define a Content Security Policy that would otherwise limit injected active content.

Attack Path

  1. An attacker supplies, or persuades a user or Agent to submit, a crafted tax query containing HTML metacharacters and a </title> breakout sequence.
  2. main() reads the query from sys.argv[1].
  3. The query is stored in result["query"] and passed to build_html().
  4. build_html() interpolates the first 30 characters directly into title.
  5. The value is inserted verbatim into the document's <title> el ...[truncated 816 chars]
Remediation
View remediation

Remediation Suggestions

  1. Escape the query before placing it into HTML:
python
import html

query = result.get("query", "")
safe_query = html.escape(query[:30], quote=True)
title = f"Cross-Border Tax Quick Lookup · {safe_query}"
  1. Prefer a templating engine with automatic HTML escaping rather than constructing documents through unrestricted f-string interpolation.

  2. Apply context-specific escaping to every dynamic value inserted into HTML, including future database content or user-provided fields. Filename sanitization must remain separate from HTML escaping.

  3. Add a restrictive Content Security Policy, such as:

html
<meta http-equiv="Content-Security-Policy"
      content="default-src 'none'; style-src 'unsafe-inline'; img-src 'self' data:">

Adjust the policy only for resources that the report legitimately requires.

  1. Add regression tests using inputs containing characters and sequences such as:
text
</title>
<script>
<img onerror=...>
&amp;
&lt;
&quot;

The tests should confirm that these values appear only as encoded text and cannot create new DOM elements or event handlers.

Vulnerability Patterns
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • 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
Findings (15)

Tp2

High
Category
MCP Tool Poisoning
Confidence
85% confidence
Finding

Mixing characters from multiple Unicode scripts in a single identifier is a common technique to create visually ambiguous tool names.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trigger list contains broad generic terms like 'tax', 'vat', '税务', and '税率', which can cause the skill to activate during ordinary conversation unrelated to an explicit user request to use this tool. In an agent environment with WebSearch, WebFetch, Bash, and Write permissions, over-triggering increases the chance of unnecessary tool invocation, unintended data handling, or confusing/unwanted agent behavior.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The document declares lang="zh-CN", and the visible content is entirely in Chinese, which imposes a specific language/locale on users. The file does not indicate that the skill is region-specific, nor does it offer an alternative language or opt-in choice.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This code's user-facing description and examples are entirely in Chinese, and later output is explicitly marked as zh-CN HTML. For an all-purpose tax lookup skill, forcing a specific language/locale without user opt-in is a natural-language policy issue under the locale-choice rule.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The HTML report explicitly sets lang="zh-CN", while all headings, labels, and guidance are rendered in Chinese. This enforces a locale choice on all users rather than offering selection or clearly limiting the tool to a justified region-specific audience.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
85% confidence
Finding

The skill persists user queries and generated tax reports under a stable directory in the user's home folder. In skill/agent environments, queries may contain sensitive business details, and persistent storage can expose that data to other local users, future sessions, backup systems, or unrelated tools that read the workspace.

Content

Scanner excerpt · scripts/cross_border_tax.py (reported line 1204)May include surrounding context.

python
# Generate HTML
    html = build_html(result)

    # Write to output
    output_dir = os.path.expanduser("~/.workbuddy/skills/cross-border-tax/output")
    os.makedirs(output_dir, exist_ok=True)
    safe_name = re.sub(r'[^\w\-]', '_', query)[:40] or "tax_report"

Overly Broad Trigger

Low
Category
Trigger Abuse
Confidence
92% confidence
Finding

The trigger '税率' is extremely short and generic, so it may match many benign conversations about pricing, accounting, or news and invoke the skill unintentionally. While the skill's subject matter is legitimate, accidental activation becomes riskier because the skill is allowed to use network and filesystem-related tools.

Content

No source excerpt is available for this finding.

Overly Broad Trigger

Low
Category
Trigger Abuse
Confidence
92% confidence
Finding

The trigger '税务' is overly broad and can collide with a wide range of ordinary discussion about taxes, compliance, or business operations, causing unintended activation. In this skill context, the danger is not malicious content but excessive scope and ambiguous matching that can lead the agent to invoke tools unnecessarily.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
92% confidence
Finding

The document declares lang="zh-CN", and the visible content is entirely presented in Simplified Chinese, which imposes a specific language/locale. The file does not offer any user language choice or explain that the content is intended only for a China-specific audience, so this is a natural-language locale policy concern.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
96% confidence
Finding

The document sets lang="zh-CN", which establishes a specific language/locale for the skill content. Under the policy, forcing a locale without user opt-in or a documented justification is a natural-language policy concern.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
85% confidence
Finding

The document declares lang="zh-CN", and all visible instructional content is presented only in Chinese. Under the policy rule for natural-language violations, this is a locale restriction without any visible opt-in, fallback, or explanation that the skill is intentionally limited to a Chinese-speaking audience.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

The document declares lang="zh-CN", which imposes a specific language/locale on all users. Under the policy, locale restrictions should either be optional for the user or clearly justified as region-specific; this file provides neither.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

This file sets the page language to zh-CN, and the visible content is entirely in Chinese, which imposes a specific language/locale on users. Under the policy rule, locale-specific behavior should either be optional or clearly justified as region-specific.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

The query parser is documented as extracting intent and countries from natural-language input, and lines L0780-L0783 explicitly introduce a fuzzy-match fallback path. In reality that branch is a no-op (pass), so the implementation does not provide the implied recovery behavior for unrecognized country names.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Low
Category
Not specified by scanner
Confidence
80% confidence
Finding

The manifest describes a tax lookup skill that answers country tax questions and generates HTML reports. In generate_country_card, the code constructs remote flagcdn.com image URLs, introducing an external-resource loading behavior unrelated to the tax-lookup function itself and not otherwise surfaced in the description.

Content

No source excerpt is available for this finding.