Back to skill

Security audit

Baozheng Skills

Security checks for vulnerabilities and agentic risk

Overview

The skill appears to be a legitimate China-law assistant, but it has review-worthy risks around overbroad activation, automatic dependency installation, unsafe network/cache handling, and a serious legal deadline calculation bug.

Review before installing. Use it only in an isolated environment, require confirmation before dependency installation, avoid entering unnecessary ID numbers or financial account details, independently verify legal deadlines and statutes, and treat generated documents as drafts for lawyer review.

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

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/flk_npc_client.py:383
Finding

Unvalidated Server-Supplied Download URL Permits Requests to Arbitrary Destinations

Content
View full analysis
str: try: data = self._request( "GET", "/law-search/download/pc", params={"format": fmt, "bbbs": bbbs, "fileId": ""}, ) inner = data.get("data", data) if isinstance(inner, dict): return inner.get("url", "") return str(inner) if inner else "" except Exception: return "" def download_file(self, bbbs: str, save_path: str, fmt: str = "docx") -> str: dl_url = self.get_download_url(bbbs, fmt) if not dl_url: raise RuntimeError(f"Failed to obtain download URL for bbbs={bbbs}") resp = requests.get(dl_url, timeout=60) resp.raise_for_status() with open(save_path, "wb") as f: f.write(resp.content) return save_path ``` ### Technical Analysis The download URL returned by the remote API is passed directly to `requests.get()` without validating its scheme, hostname, port, resolved IP address, or redirect destination. Because `requests` follows redirects by default, validating only the initial API endpoint does not constrain the second request. If the API response is compromised, spoofed through an upstream failure, or made to return an unsafe redirect, the client could request an arbitrary Internet or internal-network resource. The response is accessed through `resp.content`, which buffers the entire body in memory, and is then written without a maximum size, content-type check, or file-signature validation. When the requested format is DOCX, the resulting file may subsequently be parsed by `python-docx`. Consequently, untrusted remote content reaches a document parser without prior structural validation. This behavior does not estab ...[truncated 1702 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/flk_npc_client.py:446
Finding

Predictable Shared Temporary Cache Allows Path Traversal, Symlink Attacks, and Cache Poisoning

Content
View full analysis
str: cache_dir = os.path.join(tempfile.gettempdir(), "flk_npc_cache") os.makedirs(cache_dir, exist_ok=True) return cache_dir def _get_docx_cache_path(self, bbbs: str) -> str: return os.path.join(self._get_cache_dir(), f"{bbbs}.docx") def _ensure_docx_cached(self, bbbs: str, force: bool = False) -> str: cache_path = self._get_docx_cache_path(bbbs) if not force and os.path.exists(cache_path) and os.path.getsize(cache_path) > 0: return cache_path return self.download_file(bbbs, cache_path, "docx") ``` ### Technical Analysis The cache directory has a fixed, predictable name beneath the system-wide temporary directory. The code does not explicitly enforce private permissions or verify the ownership and type of an existing directory. The API-provided `bbbs` identifier is inserted directly into the filename. No character allowlist, length restriction, canonicalization, or resolved-path containment check is applied. If an identifier contains path separators or traversal components, the resulting path can resolve outside the intended cache directory. The cache check trusts any existing nonempty path. It does not reject symbolic links, verify ownership, validate the DOCX format, compare the cached file with expected metadata, or ensure that the file was created by this process. On a shared system, another local process may pre-create a poisoned cache entry. If a symbolic link is present and a download is forced, the ordinary `open(save_path, "wb")` call in `download_file()` follows the link. The check and subsequent use are also separate operations, leaving a time-of-check/time-of-use race. ### Attack Path #### Cache-poisoning path 1. A local attacker predicts the cache directory ...[truncated 1841 chars]
Remediation
View remediation

T08 · Insecure Dependencies

Note
Location
requirements.txt:4
Finding

Automatic Installation Uses Broad, Unhashed Dependency Constraints

