Back to skill

Security audit

lawyer-assistant

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly a coherent Chinese legal-assistant package, but it needs review because it handles sensitive legal documents and personal data while under-disclosing web-query, file-output, and instruction-scope risks.

Install only if you are comfortable using it for Chinese legal workflows and can control what matter details are sent to web search/fetch tools. Redact unnecessary personal, bank, client, and opponent information before OCR or web verification, choose OCR output paths deliberately, and treat its legal drafts as attorney-review aids rather than final legal advice.

Vulnerability Patterns
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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)

T01 · Skill Instruction Hijacking

Error
Location
SKILL.md:13
Finding

Skill Declares Its Instructions to Be Non-Overridable

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 13-15
Vulnerability Type: Session-level instruction precedence manipulation
Risk Level: High

Vulnerable Code Snippet:

markdown
## 核心原则:防虚构协议(ABSOLUTE PRIORITY)

**此为最高优先级规则,贯穿所有工作流程,不可覆盖。**

Technical Analysis

The Skill labels its anti-fabrication protocol as having “ABSOLUTE PRIORITY” and states that it cannot be overridden. Although citation verification is a legitimate legal-research safeguard, a Skill must not assign its own instructions precedence over system, developer, safety, or subsequent user instructions.

If an agent interprets this statement literally, loading the Skill can modify instruction resolution for the current session. The problem is the claimed precedence, not the underlying requirement to verify legal sources.

Attack Path

  1. A legal request triggers and loads the Skill.
  2. The agent parses the Skill text as operational instructions.
  3. The “ABSOLUTE PRIORITY” and non-overridable language is interpreted as globally authoritative.
  4. A later legitimate instruction conflicts with the Skill's protocol.
  5. The agent may incorrectly preserve the Skill instruction instead of applying the actual instruction hierarchy.

No payload execution or operating-system privilege escalation is required for this path.

Impact Assessment

The issue affects the agent's current-session behavior and instruction hierarchy. It could cause legitimate higher-priority constraints, user requirements, or interoperability rules from other Skills to be displaced.

It does not directly grant filesystem, network, operating-system, or persistent-memory privileges. No mechanism was found that writes this directive into long-term agent memory.

Remediation
View remediation

Remediation Suggestions

  1. Remove “ABSOLUTE PRIORITY,” “highest priority,” and “cannot be overridden” language.

  2. Explicitly scope the protocol to legal-analysis tasks.

  3. State that the protocol remains subordinate to system, developer, safety, and user instructions.

  4. Use wording such as:

    markdown
    When performing legal research, verify citations using authoritative sources when appropriate and when retrieval tools are available. Follow all higher-priority instructions, applicable safety requirements, and the user's requested scope.
    
  5. Add conflict handling that asks for clarification or reports an inability to verify a citation rather than attempting to override other instructions.

T08 · Insecure Dependencies

Warning
Location
scripts/ocr_evidence.py:42
Finding

Unpinned Third-Party Dependency Installation Guidance

Content
View full analysis

Vulnerability Details

File Location: scripts/ocr_evidence.py, lines 42-47
Vulnerability Type: Unpinned package and privileged system installation guidance
Risk Level: Medium

Vulnerable Code Snippet:

python
if missing:
    print("缺少依赖包,请安装:")
    print(f"  pip install {' '.join(missing)}")
    print("系统还需安装 tesseract-ocr:")
    print("  Ubuntu/Debian: sudo apt install tesseract-ocr tesseract-ocr-chi-sim")
    print("  macOS: brew install tesseract tesseract-lang")
    print("  Windows: 从 https://github.com/UB-Mannheim/tesseract/wiki 下载安装")

The related dependency declaration is also unpinned:

python
pip install pytesseract Pillow pdf2image

Technical Analysis

The script recommends installing mutable package names without exact versions, integrity hashes, or a lock file. Package resolution therefore depends on the state of the configured package index at installation time.

The named Python packages are established packages, and the reviewed project does not contain evidence that they are currently malicious. Nevertheless, unpinned installation permits a future compromised release, repository substitution, or incompatible update to enter the environment without a reproducible review boundary.

