Back to skill

Security audit

AnyShare MCP Skills

Security checks for vulnerabilities and agentic risk

Overview

This AnyShare document skill is coherent, but its setup asks users to paste an access token into chat and stores it in plaintext local configuration.

Review before installing. Use only with an AnyShare MCP endpoint you trust and a narrowly scoped token if possible. Do not paste a real bearer token into chat; prefer entering it locally through a secure prompt or secret manager, and if plaintext config is unavoidable, restrict ~/.mcporter and mcporter.json permissions and rotate any token previously pasted into a conversation.

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:180
Finding

Bearer Token Disclosure Through Chat and Plaintext Configuration

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 180–203
Vulnerability Type: Credential exposure through insecure secret collection and storage
Risk Level: High

The mandatory setup workflow instructs the user to paste an AnyShare MCP access token directly into the conversation. It then directs the agent to place that token in ~/.mcporter/mcporter.json as a plaintext bearer credential.

Vulnerable code segment:

markdown
### Step 4: 获取 Token 并写入配置

**4.1 向用户获取 Token(固定话术)**

> 请在 AnyShare Web端 **登录后**,点击右上角头像进入 **「MCP授权凭证」**;在此可**管理、赋值**凭证。复制令牌后,**在本对话中粘贴**。

**4.2 写入 headers.Authorization**

用户粘贴 token 后,Agent 将 `~/.mcporter/mcporter.json` 中 `asmcp.headers.Authorization` 更新为:

```json
"Authorization": "Bearer <用户粘贴的token>"

4.3 重启 daemon 并验证

bash
mcporter daemon restart
mcporter call asmcp.doc_lib_owned

返回文档库列表即表示认证成功。若返回 401 / 未授权,提示用户重新获取 token 并重复 4.1 → 4.2 → 4.3。

Token 过期时:重复 4.1 → 4.2 → 4.3(更新配置文件中的 token 值后重启 daemon)。

text

### Technical Analysis

Bearer tokens are possession-based credentials: any party that obtains the token can generally exercise its granted permissions without additional proof of identity. Requesting the token in a conversation exposes it to chat retention, telemetry, transcripts, administrative review, backups, and any integrations that process conversation content.

The workflow then persists the token in a regular JSON file. Although storing authentication headers in an MCP client configuration may be operationally necessary, the instructions do not require restrictive permissions such as mode `0600`, a credential manager, or a secret reference. Consequently, the token may also be exposed to other local users, backup systems, diagnostics, or processes capable of reading the configuration.

This behavior directly contradicts `SECURITY.md`, lines 7 and 14–16, which state that real bearer tokens must not be pasted into chat logs 
...[truncated 2176 chars]
Remediation
View remediation

Remediation Suggestions

  1. Remove the instruction to paste tokens into the conversation. The agent must never request, repeat, quote, or process the raw credential through chat.
  2. Require users to enter the token directly on the machine running mcporter, using a local interactive prompt that suppresses terminal echo.
  3. Prefer an operating-system credential manager, managed secret store, or supported environment/credential reference instead of embedding the token directly in JSON.
  4. If plaintext configuration is unavoidable, create ~/.mcporter with mode 0700 and ~/.mcporter/mcporter.json with mode 0600. Verify ownership before reading or modifying the file.
  5. Update configuration atomically using a temporary file with equally restrictive permissions, then replace the destination. Never print the resulting authorization header.
  6. Prevent the token from appearing in shell arguments, shell history, command output, debug logs, exception messages, or daemon diagnostics.
  7. Validate the MCP endpoint before credential use. Require HTTPS and explicit user confirmation for private deployment URLs.
  8. Revise SKILL.md, SECURITY.md, and troubleshooting guidance so they consistently prescribe the same non-chat secret-entry workflow.
  9. Advise users who followed the current workflow to revoke or rotate exposed tokens and delete affected conversation histories where supported.
  10. Use narrowly scoped, short-lived tokens when the AnyShare platform supports them, and document immediate revocation procedures.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (6)

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 14)May include surrounding context.

md
- **MCP service URL** defaults to `https://anyshare.aishu.cn/asmcp` in the skill template; override in `~/.mcporter/mcporter.json` (`asmcp.url`) for private deployments. Values are **environment-specific**.
  Do not commit internal-only URLs to public repos if they expose your network topology.
- **Access tokens** are written to `~/.mcporter/mcporter.json` under `asmcp.headers.Authorization` (documented in **`SKILL.md`**, section **「首次配置」**). Do not commit secrets or paste tokens into chat logs.
- **Token renewal**: when a token expires or is revoked, update `headers.Authorization` in `~/.mcporter/mcporter.json` and run `mcporter daemon restart`. Tokens are not cached by the skill itself.
- **Pasted tokens** must not appear in shell history, chat logs, or version control.
- **Environment-variable injection** of tokens is **not** the default path; **`openclaw.skill-entry.json`** only documents **`MCPORTER_CALL_TIMEOUT`**.

Ssd 3

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The skill directs the agent to have users paste authentication tokens into the conversation and then persist them into a local config file. This compounds two risks: immediate credential leakage via chat/logging, and longer-term exposure through plaintext storage in a user-accessible file, potentially readable by other processes, backups, or local attackers. Because the token is then used for enterprise MCP operations, theft can lead to sustained unauthorized access.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The skill explicitly instructs the agent to ask the user to paste an AnyShare access token directly into the chat. Secrets entered into conversation channels may be retained in chat history, logs, telemetry, screenshots, or visible to unintended parties, creating a straightforward credential exposure path. In this context the token grants authenticated MCP access, so compromise could enable unauthorized access to enterprise documents and actions.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

The description and throughout the file prescribe Chinese trigger phrases and exact Chinese reply patterns such as replying with "是" for confirmation. There is no indication that users may opt into another language, which can violate language/locale policy requirements when no justified locale restriction is documented.

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 109)May include surrounding context.

1.1 读取或创建 mcporter 配置

bash
mkdir -p ~/.mcporter
cat ~/.mcporter/mcporter.json 2>/dev/null || echo '{"mcpServers":{}}'

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

This file contains user-facing operational guidance only in Chinese, including headings, instructions, and remediation steps. Under the language/locale policy rule, forcing a specific language without user opt-in can be a policy violation unless the locale restriction is explicitly documented and justified.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.