Back to skill

Security audit

合同规则审阅助手

Security checks for vulnerabilities and agentic risk

Overview

This skill is purpose-aligned with remote contract review, but it handles sensitive contract files and contains a verified filename-based code-injection flaw in its documented workflow.

Review before installing. Use only with contracts you are allowed to upload to AnyShare, confirm the token is least-privileged, avoid processing files from untrusted sources until the filename injection is fixed, and do not create or share report links unless the recipients and retention expectations are clear.

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

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:226
Finding

Arbitrary Python Code Execution Through Unsafely Interpolated Contract Filename

Content
View full analysis
&1) echo "$result" | python3 -c " import sys,json data=json.load(sys.stdin) for d in data.get('dirs',[]): if d.get('name')=='$dir_name': print(d.get('id','')) break " 2>/dev/null } ``` The vulnerable function is subsequently called with a directory name derived from the local contract filename: ```bash CONTRACT_DIR_NAME="${FILE_NAME%.docx}" CONTRACT_DIR_GNS=$(check_dir_exists "$DATE_DIR_GNS" "$CONTRACT_DIR_NAME") ``` ### Technical Analysis The `dir_name` shell variable is interpolated directly into Python source code passed to `python3 -c`: ```python if d.get('name')=='$dir_name': ``` Shell quoting does not make this value safe within the generated Python program. If the contract filename contains a single quote followed by syntactically valid Python content, it can terminate the intended Python string literal and alter the program executed by `python3 -c`. The untrusted value originates from `FILE_NAME`, which is derived from the user-selected local file path. Removing the `.docx` suffix does not sanitize quotes, line breaks, backslashes, or Python syntax. Consequently, a specially crafted filename can become executable Python source when the documented Bash workflow is run. This is an injection vulnerability rather than the remote-payload behavior identified by the pre-scan. The reviewed project does not contain a `curl | bash` execution pattern; its `cat "$LOCAL_FILE" | curl ... -T -` pipeline uploads file bytes and does not execute downloaded shell code. ### Attack Path 1. An attacker cr ...[truncated 1597 chars]
Remediation
View remediation
&1) || return 1 printf '%s' "$result" | python3 -c ' import json import sys name = sys.argv[1] data = json.load(sys.stdin) for directory in data.get("dirs", []): if directory.get("name") == name: print(directory.get("id", "")) break ' "$dir_name" } ``` Additional hardening should include: 1. Validate filenames before processing and reject embedded control characters such as newlines and null-equivalent input. 2. Never construct Python, shell, JSON, or query-language source by textual interpolation of user-controlled values. 3. Use a proper JSON encoder whenever filenames or identifiers are included in request bodies. 4. Check command exit statuses rather than suppressing all Python errors with `2>/dev/null`. 5. Run the workflow under a dedicated, least-privileged account and use an AnyShare token restricted to only the required document library and operations. 6. Add regression tests using filenames containing single quotes, double quotes, backslashes, line breaks, Unicode characters, and shell or Python metacharacters. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
Findings (18)

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · SECURITY.md (reported line 7)May include surrounding context.

md
| 信息类型 | 示例 | 风险等级 | 处理方式 |
|---------|------|---------|---------|
| Access Token | `ory_at_xxx...` | 🔴 高 | 仅存 mcporter 配置,禁止硬编码 |
| 文档库 GNS | `gns://FC1B4FE2...` | 🟡 中 | 可公开,不含内容 |
| 本地文件路径 | `~/Desktop/合同/` | 🟢 低 | 用户自行提供 |
| 合同内容 | 文件正文 | 🔴 高 | 仅在 AI 审阅流程中使用,不外传 |

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · SECURITY.md (reported line 17)May include surrounding context.

md
| 信息类型 | 示例 | 风险等级 | 处理方式 |
|---------|------|---------|---------|
| Access Token | `ory_at_xxx...` | 🔴 高 | 仅存 mcporter 配置,禁止硬编码 |
| 文档库 GNS | `gns://FC1B4FE2...` | 🟡 中 | 可公开,不含内容 |
| 本地文件路径 | `~/Desktop/合同/` | 🟢 低 | 用户自行提供 |
| 合同内容 | 文件正文 | 🔴 高 | 仅在 AI 审阅流程中使用,不外传 |

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · SECURITY.md (reported line 55)May include surrounding context.

md
| 信息类型 | 示例 | 风险等级 | 处理方式 |
|---------|------|---------|---------|
| Access Token | `ory_at_xxx...` | 🔴 高 | 仅存 mcporter 配置,禁止硬编码 |
| 文档库 GNS | `gns://FC1B4FE2...` | 🟡 中 | 可公开,不含内容 |
| 本地文件路径 | `~/Desktop/合同/` | 🟢 低 | 用户自行提供 |
| 合同内容 | 文件正文 | 🔴 高 | 仅在 AI 审阅流程中使用,不外传 |

