Back to skill

Security audit

Construction Safety Inspector

Security checks for vulnerabilities and agentic risk

Overview

The skill has no executable payload, but it asks the agent to persist uploaded document content into trusted reference files that can shape future safety advice.

Review before installing. Use this only if you want a Chinese construction-safety assistant that may retain lessons from uploaded safety documents. Keep packaged standards read-only or require explicit review before any learned content is saved, especially because incorrect persisted rules could affect future hazard assessments.

Vulnerability Patterns
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • 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
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
Findings (1)

T02 · Agent Memory Poisoning

Warning
Location
SKILL.md:176
Finding
Untrusted Uploaded Documents Can Poison the Persistent Reference Knowledge Base## Vulnerability Details **File Location**: `SKILL.md`, lines 176–181 **Vulnerability Type**: Persistent agent memory poisoning **Risk Level**: Medium ### Vulnerable Code Segment ```markdown ### 文件学习流程(如上传了文档) 当用户上传安全管理文件时: 1. 使用 `read` 工具读取文件内容 2. 提取关键条款、流程、规范要求 3. 更新参考知识库(写入 `references/` 目录下的相关文件) 4. 告知用户已学习并记录的内容摘要 ``` The workflow directs the agent to: 1. Read user-uploaded safety-management documents. 2. Extract requirements and procedures from them. 3. write the extracted content into files under `references/`. 4. Treat those files as a knowledge source in later analyses. ### Technical Analysis Uploaded documents are attacker-controlled input, but the skill instructs the agent to persist their extracted content in its reference knowledge base. No controls are defined for: - Authenticating the document or its publisher. - Verifying claimed standards against approved primary sources. - Distinguishing document content from embedded agent instructions. - Requiring human approval before persistence. - Recording source provenance and trust level. - Detecting conflicts with existing standards. - Isolating uploaded material from trusted packaged references. The risk is amplified by `SKILL.md`, lines 184–190, which instructs the agent to load files under `references/` during future analyses and treat their detailed clauses as more authoritative than model memory: ```markdown ## 知识参考 分析过程中,如需查阅具体标准条款,先加载参考文件: - `references/gb30871-2022.md` — GB30871-2022 核心条款 - `references/petrochem-standards.md` — 石化企业补充标准 详细条款以上述文件为准,模型记忆可能存在偏差,以文件内容为准。 ``` Consequently, untrusted material can cross a trust boundary and become persistent guidance. This is a memory-poisoning vulnerability rather than direct code execution: the package contains no executable scripts, remote payload retrieval, or shell commands. ### Attack Path 1. An attacker supplies a safety-management document containing fabricated requirements, altered thresholds, misleading procedures, or concea ...[truncated 1477 chars]
Remediation
## Remediation Suggestions 1. **Prohibit automatic modification of trusted references** - Treat packaged files under `references/` as read-only. - Do not merge uploaded content directly into authoritative standards files. 2. **Separate trusted and untrusted knowledge** - Store user-derived notes in a dedicated untrusted area outside the authoritative reference directory. - Prefer session-scoped storage unless persistence is explicitly necessary. - Ensure trusted, reviewed references always take precedence over uploaded material. 3. **Require explicit approval before persistence** - Present the extracted claims, source, and proposed destination to an authorized user. - Require affirmative approval before writing any persistent data. - Provide a clear rollback and deletion mechanism. 4. **Validate extracted claims** - Verify standards, clause numbers, thresholds, and effective dates against approved primary sources. - Reject or quarantine claims that cannot be verified. - Detect and flag conflicts with existing reviewed references. 5. **Neutralize instruction injection** - Process uploaded documents strictly as data. - Ignore document text that asks the agent to change its behavior, tools, priorities, permissions, or system instructions. - Use schema-constrained extraction limited to relevant safety facts. 6. **Preserve provenance and trust metadata** - Record the document identity, publisher, upload date, uploader, verification status, and exact source passage for every persisted claim. - Clearly label all unverified content and prevent it from being cited as authoritative. 7. **Apply least-privilege write controls** - Restrict write access to a dedicated staging file or directory. - Prevent uploaded content from selecting arbitrary paths or overwriting packaged files. - Require review before promoting staged material into the trusted knowledge base.
Vulnerability Patterns
  • 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
  • YARA SignaturesMalware Match, Webshell Match, Cryptominer Match
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (6)

YARA rule 'agent_skill_mcp_tool_poisoning_metadata': MCP/tool metadata poisoning indicators in tool schemas or skill manifests [agent_skills]

High
Category
YARA Match
Content
---
AIGC:
    ContentProducer: Minimax Agent AI
    ContentPropagator: Minimax Agent AI
    Label: AIGC
    ProduceID: f69d2d121f3b0dc574f2db468a63f125
    PropagateID: f69d2d121f3b0dc574f2db468a63f125
    ReservedCode1: 3045022100a8bb17098055b8542b7d8bf35e4360efb746f287337404c8122d827eeb63e1be022023c3987a305434d804199774b04beb4b254c1c6cb324fd49529dc8cb337cc242
    ReservedCode2: 304602210095d074d652584f32cbfd6d0d8e59d07459d398798d13c7dfc9b5a65cd57794b8022100b80337b9290e2361f6a1ac8e038442047bd0cab646e52b8c1e6f773ddcb9c5b0
description: 施工作业安全督察专家技能。当用户上传施工作业现场图片,要求分析安全隐患、提出整改建议时激活。触发词:安全检查、安全隐患分析、施工现场、特殊作业(动火/高处/受限空间/临时用电/吊装/盲板抽堵/动�
Confidence
80% confidence
Finding
YARA rule matched a hack tool or exploit indicator (offensive tools, reconnaissance, privilege escalation, or exploit frameworks).

Description-Behavior Mismatch

Medium
Confidence
91% confidence
Finding
The skill’s stated purpose is image-based construction safety inspection, but the workflow also allows uploaded safety documents to be ingested for 'learning' and persisted into a knowledge base. This expands the skill from bounded analysis into state-changing document ingestion, increasing attack surface for prompt/data poisoning and unauthorized persistence beyond what a user would reasonably expect from the description.

Vague Triggers

Medium
Confidence
93% confidence
Finding
The trigger terms are broad enough to activate on common construction and safety-related mentions, including generic references to documents for learning. Over-broad activation can cause the skill to run in contexts where users did not intend file analysis or knowledge ingestion, increasing the chance of unintended tool use and exposure to adversarial inputs.

Context-Inappropriate Capability

Medium
Confidence
94% confidence
Finding
The documented instruction to update a local knowledge base under references/ is a state-changing capability not necessary for one-off safety inspection of uploaded images. If exploited, malicious or misleading document content could be persisted and later influence future analyses, creating a durable prompt/data poisoning path.

Missing User Warnings

Medium
Confidence
96% confidence
Finding
The skill instructs writing learned content from uploaded documents into the references directory without warning the user that local files will be modified. Silent persistence of untrusted content is dangerous because it can alter future model behavior, contaminate trusted references, and violate user expectations about side effects.

Natural-Language Policy Violations

Low
Confidence
93% confidence
Finding
This markdown file uses only Chinese-language headings and content, which can constitute a language/locale policy issue when no user opt-in or justification is provided. The file does not indicate that the skill is region-specific or that users may choose another language.

Static analysis

No suspicious patterns detected.