Back to skill

Security audit

anyshare-contract-rule-review

Security checks for vulnerabilities and agentic risk

Overview

The skill does what it says, but it handles sensitive contracts and credentials with enough unsafe implementation details that users should review it carefully before installing.

Install only if you intend to upload confidential contracts and review reports to AnyShare and create remote share links. Use narrowly scoped, short-lived credentials where possible, avoid untrusted or quote-containing filenames until the Python interpolation bug is fixed, and require a manual confirmation before uploading documents or generating links.

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

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:226
Finding

Arbitrary Python Code Execution Through a Crafted 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 } ``` ```bash CONTRACT_DIR_NAME="${FILE_NAME%.docx}" CONTRACT_DIR_GNS=$(check_dir_exists "$DATE_DIR_GNS" "$CONTRACT_DIR_NAME") ``` ### Technical Analysis The contract filename is treated as untrusted input and assigned to `CONTRACT_DIR_NAME`. The value is subsequently concatenated directly into the source code supplied to `python3 -c`: ```python if d.get('name')=='$dir_name': ``` Shell quoting does not protect values embedded into another interpreter's source code. A filename containing a single quote followed by valid Python syntax can terminate the string literal and alter the generated Python program. This is an interpreter injection vulnerability rather than ordinary shell injection. The injected payload executes under the same operating-system account and environment as the Skill workflow. ### Attack Path 1. An attacker creates or provides a contract with a maliciously crafted filename. 2. The user selects that contract as `LOCAL_FILE`. 3. `basename` preserves the attacker-controlled filename. 4. The workflow removes the `.docx` suffix and passes the remaining value to `check_dir_exists`. 5. `check_dir_exists` inserts the value directly into the `python3 -c` program. 6. The crafted filename closes th ...[truncated 884 chars]
Remediation
View remediation
&1) || return 1 printf '%s' "$result" | python3 -c ' import json import sys target_name = sys.argv[1] data = json.load(sys.stdin) for entry in data.get("dirs", []): if entry.get("name") == target_name: print(entry.get("id", "")) break ' "$dir_name" } ``` Additional hardening should include: 1. Validate that filenames do not contain control characters or path separators. 2. Treat filenames, directory names, API responses, and template contents as untrusted data. 3. Avoid constructing programs or expressions through string interpolation. 4. Check the exit status of both `mcporter` and the JSON parser. 5. Add regression tests using filenames containing quotes, newlines, backslashes, shell metacharacters, and Unicode edge cases. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:110
Finding

AnyShare Access Token Exposed Through Process Command-Line Arguments

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
references/troubleshooting.md:73
Finding

Confidential Contracts Copied to a Predictable Shared Temporary Path

Content
View full analysis
Remediation
View remediation
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
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (20)

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
70% confidence
Finding

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

Content

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

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

External Script Fetching

High
Category
Supply Chain
Confidence
90% confidence
Finding

The skill retrieves a remote template from an external API and later uses that content to drive contract review logic. Even though the fetched template is not executed as shell code, it is untrusted remote instruction content that can alter analysis behavior, produce misleading legal guidance, or inject unsafe prompt content into downstream assistant calls.

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
90% confidence
Finding

This is the runtime instance of the same risk: the skill fetches a remote default template and incorporates it directly into the review query. A compromised template service or malicious template content could bias or manipulate legal review outputs for sensitive contracts.

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
98% confidence
Finding

The skill uploads the local contract file contents to a remote URL obtained from the service, which is a direct external transmission of potentially highly sensitive legal data. In a contract-review context this is especially dangerous because contracts commonly include confidential business terms, personal data, and regulated information, yet the workflow does not enforce an explicit consent checkpoint immediately before upload.

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

The temporary-area POST enrolls the uploaded document into another remote service path for assistant processing. This broadens exposure of sensitive contract data beyond simple storage into additional downstream processing, increasing confidentiality and governance risk.

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

Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.

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
97% confidence
Finding

The skill uploads the generated review report to a remote destination, and that report may contain extracted sensitive terms, legal conclusions, and confidential summaries derived from the original contract. Persisting those results remotely compounds confidentiality risk, especially when followed by share-link creation.

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
90% confidence
Finding

The skill description, triggers, and user-facing instructions are entirely in Chinese, and the example query sent to the assistant is also hardcoded in Chinese. There is no indication that users may choose another language or that the Chinese-only behavior is required for a region-specific compliance purpose.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill explicitly uploads local contract files, saves generated review reports remotely, and creates a share link, but it does not require an explicit user-facing warning or confirmation before transmitting potentially sensitive legal documents to AnyShare. Because contracts often contain confidential commercial or personal data, silent or insufficiently disclosed transmission materially increases privacy and data-handling 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
95% confidence
Finding

The skill sends document identifiers to an external AnyShare temporary-area endpoint as part of a workflow that processes uploaded contracts. In context, this is an intended feature, but it is still a security-relevant external transmission because sensitive contract data has already been uploaded and is being enrolled into another remote processing path without an explicit consent gate.

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
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 · 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
96% confidence
Finding

This markdown file contains user-facing policy and operational guidance exclusively in Chinese. Under the language/locale policy rule, forcing a single language without user opt-in or documented regional justification is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
90% 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, alternative language, or explicit region-specific justification is provided. The content appears to assume Chinese as the required language for all users.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

The entire template prescribes Chinese-language headings, review dimensions, and output format, with no indication that users may choose another language. Under the stated policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale restriction is clearly documented and justified.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
86% confidence
Finding

The entire template is written as a Chinese-only skill artifact and does not indicate that the language is optional, user-selectable, or limited to a China-specific legal workflow. Under the policy, a skill that effectively requires a specific language without opt-in can be a natural-language policy concern.

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