Content
View full analysis
=2.25.0 python-docx>=0.8.11 ``` `SKILL.md`: ```bash pip install -r requirements.txt ``` The Skill instructions state that missing packages are detected and installed on first activation. ### Technical Analysis Both dependencies use open-ended minimum-version constraints. There is no lock file, exact version pinning, package hash verification, transitive dependency lock, or controlled package-index requirement. As a result, installation can resolve to package versions that were not reviewed with the Skill. A future compromised release, compromised transitive dependency, unexpected compatibility change, or package-index compromise could introduce code that executes during installation or import. The package names are legitimate and consistent with the declared functionality. No typosquatting, dependency-confusion package name, malicious index, or known embedded payload was identified in the audited project. The finding is therefore a supply-chain hardening weakness rather than evidence that the current dependencies are malicious. ### Attack Path 1. The Skill activates in an environment where one or both dependencies are missing. 2. The automatic installation command queries the configured Python package index. 3. The resolver selects the latest versions satisfying the broad minimum constraints, including transitive dependencies. 4. Package installation and later imports execute code that was not pinned to the audited dependency set. 5. If the selected package, release artifact, index, or transitive dependency is compromised, that code runs with the privileges of the installation process or Skill host. ### Impact Assessment A compromised dependency could execute Python code wi ...[truncated 448 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • System Prompt LeakageDirect Leakage, Indirect Extraction, Tool-Based Exfiltration
  • 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 (136)

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

声明描述的是一个复杂的法律服务平台/编排型技能,核心在法律咨询、文书起草、法规检索和意图路由。提供的代码却仅是“damage_calculator.py”赔偿计算引擎,范围狭窄且偏工具函数性质。虽然代码属于法律领域,并且可作为起诉状金额字段的辅助组件,但它只覆盖5类赔偿金额测算,无法支撑声明中的平台级主要用途。代码也没有任何网络访问、外部法规 API 检索、模板管理、刑事文书辅助、会话状态机、路由矩阵或故障熔断实现。因此描述与实际行为存在明显且实质性的功能不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

代码的核心功能非常聚焦:它是一个针对 flk.npc.gov.cn 的法规检索与正文提取客户端。虽然声明中提到“flk.npc.gov.cn API实时法条优先”这一点与代码相符,但其余大部分高层业务能力——法律咨询、文书起草、刑事材料辅助、任务编排、意图收敛、模板系统、时效追踪、逻辑审查等——在该代码片段中均没有体现。代码中只有常规的网络重试、限流、下载、缓存和 DOCX 解析,这些不能等同于声明中的综合法律服务平台能力。因此,描述显著夸大并偏离了该代码块的实际行为。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

声明描述的是一个功能非常广的法律服务平台/智能体,而代码块仅实现了单一文档生成工具。它从本地 assets/references 目录发现模板,解析 Markdown 字段,按输入JSON填充,最后生成 .docx 或输出摘要/模板列表。虽然这与“起诉状起草/刑事专项材料辅助”的一小部分相关,但远不足以支撑声明中的核心能力,尤其是法律咨询、法规实时检索、复杂路由、自检、时效追踪、熔断和多任务拆解等。此外,代码没有任何网络访问或 API 调用,和“flk.npc.gov.cn API实时法条优先”明显不符。因此描述与实际行为存在重大不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

声明描述的是一个覆盖咨询、文书起草、刑事材料辅助、路由编排与多种流程控制的综合法律服务平台;而给出的代码块只是一个相对独立的“法条检索”模块。它确实与声明中的“flk.npc.gov.cn API实时法条优先,不可用时AI知识库降级兜底”以及“连续失败熔断”部分相符,但仅覆盖了整体宣称能力中的一小部分。代码没有显示任何咨询对话、起诉状模板生成、刑事材料生成、意图状态机、任务拆解、诉讼时效计算或领域路由矩阵等核心平台功能。因此,若将这段代码视为对所宣称技能描述的实现,描述明显夸大了实际行为,构成不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

声明描述的是一个复杂的综合法律服务平台,而提供的代码块只是其中很窄的一项子功能——诉讼时效计算/预警。虽然声明中提到“诉讼时效追踪”,这与代码部分吻合,但代码没有体现该平台的大部分核心宣称能力,且也没有任何外部法规API访问、文书起草、咨询推理、任务路由或容错编排逻辑。因此描述与代码实际行为存在明显的范围和主功能不一致,属于实质性不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

声明描述的是面向终端用户的法律服务执行型技能,而给出的代码只是一个开发/质检工具脚本,用于验证项目文档中是否写明22类法律领域覆盖及相关路由标记。代码没有任何法律咨询、起诉状生成、刑事材料辅助、法规检索、外部API访问、意图路由或容错执行逻辑。其主要目的与声明的核心功能明显不一致,因此属于显著描述-行为不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

该代码的主用途非常明确:验证示例 JSON 文件质量。它读取本地 examples 数据文件,检查文件是否存在、JSON 根和 fields 结构是否正确、字段数是否不少于 5,并基于通用/案件专属关键词判断是否缺少某些内容要素。它不与用户交互,不生成任何法律文书,不提供法律咨询,不进行法规检索,也没有实现描述中提到的 API 优先/知识库降级、路由矩阵、意图状态机、任务拆解、逻辑自检、时效追踪或熔断容错等核心平台能力。虽然代码中包含 35 个左右民事模板和 5 类刑事材料对应的示例文件名/关键词规则,这只能说明它在为相关示例数据做静态质量检查,不能等同于实际提供这些法律服务。因此声明与实际行为存在明显且实质性的功能不匹配。

Content

No source excerpt is available for this finding.

Vague Triggers

High
Category
Not specified by scanner
Confidence
96% confidence
Finding

The activation logic is intentionally expansive, using long keyword lists and a mandate to 'immediately activate' the legal skill for many ordinary phrases. This can cause the assistant to over-route benign or ambiguous requests into a specialized workflow, reducing user choice, increasing the chance of incorrect jurisdictional assumptions, and enabling prompt-level hijacking of the assistant's normal routing behavior.

Content

No source excerpt is available for this finding.

Vague Triggers

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The global rule stating that any question involving Chinese law, regulations, contracts, litigation, rights protection, or disputes must activate the skill is excessively broad and ambiguous. Such a blanket requirement can override safer or more appropriate system routing, force unnecessary specialization, and mis-handle edge cases like comparative law, non-Chinese jurisdictions, translation, or general discussion.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The rule set encodes "遗赠接受" with years=60 while the description and legal rule require a 60-day period. Because the calculator interprets values >= 1 as years, it will compute an end date roughly 60 years out instead of 60 days, which can materially misstate limitation deadlines in a legal workflow and cause users to miss urgent action windows.

Content

No source excerpt is available for this finding.

Direct Prompt Extraction

High
Category
System Prompt Leakage
Confidence
85% confidence
Finding

Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.

Content

Scanner excerpt · scripts/limitation_calculator.py (reported line 231)May include surrounding context.

python
# 精确匹配
        for rule in pool:
            if rule.case_type == normalized:
                return rule

        # 模糊匹配(关键词包含)
        keywords = [normalized, normalized.replace("诉讼", "").replace("纠纷", "").replace("责任", "")]

Direct Prompt Extraction

High
Category
System Prompt Leakage
Confidence
85% confidence
Finding

Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.

Content

Scanner excerpt · scripts/limitation_calculator.py (reported line 240)May include surrounding context.

python
# 精确匹配
        for rule in pool:
            if rule.case_type == normalized:
                return rule

        # 模糊匹配(关键词包含)
        keywords = [normalized, normalized.replace("诉讼", "").replace("纠纷", "").replace("责任", "")]

Direct Prompt Extraction

High
Category
System Prompt Leakage
Confidence
85% confidence
Finding

Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.

Content

Scanner excerpt · scripts/limitation_calculator.py (reported line 242)May include surrounding context.

python
# 精确匹配
        for rule in pool:
            if rule.case_type == normalized:
                return rule

        # 模糊匹配(关键词包含)
        keywords = [normalized, normalized.replace("诉讼", "").replace("纠纷", "").replace("责任", "")]

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The code comment states that the legacy-gift acceptance period is 60 days, but the condition if rule.years < 1 can never handle the configured rule because that rule is stored as years=60. This creates dead logic for day-based periods and results in a severe legal deadline miscalculation, undermining the reliability of the calculator in a high-stakes legal service context.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The README states '向 AI 描述案情即可触发模块A', which effectively says that simply describing a situation will trigger the skill. For a markdown file, this is a vague trigger because it lacks clear scope, boundaries, or exclusion conditions, and could overlap with ordinary conversation about life events rather than an intentional request to invoke the legal skill.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The line '3轮未收敛 → 兜底 module-a A2 通用咨询' indicates that unresolved conversations default into general legal consultation. In markdown activation/routing guidance, this is ambiguous because it does not state limits or negative conditions, so unrelated or insufficiently clear user input may still be routed into the skill.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
82% confidence
Finding

The skill declares network and file-reading behavior through referenced API access, script usage, and dependency installation, but it does not declare any explicit tool scope such as allowed-tools or permissions. This creates an authorization ambiguity where a host agent may grant broader capabilities than users or reviewers expect, increasing the risk of unintended file or network access in a legal-assistant context handling sensitive data.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
85% confidence
Finding

The skill scope is defined very broadly with only minimal exclusions, covering many domains and user intents without enough negative boundaries. In a high-trust legal setting, such broad scope increases the chance of accidental invocation, incorrect jurisdictional handling, and overcollection of sensitive facts from users whose requests are only tangentially legal.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The trigger phrases include broad everyday expressions such as '怎么办', '能不能', and '告他', which can cause the skill to activate on ordinary conversation unrelated to legal work. Overbroad activation in a legal-assistant skill is risky because it may capture unrelated sensitive text, steer users into legal workflows unintentionally, or override a more appropriate safer/default assistant path.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill states that missing dependencies will be installed automatically via pip on first activation, without user confirmation or trust controls. Automatic package installation is dangerous because it introduces supply-chain risk, can execute arbitrary install-time code from dependencies, and expands runtime privileges unexpectedly in an environment that may process confidential legal information.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The file title and description require generation of a civil complaint template entirely in Chinese, and nowhere offers the user a language or locale choice. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation unless the regional constraint is clearly documented and justified.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The template solicits a large amount of personally identifiable and contact information, including ID numbers, addresses, phone numbers, dates of birth, and corporate identifiers, but provides no guidance on minimization, lawful basis, storage, retention, redaction, or secure transmission. In an AI-powered legal skill, this increases the risk of unnecessary collection, overexposure in prompts/logs, and mishandling of highly sensitive litigation data.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The template solicits a large amount of personally identifiable and contact information, including names, birth dates, addresses, phone numbers, identity-related details, and corporate registration data, but provides no privacy notice, retention limits, lawful-basis statement, or handling safeguards. In a legal-services skill, this increases the chance that users disclose sensitive case data without understanding how it will be stored, transmitted, or reused, creating privacy, compliance, and secondary-exposure risk.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The file is entirely framed as a Chinese legal pleading template and instructs the AI agent to generate a standard civil complaint from this description. There is no indication that the user can choose another language or that the Chinese-only locale is explicitly justified as a region-specific constraint, which matches the language/locale policy violation category.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The template solicits a large amount of highly sensitive personal and financial data, including identity details, contact information, addresses, account/card information, and payment default amounts, but provides no guidance on data minimization, secure handling, retention, masking, or user consent. In a legal-services skill, this increases the risk of over-collection, accidental disclosure, improper storage, and downstream privacy/compliance violations if the agent collects or reproduces this information insecurely.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.