Back to skill

Security audit

Yunjia File Transfer

Security checks for vulnerabilities and agentic risk

Overview

This skill is for sending local files into chat, but it encourages broad local searches and immediate transfer without clear confirmation or privacy boundaries.

Review before installing. This skill can cause an agent to search your local folders and send matched files into the current chat. Only use it where users understand that local file discovery may occur, and prefer an updated version that asks for confirmation, limits searches to user-approved directories, and removes or redacts persistent logging.

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/assemble_send_instruction.py:10
Finding

Predictable Temporary Log Exposes Sensitive File Metadata and Permits Symlink Abuse

Content
View full analysis

Vulnerability Details

File Location: scripts/assemble_send_instruction.py, lines 10-24, 38-42, 76-77, and 94-99
Vulnerability Type: Insecure temporary-file handling and plaintext sensitive-data logging
Risk Level: Medium

Vulnerable Code

python
LOG_FILE = "/tmp/yunjia-file-transfer.log"

def log(message):
    """Print log with timestamp to stderr and log file"""
    timestamp = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
    log_line = f"[{timestamp}] [yunjia-file-transfer] {message}"
    
    # Print to stderr
    print(log_line, file=sys.stderr)
    
    # Append to log file
    try:
        with open(LOG_FILE, "a") as f:
            f.write(log_line + "\n")
    except Exception:
        pass  # Ignore file write errors

Sensitive values are passed to that logging function at several locations:

python
if text:
    log(f"  Text: {text}")

for i, path in enumerate(file_paths, 1):
    log(f"  File {i}: {path}")
python
log(f"Arguments received: {args.file}, text: {args.text}")
python
output = json.dumps(result, ensure_ascii=False, indent=2)
log(f"Output to stdout: {output}")

Technical Analysis

Every invocation records the complete local file paths, user-provided message text, command-line arguments, and generated transfer instruction in a fixed file named /tmp/yunjia-file-transfer.log.

A globally predictable path under /tmp is unsafe because the script does not:

  • Create the file atomically with restrictive permissions.
  • Verify that the destination is a regular file owned by the current user.
  • prevent following symbolic links.
  • Restrict the file mode to the owner, such as 0600.
  • Redact file names, directory structures, or user message content.
  • Sanitize carriage returns or newlines before creating log records.

Depending on the host's umask and existing file ownershi ...[truncated 2244 chars]

Remediation
View remediation

Remediation Suggestions

  1. Disable persistent logging by default and avoid recording full file paths, user text, command-line arguments, or complete output.
  2. If diagnostic logging is necessary, make it explicitly opt-in and redact sensitive values. Record only non-sensitive operational events, such as the number of files processed and a generic success or failure result.
  3. Store logs in a platform-specific, user-private state directory rather than a shared temporary directory.
  4. Create the log atomically with owner-only permissions, such as mode 0600, using secure low-level file-opening flags.
  5. Prevent symbolic-link traversal by using O_NOFOLLOW where supported, and verify with fstat() that the opened destination is a regular file owned by the current user.
  6. Sanitize carriage returns, newline characters, and other control characters before writing any user-controlled value.
  7. Add size limits, rotation, and a defined retention period to prevent indefinite accumulation of sensitive metadata.
  8. Do not silently suppress every logging exception. Handle failures safely without exposing sensitive details, and make security-relevant setup errors observable through non-sensitive diagnostics.
  9. Add automated tests covering restrictive permissions, pre-existing symbolic links, newline injection, redaction, and concurrent file creation.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • 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 (12)

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

声明描述的是一个用于响应用户“把文件发给我”之类请求并发送本地文件的技能。但提供的代码仅是测试脚本:定义了绝对路径校验函数,输出平台信息,并验证若干示例路径是否合法。代码中没有任何文件读取/发送、聊天频道交互、消息触发处理或与用户请求相关的逻辑。因此其主要目的与声明明显不一致,应判定为描述与行为不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

声明的核心能力是“根据用户请求把本地文件发送到聊天频道”。但给出的代码块是 tests/test_windows_compatibility.py,一个测试脚本,主要用于验证路径格式、展示用户场景、构造对 assemble_send_instruction.py 的命令字符串,并打印模拟输出。它没有实现实际发送文件到聊天频道的功能,也没有处理聊天触发或执行文件传输。其主要目的与声明不符,属于明显的描述-行为不匹配。

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
87% confidence
Finding

The skill instructs the agent to search local directories and invoke a script that assembles file-transfer instructions, but it declares no explicit tool scope or permission boundaries. That creates an authorization gap: an agent may use filesystem-capable tools more broadly than intended, increasing the chance of unintended local file discovery or exfiltration.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

The skill instructs the agent on how to address users and provides fixed Chinese-language reply patterns throughout the document, without offering a user choice of language or locale. This can violate language/locale policy when users have not opted into Chinese responses or that communication style.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The trigger phrases are broad enough to match ordinary conversation about sharing or uploading files, which can cause the skill to activate when the user did not intend a local file search or send action. In this skill, activation is coupled with proactive filesystem searching, so accidental invocation can expose filenames, paths, or lead to unintended file transmission.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill directs the agent to proactively search local directories such as Downloads, Documents, Desktop, and even recursively through the user profile, but the description does not clearly warn users that local filesystem discovery will occur. This is dangerous because a casual request can silently expand into broad local enumeration, revealing sensitive filenames and enabling unintended exfiltration of private documents.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The guide tells the agent to locate and send files directly after a loosely specified user request, but it includes no step to verify the exact file, confirm the recipient/channel, or assess whether the file contains sensitive data. In a file-transfer skill, this creates a real risk of unauthorized disclosure because ambiguous requests like 'send me the report' can cause the agent to exfiltrate confidential local documents to the current chat.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The recommended PowerShell commands perform broad recursive searches across the user's profile, document stores, and large files without narrowing scope to a user-approved directory or purpose. In this skill's context, broad discovery materially increases privacy and data-exposure risk because the agent may enumerate and select unrelated sensitive files that happen to match a vague request.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The script logs absolute file paths and user-supplied text directly to stderr and to /tmp/yunjia-file-transfer.log, which can expose sensitive filenames, directory structures, and request content to other local users, operators, or downstream log collectors. In this skill’s context, the tool is specifically used to send arbitrary local files to chat, so the logged paths are especially likely to reference confidential documents and materially increase information disclosure risk.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
73% confidence
Finding

The skill content is framed entirely around one language and platform preference, and the sample user-agent communications are only in Chinese with no opt-in or alternative language handling. Under the policy, forcing a language or locale without user choice can be a natural-language policy violation unless explicitly justified.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

This Python file contains user-facing output, comments, and docstrings exclusively in Chinese, including printed runtime messages. Under the policy rule, forcing a specific language without opt-in can be a natural-language policy violation when no alternative language choice or justification is provided.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

This Python file contains user-facing strings, comments, and descriptive text entirely in Chinese, including status output shown during execution. Because the file does not indicate that it is intentionally limited to Chinese-speaking users or provide any language opt-in, it can violate the policy against forcing a specific language without user choice.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.