Back to skill

Security audit

Word 打字机演示

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly a disclosed Word automation demo, but its script can silently close or erase unsaved Word documents, so users should review it before installing.

Install only if you are comfortable with Word automation that can create and save local documents. Before use, close important unsaved Word/WPS documents or change the script to always create a fresh document and never delete or close existing documents automatically.

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

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/word_demo.py:178
Finding
Unsaved Document Content Can Be Deleted Without Verifying That the Document Is Blank<![CDATA[ ## Vulnerability Details **File Location**: `scripts/word_demo.py`, lines 178-190 **Vulnerability Type**: Unsafe destructive document handling **Risk Level**: Medium ### Vulnerable Code ```python def get_or_create_doc(word): """获取或创建文档:复用第一个未保存的空白文档,否则新建""" try: if word.Documents.Count > 0: for i in range(1, word.Documents.Count + 1): doc = word.Documents.Item(i) if not doc.Saved: print(f'[文档] 复用已有文档: {doc.Name}') # 清除内容,准备写入新内容 try: doc.Content.Delete() except: pass return doc except: pass return word.Documents.Add() ``` ### Technical Analysis The function is documented as reusing an unsaved **blank** document, but the only eligibility check is `not doc.Saved`. An unsaved document is not necessarily empty: it may contain newly created or modified user content. Once such a document is selected, `doc.Content.Delete()` removes its entire contents without verifying that the document is blank and without requesting user confirmation. Broad exception handlers suppress errors, making destructive or partially failed operations less visible. The script uses `DispatchEx("Word.Application")`, which normally creates a separate Word instance and reduces exposure to documents in an existing user-controlled Word instance. However, the helper does not enforce that assumption. If the automation instance contains a non-empty unsaved document, the deletion still occurs. ### Attack Path 1. A non-empty unsaved document becomes available through the Word COM instance used by the script. 2. `get_or_create_doc()` enumerates the documents in that instance. 3. The function treats the document as reusable solely because `doc.Saved` is false. 4. `doc.Content.Delete()` deletes all existing document content. 5. The typewriter process writes generated ...[truncated 684 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Prefer creating a new document unconditionally: ```python def get_or_create_doc(word): return word.Documents.Add() ``` 2. If document reuse is required, verify that the candidate is genuinely blank before deleting or modifying it. Account for Word's terminal paragraph marker: ```python def is_blank_document(doc): text = doc.Content.Text return text in ("", "\r", "\r\n", "\x07", "\r\x07") def get_or_create_doc(word): for i in range(1, word.Documents.Count + 1): doc = word.Documents.Item(i) if not doc.Saved and is_blank_document(doc): return doc return word.Documents.Add() ``` 3. Never call `doc.Content.Delete()` on a non-empty document without explicit user confirmation. 4. Track whether the script created the document. During cleanup, only close documents owned by the script. 5. Replace bare `except:` handlers with specific exception handling and clear error reporting so destructive-operation failures are not silently suppressed. 6. Before closing with `SaveChanges=False`, verify that the document is the script-created output and that any requested save operation completed successfully. ]]>

T08 · Insecure Dependencies

Note
Location
SKILL.md:109
Finding
Unpinned Third-Party Dependency Installation<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 109-110 **Vulnerability Type**: Unpinned third-party dependency **Risk Level**: Low ### Vulnerable Code ```markdown - Windows 系统 - Microsoft Word 或 WPS Writer - Python + pywin32 (`python -m pip install pywin32`) ``` ### Technical Analysis The documented installation command installs `pywin32` without a version constraint or integrity hash. Consequently, the installed artifact depends on the package version and index configuration available at installation time. The dependency name matches the library imported by the script, and the documentation does not direct users to an obviously suspicious package source. Therefore, this is not evidence that a malicious dependency is currently present. The risk arises from non-reproducible dependency resolution and implicit trust in the configured package index and latest package release. ### Attack Path 1. A user follows the documented `python -m pip install pywin32` command. 2. pip contacts the package index configured in the user's environment. 3. pip resolves the latest compatible `pywin32` package rather than a specifically reviewed release. 4. If the configured index, resolved release, or upstream distribution is compromised, package installation or import-time code runs with the installing user's privileges. 5. A future incompatible release could also alter or break the Skill's Word automation behavior. ### Impact Assessment A compromised dependency could execute code with the privileges of the user running pip or the Skill. This could theoretically expose files and credentials available to that user or alter system state. No current package compromise, dependency confusion, typosquatting, or malicious package source was identified during this audit. The confirmed issue is the absence of version and integrity controls, so the assessed risk is Low. ]]>
Remediation
<![CDATA[ ## Remediation Suggestions 1. Pin `pywin32` to a reviewed, compatible version in a dependency file: ```text pywin32==<reviewed-version> ``` 2. Generate and verify cryptographic hashes for deployment dependencies: ```text pywin32==<reviewed-version> \ --hash=sha256:<verified-distribution-hash> ``` 3. Install with hash enforcement: ```bash python -m pip install --require-hashes -r requirements.txt ``` 4. Document that dependencies should be obtained from the official Python Package Index or a trusted internal mirror. 5. Review and deliberately update the pinned version on a scheduled basis rather than automatically consuming the newest release. 6. Consider using an isolated virtual environment so the Skill's dependency does not modify unrelated Python environments. ]]>
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • 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 (16)

Missing User Warnings

High
Confidence
97% confidence
Finding
This scenario instructs the agent to search the user's computer and send located files over QQ/WeChat with no verification of file sensitivity, recipient identity, or user confirmation before exfiltration. Because the skill context is cross-device file retrieval, the vague request pattern materially increases the chance of disclosing confidential or unrelated files.

Missing User Warnings

High
Confidence
98% confidence
Finding
The workflow directs the agent to read departmental emails, summarize them, write reports, and send the result externally, all without privacy warnings, access limits, or approval checkpoints. This exposes potentially sensitive organizational communications and creates a clear path for unauthorized disclosure or mishandling of business data.

Description-Behavior Mismatch

High
Confidence
98% confidence
Finding
The script goes beyond creating a demo document: it enumerates documents, closes some unsaved ones, and may reuse an unsaved document by deleting its content. That creates a real risk of unintended data loss to user work, which is dangerous for a skill presented as a benign Word typewriter demo.

Context-Inappropriate Capability

High
Confidence
99% confidence
Finding
The code reuses the first unsaved document it finds and calls doc.Content.Delete(), which can erase existing unsaved content without consent. Even if intended to target a blank document, the predicate is too broad because it keys on Saved state rather than proving the document is empty and script-owned.

Missing User Warnings

High
Confidence
99% confidence
Finding
The script overwrites an unsaved document's contents without warning, confirmation, or ownership validation. In a demo/automation context, this can silently destroy user drafts and is especially dangerous because users would not expect a typing demo to repurpose existing work.

Lp3

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding
The skill advertises behavior that reads a user-supplied local file but does not declare any explicit tool scope or permissions boundary. That omission can cause users or orchestrators to underestimate the skill's access to local data and weakens least-privilege controls around file access.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
This skill is designed to drive Word/WPS and type into the active document, which can modify or overwrite user content if an existing document is open. Failing to warn about active document manipulation creates a real integrity risk because users may run it without understanding that it will change currently open local data.

Missing User Warnings

Medium
Confidence
92% confidence
Finding
The documented save behavior writes output to disk, but the skill does not clearly warn users that local files may be created or overwritten. Without that disclosure, users may unintentionally persist sensitive generated content or lose data through unexpected file writes.

Vague Triggers

Medium
Confidence
91% confidence
Finding
This plain-text file describes invoking the skill by simply sending an instruction, which is overly broad and overlaps with ordinary conversation. The document does not define specific trigger phrases, scope limits, or exclusion conditions, so it is unclear when the skill should activate versus ignore a message.

Vague Triggers

Medium
Confidence
94% confidence
Finding
The file repeatedly states that the user can send a message to make the assistant write code, run it, or operate a browser, but it does not define a precise invocation syntax. For a text skill description, this ambiguity can cause unintended invocation because common chat language may match the described trigger.

Vague Triggers

Medium
Confidence
92% confidence
Finding
The daily-report workflow is activated through generic chat instructions that grant broad access to email, local files, document generation, and outbound email sending without clear boundaries or confirmation gates. In context, this creates a realistic risk of overbroad execution from ambiguous user messages, especially because the workflow spans multiple sensitive systems.

Missing User Warnings

Medium
Confidence
91% confidence
Finding
The script closes unsaved documents it heuristically considers blank, based on localized filename patterns and Saved state, without prior disclosure. Heuristic identification can be wrong, and closing unsaved documents is a data-destructive action that should not happen silently in a demo skill.

Intent-Code Divergence

Medium
Confidence
83% confidence
Finding
The comment suggests the script avoids affecting the user's environment by creating a separate Word instance, but the implementation still manipulates documents within that instance, including cleanup and reuse logic. This mismatch increases operator trust and reduces scrutiny, making the destructive behavior more risky in practice.

Natural-Language Policy Violations

Low
Confidence
88% confidence
Finding
This instruction forces reports into a specific Chinese government document format, which is a locale-specific requirement. The file does not indicate that this format is optional, user-selected, or limited to a justified region-specific use case.

Natural-Language Policy Violations

Low
Confidence
87% confidence
Finding
This JSON config repeatedly hard-codes the font to "微软雅黑", which imposes a specific locale-dependent presentation choice. Under the policy, language or locale constraints should either be user-selectable or clearly justified as region-specific; no such opt-in or justification appears in this file.

Vague Triggers

Low
Confidence
84% confidence
Finding
This manifest description explains what the skill does but does not define any specific trigger phrases, invocation conditions, or exclusion scope. In a manifest file, such broad wording can make it unclear when the skill should activate versus when general Word-related requests should not invoke it.

Static analysis

No suspicious patterns detected.