Credential Access

High
Category
Privilege Escalation
Confidence
95% confidence
Finding

The skill instructs users to place a bearer token in a local config file and then passes that token into multiple shell and curl invocations. Even though it does not hardcode a secret, this workflow increases the risk of credential exposure through logs, process arguments, shell history, debugging output, or accidental file disclosure.

Content

Scanner excerpt · SKILL.md (reported line 31)May include surrounding context.

md
| 术语 | 含义 |
|------|------|
| Access Token | AnyShare 用户访问令牌,用于 API 身份认证 |
| 个人文档库 GNS | 个人文档库的 GNS 路径标识 |

### Step 1: 配置 MCP 服务与 Token

External Script Fetching

High
Category
Supply Chain
Confidence
94% confidence
Finding

The skill fetches a remote review template from an external service and later uses that content to drive automated contract analysis. This creates a supply-chain and prompt-injection risk: a compromised template service could alter review logic, exfiltrate contract content through instructions, or manipulate downstream assistant behavior without user visibility.

Content

Scanner excerpt · SKILL.md (reported line 112)May include surrounding context.

bash
# 获取内置规则审阅模板
TEMPLATE_RESPONSE=$(curl -s -X GET \
  "https://anyshare.aishu.cn/api/intelli-search/v1/skills/templates/default?skill_name=__规则审阅__1" \
  -H "authorization: $ACCESS_TOKEN" \
  -H "content-type: application/json")

External Script Fetching

High
Category
Supply Chain
Confidence
94% confidence
Finding

This is the same risky runtime behavior in the full example: fetching remote template content and directly incorporating it into the smart_assistant query. In a skill that handles sensitive contracts, externally controlled prompt material materially increases the chance of manipulated reviews or hidden instructions affecting confidential data processing.

Content

Scanner excerpt · SKILL.md (reported line 196)May include surrounding context.

md
echo ""
echo "📄 获取审阅模板..."

TEMPLATE_RESPONSE=$(curl -s -X GET \
  "https://anyshare.aishu.cn/api/intelli-search/v1/skills/templates/default?skill_name=__规则审阅__1" \
  -H "authorization: $ACCESS_TOKEN" \
  -H "content-type: application/json")

External Script Fetching

High
Category
Supply Chain
Confidence
91% confidence
Finding

This PUT uploads the local contract file contents to a remote URL obtained from the service. While labeled as script-fetching by the scanner, the real issue is outbound transfer of sensitive local documents to cloud storage; for contracts, that can expose confidential legal, financial, and personal information if misrouted, over-shared, or retained insecurely.

Content

Scanner excerpt · SKILL.md (reported line 322)May include surrounding context.

md
DOCID=$(echo "$UPLOAD" | python3 -c "import sys,json; print(json.load(sys.stdin)['docid'])")
REV=$(echo "$UPLOAD" | python3 -c "import sys,json; print(json.load(sys.stdin)['rev'])")

cat "$LOCAL_FILE" | curl -s -X PUT \
  -H "$AUTH" \
  -H "Content-Type: application/octet-stream" \
  -H "$DATE" \

External Script Fetching

High
Category
Supply Chain
Confidence
90% confidence
Finding

This remote POST contributes to the cloud-processing chain and may expose document identifiers and processing context to another backend component. In isolation it is less severe than raw file upload, but in this skill's context it broadens the trust boundary around sensitive contract data.

Content

Scanner excerpt · SKILL.md (reported line 352)May include surrounding context.

md
echo ""
echo "📤 上传至临时区域..."