The script also displays a sudo apt install command. It does not execute this command automatically, but a user who follows the guidance may perform a privileged installation.

Attack Path

  1. The OCR script detects that one or more dependencies are absent.
  2. It displays an unpinned pip install command.
  3. A user manually runs the suggested command.
  4. The package manager resolves the latest package versions from the user's configured index or mirror.
  5. If that source or a resolved release has been compromised, malicious package installation or import-time code executes with the invoking user's privileges.
  6. If privileged system installation guidance is followed, pac ...[truncated 768 chars]
Remediation
View remediation

Remediation Suggestions

  1. Add a reviewed dependency lock file with exact versions.

  2. Pin Python dependencies and require integrity hashes, for example:

    text
    pytesseract==REVIEWED_VERSION --hash=sha256:REVIEWED_HASH
    Pillow==REVIEWED_VERSION --hash=sha256:REVIEWED_HASH
    pdf2image==REVIEWED_VERSION --hash=sha256:REVIEWED_HASH
    
  3. Install dependencies in an isolated virtual environment using:

    bash
    python -m pip install --require-hashes -r requirements.txt
    
  4. Document the trusted package index and prevent unexpected fallback to untrusted mirrors.

  5. Pin or document reviewed operating-system package versions where the platform permits it.

  6. Avoid presenting privileged installation as the default. Explain why elevated access is required and instruct users to verify packages through their operating system's trusted repository.

  7. Add dependency scanning and scheduled review of pinned releases.

Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • 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
Findings (27)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The skill claims broad legal-research, case-verification, strategy, drafting, and due-diligence capabilities, but the described executable capability is limited to local OCR. This mismatch can mislead users into trusting unsupported functions, especially the promised source verification workflow, resulting in fabricated, unverified, or incomplete legal output in high-stakes matters.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
75% confidence
Finding

The skill references a local script that can write output files, yet the manifest does not declare any tool scope or allowed-tools boundaries. This creates an authorization ambiguity where file-writing behavior may occur without explicit permission review, which is risky in an environment handling sensitive legal materials.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trigger description is extremely broad and overlaps with many ordinary legal or adjacent conversations, making accidental activation likely. In a legal workflow, over-triggering can expose sensitive client facts to an overly powerful or inappropriate skill path and may initiate unnecessary OCR or external lookup behavior without clear user intent.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The workflow requires web search and page fetching for legal and case-source verification but does not inform users that queries and retrieved content may be transmitted to external services. Because legal queries often reveal confidential strategy, party names, dispute facts, or case posture, undisclosed network transmission can create serious confidentiality and privacy exposure.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The skill processes local evidence files via OCR but does not warn users that those files may contain highly sensitive personal, financial, medical, or privileged legal information. In the legal context, lack of disclosure and consent around sensitive-document handling materially increases privacy, confidentiality, and professional-compliance risk.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The documentation instructs operators to run a local Python script on user-supplied files, expanding the skill from advisory behavior into code execution. In a legal-assistant context, this is dangerous because uploaded evidence may be highly sensitive, and local script execution increases the attack surface for unsafe file handling, unintended writes, or environment abuse.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The example triggers are broad, natural-language requests that overlap with common user intents such as asking for legal help, contract review, or enforcement steps. In an agent-routing system, this can cause the skill to activate too often and capture conversations beyond narrow user intent, increasing the chance of unnecessary data exposure or inappropriate automated legal guidance in sensitive matters.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The metadata is Chinese-only for examples and description, which can bias routing and interaction toward Chinese without explicit user preference. While not directly a code-execution risk, this can create consent and usability issues, especially in legal contexts where language precision matters and users may misunderstand advice if the system switches languages unexpectedly.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

