Back to skill

Security audit

工资审核助手

Security checks for vulnerabilities and agentic risk

Overview

This payroll-audit skill is related to its stated purpose, but it overstates automation and directs sensitive payroll reports to external Feishu delivery without enough user control or safety detail.

Review carefully before installing. Treat it as a payroll checklist/report helper, not a fully automated payroll audit system. Do not let it upload reports to Feishu unless a human confirms the exact destination and data being sent, and do not open or share generated HTML from untrusted payroll inputs until output escaping 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 (2)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/generate_html_report.py:87
Finding
Stored HTML and SVG Injection in Generated Payroll Reports<![CDATA[ ## Vulnerability Details **File Location**: `scripts/generate_html_report.py:50-52, 87-120, 132-143, 152-159, 173, 241-246` **Related Data Flow**: `scripts/cross_validate.py:154, 169, 184-193` **Vulnerability Type**: Stored HTML/SVG injection caused by missing output encoding **Risk Level**: High ### Vulnerable Code The report generator inserts audit item names directly into SVG markup: ```python # Short-name label short_name = item[:4] if item else f"Item {i+1}" svg_parts.append( f'<text x="{x + bar_width}" y="{base_y + 16}" font-size="10" fill="#888" text-anchor="middle">{short_name}</text>' ) ``` It also inserts audit item names, summaries, details, priorities, and count values directly into HTML: ```python def generate_audit_cards(audit_results): """Generate audit-item status cards.""" cards = [] for r in audit_results: status = r.get("status", "unknown") status_icon = {"pass": "✅", "warning": "⚠️", "error": "❌", "unknown": "❓"}.get(status, "❓") priority = r.get("priority", "P1") priority_class = f"priority-{priority.lower().replace('(', '').replace(')', '')}" details_html = "" if r.get("details"): details_html = "<ul>" + "".join(f"<li>{d}</li>" for d in r["details"]) + "</ul>" card = f'''<details class="audit-card {priority_class}"> <summary> <div class="audit-card-header"> <span class="audit-card-title">{status_icon} {r.get("audit_item", "Unknown")}</span> <span class="badge badge-{"ok" if status == "pass" else "warn" if status == "warning" else "high"}">{status.upper()}</span> </div> </summary> <div class="audit-card-body"> <p>{r.get("summary", "")}</p> {details_html} {f"<p>Statistics: {r['counts']['total_unique']} total, {r['counts']['in_both']} matched</p>" if "counts" in r else ""} </div> </details>''' cards.append(card) return '\n'.join(cards) ``` Material names, risk descriptions, and processing-log values are similarly interpolated w ...[truncated 4592 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Escape every untrusted value before placing it in HTML or SVG: ```python from html import escape def html_text(value): return escape(str(value), quote=True) ``` Apply this function to audit item names, summaries, details, material names, risk fields, log entries, month, region, employee identifiers, and compared values. 2. Use contextual escaping: - Escape element text as HTML/XML text. - Escape attribute values with quote escaping enabled. - Do not construct CSS class names from unrestricted input. 3. Strictly allowlist enumerated fields: ```python ALLOWED_STATUS = {"pass", "warning", "error", "unknown"} ALLOWED_PRIORITY = {"P0", "P1", "P2"} ALLOWED_REGION = {"domestic", "overseas", "all"} ``` Reject or safely normalize values outside these sets. 4. Use a template engine with automatic HTML escaping enabled rather than assembling markup through formatted strings. 5. If rich text is required, sanitize it with a strict allowlist that rejects: - `script`, `iframe`, `object`, `embed`, and active SVG elements - Event-handler attributes such as `onerror` and `onclick` - `javascript:` and unsafe `data:` URLs - External resource-loading elements 6. Escape Markdown table delimiters, line breaks, and embedded HTML in `cross_validate.py`, especially for employee identifiers and imported CSV values. 7. Add regression tests covering payloads containing: - `<script>` - `<img src=x onerror=...>` - SVG closing tags - Quotes and malformed attributes - `javascript:` URLs - Markdown pipes and embedded HTML 8. Consider applying a restrictive Content Security Policy to generated reports as defense in depth, while not treating CSP as a substitute for output encoding. ]]>

other

Warning
Location
SKILL.md:211
Finding
Automatic External Transmission of Sensitive Payroll Reports Without Explicit Per-Run Consent<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:54-57, 211-224` **Related Documentation**: `rules/materials-list.md:3-15`, `README.md:105-107`, `USER-GUIDE.md:142-145` **Vulnerability Type**: Uncontrolled sensitive-data transmission and inconsistent security expectations **Risk Level**: Medium ### Vulnerable Instructions The Skill defines Feishu delivery as a standard part of the full audit: ```markdown **Output**: 1. **Markdown audit report** → Write to `templates/audit-report.md` 2. **Feishu document** → Send to the user's Feishu chat through the Feishu API 3. **HTML visualization report** → Generate at `/tmp/payroll-audit-{month}.html` and send it through Feishu ``` The detailed output specification also mandates external integration: ```markdown #### Output 2: Feishu document - Format: Create a rich-text document through the Feishu API - Purpose: Team collaboration, comments, and mentioning relevant personnel - Delivery method: Invoke the `feishu-file-operations` skill or the `feishu-upload-file.py` script #### Output 3: HTML visualization report - Format: Deterministically render with `scripts/generate_html_report.py` - Purpose: Chart display, printing, and secondary review - Output path: `/tmp/payroll-audit-{month}.html` - Synchronized delivery: Send the file to the user's Feishu chat ``` The project requests highly sensitive source materials: ```markdown ## Required materials - Group-level spreadsheets - Current-month personnel-change and onboarding/offboarding spreadsheets - Bonus spreadsheets ## Scenario-specific materials - Attendance-system exports - Performance summaries - Official social-insurance and housing-fund statements - Individual income-tax system exports - Employee housing deduction details - Termination compensation approval files - Salary-base adjustment approval files ``` However, the older user-facing documentation presents Feishu integration as unavailable or planned: ```markdown | v1.0 | One-click Feish ...[truncated 3239 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Make local report generation the default. External delivery must be opt-in. 2. Require explicit per-run confirmation immediately before upload. The confirmation should identify: - Destination platform - Tenant or organization - Chat or document recipient - Files being uploaded - Categories of sensitive data included 3. Show a report preview and require the user to approve the exact destination and payload. 4. Apply data minimization: - Replace employee IDs with pseudonymous references where possible. - Exclude raw salary, tax, attendance, and statutory data unless required. - Include only discrepancies necessary for audit remediation. 5. Add an optional redacted-report mode for collaboration and retain the full report locally under restricted permissions. 6. Validate recipients against an approved allowlist or organizational access policy before sending. 7. Document retention, deletion, access-control, and cross-border transfer requirements. 8. Reconcile `SKILL.md`, `README.md`, `USER-GUIDE.md`, templates, and version metadata so users receive one accurate description of current behavior. 9. Include the referenced Feishu integration in the audited package or document its exact trusted dependency, permissions, recipient-selection behavior, and security controls. 10. If the external integration is unavailable or cannot verify the destination, fail closed and preserve the report locally rather than attempting automatic delivery. ]]>
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • 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 (30)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
该代码确实与“工资审核”领域相关,且包含‘交叉验证’这一声明中的子能力,因此不是完全无关代码。但其实际能力明显小于声明:它本质上是一个底层交叉验证脚本,而不是所描述的完整工资审核 AI 技能。代码只支持单项校验、有限规则、CSV 输入和 Markdown/JSON 输出;缺少飞书文档、HTML 可视化、图表、10 项核心审核覆盖、月份/区域/特殊情况处理、国内海外差异逻辑以及端到端自动化编排。因此描述对整体能力存在明显夸大,构成描述与行为不匹配。

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding
声明描述的是一个端到端工资审核技能,核心能力应包括:读取/处理工资相关数据、执行多项审核规则、做交叉验证,并生成多种形式的报告。而实际代码块的职责明显更窄,只是报告展示层组件。它接收外部 JSON 文件作为输入,依据其中已有的 audit_results 等字段拼装 HTML 页面,附带一个以内联 SVG 绘制的简单风险对比图。虽然它与声明中的“HTML 可视化报告”部分一致,且主题确实是工资审核报告,但它没有实现该技能宣称的大部分主要能力,因此描述与实际代码行为存在实质性不匹配。

Description-Behavior Mismatch

High
Confidence
95% confidence
Finding
The skill expands from payroll auditing into backup, restoration, batch execution, rollback, and upsert-style mutation workflows, which exceed the minimum privileges expected for a read-oriented audit skill. In a payroll environment, undocumented or weakly constrained mutation and restore behavior can alter compensation records or create bulk data integrity issues affecting many employees.

Vague Triggers

Medium
Confidence
90% confidence
Finding
Broad trigger phrases can cause the skill to activate during ordinary payroll-related conversations, leading the agent to produce audit guidance or request sensitive payroll materials when the user did not intend to invoke the skill. In an HR/payroll context, accidental activation is more dangerous because it may steer handling of highly sensitive employee compensation data and increase the chance of unnecessary data collection or disclosure.

Description-Behavior Mismatch

Medium
Confidence
92% confidence
Finding
The manifest describes a fully automated payroll audit workflow covering 10 audit elements, cross-validation, and support for domestic/overseas employee auditing. In this file, the skill is described as automatically reading rule files and generating a customized audit report/checklist, with later steps still requiring humans to request materials from HR and execute the checks manually. That is a meaningful mismatch in claimed automation and actual documented behavior.

Lp3

Medium
Category
MCP Least Privilege
Confidence
80% confidence
Finding
The skill describes reading and writing local files, including generating reports under /tmp and using templates/scripts, but does not declare any explicit tool scope or permission boundaries. In a payroll context, that creates unnecessary ambiguity around what filesystem access is expected, increasing the risk of over-broad file operations against highly sensitive HR, compensation, and tax data.

Intent-Code Divergence

Medium
Confidence
89% confidence
Finding
The documentation promises zero-human-intervention automation while also acknowledging discrepancy states that require manual verification. In a sensitive payroll-review workflow, that contradiction can cause operators to over-trust incomplete results and approve payroll despite unresolved warnings, leading to financial or compliance errors.

Missing User Warnings

Medium
Confidence
89% confidence
Finding
Promoting fully automatic payroll-data processing without a warning about the sensitivity of HR, compensation, and tax records encourages unsafe handling of regulated personal data. In this context, users may upload or process entire payroll datasets without understanding the confidentiality and compliance implications.

Missing User Warnings

Medium
Confidence
96% confidence
Finding
The skill instructs sending payroll reports to Feishu and writing them to local files without clearly warning that the content includes highly sensitive salary, tax, social insurance, and personnel data. This creates a real risk of unintended disclosure through chat platforms, local temporary storage, retention, or access by unauthorized users on the host system.

Intent-Code Divergence

Medium
Confidence
90% confidence
Finding
L012-L023 将当前版本描述为“工资审核辅助工具”,只能把规则转化为定制化月度审核清单,且不能自动发现数据异常或直接读取工资系统数据。与此同时,L048-L060 的调用示例明确要求 subagent“生成审核报告”并按报告模板输出,这与前述“当前版本”能力表述存在直接文档层面的矛盾。

Description-Behavior Mismatch

Medium
Confidence
90% confidence
Finding
The manifest describes one-shot generation of a complete payroll audit report with three output formats and visualization/status tracking. This file is instead a blank monthly checklist with placeholders, unchecked items, empty anomaly tables, and no evidence of generated report content, Feishu output, HTML visualization, or chart/status-comparison artifacts.

Description-Behavior Mismatch

Medium
Confidence
95% confidence
Finding
The manifest says the skill performs the payroll audit end-to-end automatically and generates outputs with no manual intervention. However, this file is a human-operated checklist instructing users to copy the document monthly, tick completed items, record exceptions, and includes manual auditor/reviewer/approver signature sections, indicating a manual workflow rather than autonomous execution.

Natural-Language Policy Violations

Medium
Confidence
87% confidence
Finding
This markdown file contains user-facing policy/instruction content entirely in Chinese, and there is no indication that users may choose another language or that the skill is intentionally restricted to a Chinese-speaking or region-specific audience. Under the stated policy, forcing a specific language without user opt-in is a natural-language policy violation.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
Natural-language strings throughout the file, including the docstring, CLI descriptions, HTML labels, and the HTML lang attribute, are fixed to Chinese/zh-CN. The file does not provide any language selection or explain that the skill is intentionally restricted to a Chinese-speaking or region-specific context.

Intent-Code Divergence

Medium
Confidence
96% confidence
Finding
The report presents a 'current month vs previous month' risk comparison but fabricates prior-month values instead of reading real historical data. In a payroll-audit context, this can mislead operators into trusting a false trend signal and making compensation-release decisions based on inaccurate compliance evidence.

Intent-Code Divergence

Medium
Confidence
89% confidence
Finding
该文件生成的最终 HTML 报告明确写明“本报告由 AI 辅助生成,最终审核结果需人工确认”,表示流程并非完全无需人工介入。与技能清单中“全流程自动执行,无需人工介入”的对外宣称相比,这是直接的意图性冲突,而不只是实现细节缺失。

Missing User Warnings

Medium
Confidence
82% confidence
Finding
This code writes a generated HTML report containing payroll audit results, risk alerts, and processing logs to the path supplied by the user. Although it prints the output path afterward, there is no prior warning in code comments or user-facing messaging that sensitive audit data will be persisted to disk.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
This markdown template is entirely written in Chinese and provides no indication that the language is optional, user-selectable, or limited to a documented Chinese-speaking context. Under the policy, forcing a specific language without user opt-in is a natural-language locale violation.

Natural-Language Policy Violations

Medium
Confidence
90% confidence
Finding
The template explicitly sets the document language to "zh-CN", which enforces a specific locale in the rendered output. Under the policy, hard-coding a language/locale without user opt-in or documented region-specific justification is a natural-language policy violation.

Description-Behavior Mismatch

Medium
Confidence
96% confidence
Finding
The manifest says the payroll audit workflow is '全流程自动执行,无需人工介入' (fully automatic, no human intervention). However, the footer text in the generated report says '最终审核结果需人工确认', which signals that the audit outcome is not actually fully autonomous and requires manual review.

Natural-Language Policy Violations

Low
Confidence
85% confidence
Finding
README 全文以中文指示安装与使用方式,并通过中文示例语句定义交互方式,但未说明是否支持其他语言,也未给用户提供语言/locale 选择。根据语言/locale 政策,若技能交互被自然语言文档隐含限定为单一语言而无用户选择,属于潜在策略违规。

Description-Behavior Mismatch

Low
Confidence
86% confidence
Finding
The manifest explicitly claims three output channels: Markdown report, Feishu document, and HTML visual report with charts and audit-state tracking. The README only describes generating a structured audit report/checklist and does not document any Feishu or HTML report generation behavior, suggesting the implemented or documented functionality is more limited than the manifest states.

Natural-Language Policy Violations

Low
Confidence
86% confidence
Finding
The manifest-style header and usage triggers are written exclusively in Chinese, including the label and invocation examples, without indicating that another language may be used. This can constitute a language/locale policy issue when the skill implicitly constrains interaction language without user opt-in or documented justification.

Natural-Language Policy Violations

Low
Confidence
85% confidence
Finding
This markdown file contains user-facing instructions entirely in Chinese, including the invocation examples and assistant naming, but does not state that the skill is region-specific or provide an opt-in language/locale choice. Under the natural-language policy rule, forcing a specific language without user choice can be a locale policy violation unless clearly justified.

Intent-Code Divergence

Low
Confidence
80% confidence
Finding
L022 表示“当前版本”不能直接读取工资系统数据,暗示现阶段无系统级数据接入;而 L141-L155 将“自动读取工资数据/对接飞书表格自动读取数据”作为后续规划,说明文档对“当前是否仅规则驱动、是否已具备任何自动数据读取能力”表达不够一致。虽然不一定反映真实代码行为,但属于文档意图边界的冲突。

Static analysis

No suspicious patterns detected.