Back to skill

Security audit

Yuque

Security checks for vulnerabilities and agentic risk

Overview

This Yuque skill is mostly a coherent document-management integration, but it includes under-disclosed destructive document deletion capability and weak credential-handling guidance.

Review this skill before installing if the Yuque token can access important personal or team knowledge bases. Prefer setting YUQUE_TOKEN through a protected environment or secret manager rather than using --token, grant the token the narrowest Yuque permissions available, and require explicit user confirmation before any create, update, or delete operation, especially for team repositories.

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

Warning
Location
scripts/yuque_cli.py:132
Finding

Yuque API Token Exposure Through Command-Line Arguments

Content
View full analysis

Vulnerability Details

File Location: scripts/yuque_cli.py, lines 132 and 176
Vulnerability Type: API credential exposure through process arguments
Risk Level: Medium

Vulnerable Code

python
parser.add_argument("--token", help="Yuque API token (or set YUQUE_TOKEN env var)")
python
token = args.token or os.environ.get("YUQUE_TOKEN")

Technical Analysis

The CLI permits users to supply the Yuque API token through the --token command-line argument. Command-line arguments are not an appropriate channel for secrets because they may be exposed through process inspection facilities, shell history, operating-system audit records, CI/CD job metadata, terminal logs, or endpoint-monitoring telemetry.

The environment-variable authentication mechanism already implemented by the script is sufficient for its declared functionality. Consequently, accepting the same credential through an exposed process argument exceeds the minimum secret-handling surface necessary for the Skill.

The token is subsequently used as the X-Auth-Token header for requests to the fixed HTTPS Yuque API endpoint. That network transmission is necessary for authentication and no evidence indicates that the token is sent to an unrelated service. The vulnerability is specifically the command-line input mechanism, not the authenticated communication with Yuque.

Attack Path

  1. A user invokes the CLI with a command such as:
    bash
    python scripts/yuque_cli.py --token SECRET_VALUE docs user/repository
    
  2. The complete command line, including SECRET_VALUE, becomes observable through one or more local mechanisms, such as process listings, shell history, audit logs, job logs, or monitoring telemetry.
  3. A local user, administrator, monitoring-system operator, or attacker with access to those records retrieves the token.
  4. The attacker supplies the recovered token in an X-Auth-Token header to the Yuque AP ...[truncated 907 chars]
Remediation
View remediation

Remediation Suggestions

  1. Remove the --token command-line option so credentials cannot be supplied through process arguments.
  2. Continue reading the token from YUQUE_TOKEN, preferably injected through a properly protected secret manager rather than a persistent shell configuration file.
  3. If interactive entry is necessary, use getpass.getpass() so the token is not echoed or retained in shell history:
    python
    import getpass
    import os
    
    token = os.environ.get("YUQUE_TOKEN")
    if not token:
        token = getpass.getpass("Yuque API token: ")
    
  4. Ensure application, CI/CD, audit, and telemetry logs never record the token or authentication header.
  5. Document the recommended secure credential setup and discourage embedding the token in scripts, aliases, command history, or repository files.
  6. Revoke and rotate any token previously passed through --token if it may have been captured in process metadata or logs.
  7. Assign the Yuque token only the minimum server-side permissions required for the intended document operations.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (10)

Tp4

High
Category
MCP Tool Poisoning
Confidence
92% confidence
Finding

The declared behavior does not fully match the documented capabilities: the skill retrieves current user info and updates documents, while the description omits these write and account-inspection actions. Capability mismatch is dangerous because users and orchestrators may authorize the skill for read-oriented tasks without realizing it can modify remote content or expose account metadata.

Content

No source excerpt is available for this finding.

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

1. Get User Info

bash
curl -s -H "X-Auth-Token: $YUQUE_TOKEN" https://www.yuque.com/api/v2/user

2. List User Repositories

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
80% confidence
Finding

The documented DELETE endpoint enables irreversible document removal, and in an agent skill context this can become dangerous if exposed as a callable action without strong confirmation and scoping controls. The skill context increases risk because the agent is intended to manage Yuque documents and repositories, so a user prompt or prompt-injection chain could induce destructive actions against real content.

Content

Scanner excerpt · references/api.md (reported line 191)May include surrounding context.

Delete Document

text
DELETE /repos/:namespace/docs/:id

Error Codes

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
95% confidence
Finding

The skill uses environment-sourced credentials and makes outbound network requests, but it declares no explicit tool scope or permissions boundary. This is dangerous because an agent may invoke the skill with broader capabilities than users expect, enabling authenticated external actions without clear consent or sandboxing expectations.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The documentation instructs authenticated create/update API calls that transmit user-provided content to a third-party service, but it gives no warning that remote data will be modified or sent externally. In an agent context, this increases the risk of unintended publication, data leakage, or destructive edits if the user thinks the operation is local or read-only.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
90% confidence
Finding

This command performs an authenticated POST to an external service and transmits document content outside the local environment. Even if intended, it is security-relevant because sensitive or regulated content could be exfiltrated to Yuque, and the operation creates persistent remote state.

Content

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

6. Create Document

bash
curl -s -X POST \
  -H "X-Auth-Token: $YUQUE_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"title": "Document Title", "body": "Document content in Markdown"}' \

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

This markdown file documents document creation, update, and deletion endpoints, including a DELETE operation, but provides no warning about modifying or permanently removing user content. For markdown files, SQP-2 applies when the skill description omits warnings about behaviors that could affect user data or system integrity.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The code exposes a document deletion capability via delete_doc, but the skill metadata only describes read, search, create, and management operations without explicitly declaring destructive delete/remove behavior. In an agent-skill context, undeclared destructive functionality increases the risk of unintended or policy-bypassing data loss because users, reviewers, or orchestrators may not expect the skill to be able to delete content.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The deletion method performs an irreversible API delete with no built-in confirmation, dry-run mode, or warning prompt. In an agent-assisted workflow, this makes accidental or prompt-induced destructive actions more likely, potentially causing immediate document loss in personal or team knowledge bases.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
82% confidence
Finding

The file instructs users to supply an X-Auth-Token for all requests but does not warn that the token is sensitive credential material that should not be exposed in logs, shared snippets, or insecure storage. For markdown files, omission of privacy or credential-safety warnings can qualify as a missing user warning.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.