TEMPORARY_AREA_RESULT=$(curl -s -X POST \
    "https://anyshare.aishu.cn/api/intelli-search/v1/temporary-area" \
    -H "authorization: $ACCESS_TOKEN" \
    -H "content-type: application/json" \

External Script Fetching

High
Category
Supply Chain
Confidence
90% confidence
Finding

The index-check polling request is another remote processing dependency that reveals file-processing state and associated identifiers to the service. In a contract-review workflow, repeated remote interactions increase exposure surface and should be explicitly justified and documented.

Content

Scanner excerpt · SKILL.md (reported line 384)May include surrounding context.

md
ELAPSED=0

while [ $ELAPSED -lt $MAX_WAIT ]; do
    INDEX_CHECK_RESULT=$(curl -s -X POST \
        "https://anyshare.aishu.cn/api/intelli-search/v1/index-check?target_index=pageindex" \
        -H "authorization: $ACCESS_TOKEN" \
        -H "content-type: application/json" \

External Script Fetching

High
Category
Supply Chain
Confidence
92% confidence
Finding

This uploads the generated review report to a remote location. The report may contain extracted confidential terms, legal risks, pricing, counterparties, and internal commentary, so remote storage of the output can be as sensitive as the original contract and may later be exposed via the generated share link.

Content

Scanner excerpt · SKILL.md (reported line 446)May include surrounding context.

md
R_REV=$(echo "$REPORT_BEGIN" | python3 -c "import sys,json; print(json.load(sys.stdin)['rev'])")

# ⚠️ 必须使用原始 Content-Type (application/octet-stream),不得覆盖
echo -n "$REPORT_CONTENT" | curl -s -X PUT \
  -H "$AUTH_H" \
  -H "Content-Type: application/octet-stream" \
  -H "$DATE_H" \

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The entire security guidance is written in Chinese and repeatedly uses Chinese-specific naming and workflow terminology without indicating that language selection is optional. Under the policy, forcing a specific language or locale without user opt-in is a natural-language policy violation unless the locale restriction is clearly justified.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The skill description explains what it does but does not clearly warn that it uploads local contract files, sends content to remote AnyShare APIs for processing, stores generated reports remotely, and creates a share link. Because contracts commonly contain sensitive commercial or personal data, omission of explicit consent and data-transfer warning materially increases privacy and confidentiality risk.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · SKILL.md (reported line 166)May include surrounding context.

text
用户请求 ──→ 获取模板 ──→ 创建目录结构 ──→ 上传合同原文 ──→ temporary-area ──→ index-check轮询 ──→ smart_assistant ──→ 保存审阅报告 ──→ 生成分享链接
                            │              ↓              ↓                  ↓              ↓                    ↓                    ↓                    ↓
                        API获取内置   dir_create       file_osbegin       file_osendupload  POST             index-check API      file_osbegin         file_sharedlink
                        失败则本地   (4级目录)                            → file_osendupload   temporary-area   (最多600秒)         file_osendupload      _realname_create

External Transmission

Medium
Category
Data Exfiltration
Confidence
96% confidence
Finding

This call transmits document identifiers to a remote temporary-area service as part of a workflow that already uploaded the underlying contract. In context, the skill is designed to process sensitive contracts remotely, so the danger is not merely external transmission but undisclosed handling of confidential data by additional backend services beyond local review.

Content

Scanner excerpt · SKILL.md (reported line 352)May include surrounding context.

md
echo ""
echo "📤 上传至临时区域..."

TEMPORARY_AREA_RESULT=$(curl -s -X POST \
    "https://anyshare.aishu.cn/api/intelli-search/v1/temporary-area" \
    -H "authorization: $ACCESS_TOKEN" \
    -H "content-type: application/json" \

External Transmission

Medium
Category
Data Exfiltration
Confidence
90% confidence
Finding

The index-check request sends file metadata to a remote API and confirms ongoing remote processing of uploaded contract content. Although this is functionally expected, it still expands exposure of sensitive document processing and should be treated as a privacy/security concern when handling contracts.

Content

Scanner excerpt · SKILL.md (reported line 384)May include surrounding context.

md
ELAPSED=0

while [ $ELAPSED -lt $MAX_WAIT ]; do
    INDEX_CHECK_RESULT=$(curl -s -X POST \
        "https://anyshare.aishu.cn/api/intelli-search/v1/index-check?target_index=pageindex" \
        -H "authorization: $ACCESS_TOKEN" \
        -H "content-type: application/json" \

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · references/troubleshooting.md (reported line 57)May include surrounding context.

md
---

## 文件名含中文/特殊字符导致 curl PUT 失败

**原因**:macOS 上 `curl --data-binary @"$FILE"` 对含中文路径的文件有解析问题。

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
82% confidence
Finding

The description and trigger phrases are entirely in Chinese, and the example query to the assistant is also fixed in Chinese, indicating a language-specific interaction model. There is no indication that users may choose another language or that the Chinese-only constraint is required for a region-specific compliance purpose.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
89% confidence
Finding

This markdown file contains user-facing operational guidance only in Chinese, which can constitute a language/locale policy issue when no opt-in or alternative language path is provided. The file does not state that the skill is region-specific or limited to Chinese-speaking users.

Content

No source excerpt is available for this finding.

Static analysis

Detected: suspicious.exposed_secret_literal

File appears to expose a hardcoded API secret or token.

Critical
Code
suspicious.exposed_secret_literal
Location
SECURITY.md:37