The entire skill file is written as a Chinese-only template, including headings, placeholders, and date formatting, with no indication that users may choose another language or that the skill is intentionally restricted to a Chinese legal-practice context. Under the stated policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale restriction is explicit and justified.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The template explicitly solicits highly sensitive personal data such as身份证号/统一社会信用代码 and contact details, but provides no minimization guidance, masking requirement, storage warning, or consent/handling notice. In a legal-assistance context this materially increases privacy, compliance, and misuse risk because users may paste real client/opponent PII into generated artifacts that could be retained, shared, or exposed.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The entire template is written in Chinese and provides no indication that another language can be used or that Chinese is required for a region-specific compliance purpose. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The trigger phrase at line 38 is broad enough to match common legal-information requests and may activate the skill in situations where the user did not explicitly intend to invoke this specific capability. In a legal assistant context, unintended activation is more sensitive than usual because the skill may steer high-stakes advice, evidence analysis, or drafting workflows based on partial context.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The trigger phrase at line 39 lacks specificity and could be activated by ordinary discussion of injuries or disputes, causing the legal skill to take over unexpectedly. Because this skill handles criminal and civil legal scenarios, accidental activation can expose users to mis-scoped legal guidance, privacy-sensitive processing, or workflow transitions they did not intentionally request.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This markdown file contains all instructions and required disclaimer text exclusively in Chinese, which effectively forces a specific language on users. The policy allows locale constraints only when the skill offers user choice or clearly documents a justified region-specific limitation, neither of which appears here.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

This markdown file contains user-facing instructional content exclusively in Chinese, and it does not indicate that the language is optional, user-selected, or limited to a China-specific audience. Under the policy, forcing a specific language without user opt-in is a natural-language locale violation.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The due-diligence section instructs collection and review of sensitive corporate and personal data, including employee, litigation, tax, and asset information, but provides no confidentiality, minimization, consent, retention, or secure-handling guidance. In a legal-assistant skill, this omission can lead users to paste highly sensitive material into the system without safeguards, increasing privacy, professional-confidentiality, and compliance risk.

Content

No source excerpt is available for this finding.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · scripts/ocr_evidence.py (reported line 45)May include surrounding context.

python
print("缺少依赖包,请安装:")
        print(f"  pip install {' '.join(missing)}")
        print("系统还需安装 tesseract-ocr:")
        print("  Ubuntu/Debian: sudo apt install tesseract-ocr tesseract-ocr-chi-sim")
        print("  macOS: brew install tesseract tesseract-lang")
        print("  Windows: 从 https://github.com/UB-Mannheim/tesseract/wiki 下载安装")
        return False

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

This code writes OCR results to an arbitrary output file, and the script can also extract身份证号, 电话号码, and 银行账号 from evidence documents. While the script logs that it saved the file, there is no warning in code comments, help text, or user-facing output that the saved result may contain sensitive personal data and should be handled carefully.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

Requesting opposing party asset clues, preservation recommendations, and execution-risk details can involve sensitive financial intelligence and litigation tactics, yet the template gives no caution about legality, proportionality, source reliability, or confidentiality. In a lawyer-assistant skill, this could facilitate over-collection of sensitive third-party information or encourage inclusion of unverified asset data in ways that create privacy, abuse, or procedural risks.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
91% confidence
Finding

This SVG includes natural-language metadata only in Chinese in the and <desc> fields. Because SQP-3 applies to all file types and covers language/locale policy violations, this can be considered a forced locale with no opt-in or justification visible in the file.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

This markdown template presents all headings, instructions, and disclaimer text exclusively in Chinese, which can constitute a language/locale policy issue if the organization expects user choice or opt-in for language. There is no indication that the template is region-specific or that alternative languages are available.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
91% confidence
Finding

SQP-3 applies to all file types and covers language or locale policy violations. This skill content forces a specific language presentation without user opt-in or an explicit statement that the material is intended only for Chinese-speaking or PRC-law contexts.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

SQP-3 applies to all file types and covers natural-language policy violations such as forcing a specific language without user opt-in. This markdown file presents all guidance exclusively in Chinese and does not mention any language selection, translation option, or justified region-specific restriction.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

This markdown skill file presents all instructions, templates, and examples exclusively in Chinese, with no indication that users may request another language. Under the policy rule for language or locale constraints, forcing a single language without opt-in can be 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
91% confidence
Finding

This markdown file presents all instructions exclusively in Chinese, and there is no indication that users may choose another language or that the skill is intentionally limited to a Chinese-language audience. Under the policy rule for natural-language violations, forcing a specific language without opt-in is reportable.

Content

No source excerpt is available for this finding.