Back to skill

Security audit

Dify 8D分析助手

Security checks for vulnerabilities and agentic risk

Overview

This skill does what it says broadly, but it runs user text through an unreviewed external script in a way that can expose private data and may allow shell-command injection.

Review before installing. Use this only if you trust the external dify_router.sh deployment and Dify backend, and avoid sending confidential reports or personal data unless the operator documents where messages and open_id values go, how long sessions are retained, and how command arguments are safely passed without shell interpretation.

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

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:20
Finding

Shell Command Injection Through User-Controlled Message Interpolation

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 20-26
Vulnerability Type: OS command injection caused by unsafe command-string construction
Risk Level: High

Vulnerable code:

bash
timeout 180 /home/gem/workspace/agent/scripts/dify_router.sh "用户完整消息(含前缀)" "用户open_id"

The surrounding instructions explicitly require the complete user-controlled message to be inserted into this command and executed through the exec tool.

Technical Analysis

The skill constructs a shell command as a string containing the complete user message. Although the message is shown inside double quotes, double quotes do not prevent shell command substitution such as $(command) or backtick substitution. The instructions do not require argument-array execution, disabling shell interpretation, or robust shell escaping.

If the agent replaces the placeholder with the message verbatim, shell syntax in the message can be evaluated before dify_router.sh receives its arguments. For example, a triggering message containing $(id) could cause the shell to execute id while constructing the script argument. More harmful commands could be substituted depending on the privileges and available tools of the agent process.

Attack Path

  1. An attacker sends a message beginning with the required trigger phrase.
  2. The remainder of the message contains shell substitution syntax, such as $(attacker_command).
  3. The agent follows the skill instructions and interpolates the complete message into the documented command string.
  4. The exec tool invokes a shell to interpret the resulting command.
  5. The shell evaluates the injected substitution before launching dify_router.sh.
  6. The injected command runs with the operating-system permissions of the agent process.

Impact Assessment

Successful exploitation can provide arbitrary command execution under the account running the agent. Depending on that account's permis ...[truncated 309 chars]

Remediation
View remediation

Remediation Suggestions

  • Do not concatenate user input into a shell command string.
  • Invoke the script through an API that accepts an argument array, with shell processing explicitly disabled. Conceptually, use arguments equivalent to:
    text
    ["timeout", "180", "/home/gem/workspace/agent/scripts/dify_router.sh", complete_message, validated_open_id]
    
  • If the execution interface only supports command strings, redesign the integration rather than relying on ad hoc escaping.
  • Validate open_id against a strict allowlist pattern and length limit.
  • Apply reasonable message-length limits and reject control characters where they are not needed.
  • Run the integration under a dedicated, least-privileged operating-system account with restricted filesystem and network access.
  • Add tests using command-substitution characters, quotes, backticks, newlines, and shell metacharacters to confirm that input is passed literally.

other

Warning
Location
SKILL.md:20
Finding

Uncontrolled Disclosure of User Messages and Persistent Identifiers to an Unaudited External Integration

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 20-27
Vulnerability Type: External data disclosure and unverifiable out-of-package processing
Risk Level: Medium

Vulnerable instructions:

markdown
1. **提取问题**:去掉前缀 `调用 8D 报告分析助手`,保留后面的实际问题内容
2. **获取用户 ID**:从当前消息上下文的 sender_id 获取用户 open_id
3. **调用脚本**:使用 background 模式执行命令
   ```bash
   timeout 180 /home/gem/workspace/agent/scripts/dify_router.sh "用户完整消息(含前缀)" "用户open_id"
   ```
4. **返回结果**:将脚本输出(stdout)作为回复发送给用户

The skill also states at line 52 that the external script maintains multi-turn conversation sessions.

Technical Analysis

The skill requires collection of both the complete user message and the user's stable platform identifier, then passes them to /home/gem/workspace/agent/scripts/dify_router.sh. This script is outside the audited project and was not available for review. The skill states that a Dify API is called and that the script retains conversation state, but it does not identify or allowlist the destination, define data retention, minimize or pseudonymize the identifier, specify consent requirements, or verify the integrity of the external script.

Consequently, the reviewed package cannot establish where the data is sent, how it is protected, or how long it is retained. Because the script is referenced by an absolute external path, its behavior may also change independently of this skill package.

Attack Path

  1. A user invokes the skill with the documented trigger phrase and includes potentially sensitive business information in the message.
  2. The agent obtains the user's open_id from message context without a documented minimization or pseudonymization step.
  3. The agent sends the complete message and stable identifier to the external script.
  4. The unaudited script forwards or processes that information through the Dify integration and maintains multi-turn state.
  5. Any endpoint compromise, script repla ...[truncated 657 chars]
Remediation
View remediation

Remediation Suggestions

  • Include the integration script in the reviewed package or otherwise make its exact version and integrity hash auditable.
  • Restrict outbound communication to explicitly documented and allowlisted HTTPS endpoints.
  • Clearly disclose what information is transmitted, the processing provider, retention period, and purpose before invocation.
  • Obtain appropriate user consent before transmitting message content and identifiers.
  • Send only the extracted question rather than the complete message unless the prefix is demonstrably necessary.
  • Replace the stable open_id with a scoped, pseudonymous session identifier where possible.
  • Encrypt data in transit, avoid sensitive request logging, and establish deletion and session-expiration controls.
  • Validate stdout before returning it to users and ensure errors cannot reveal credentials, internal paths, or backend diagnostics.
  • Run the external script with least privilege and protect it against modification by the agent account.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (2)

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill explicitly sends the user's full message and a persistent user identifier (open_id) to an external Dify API, but provides no user-facing disclosure, consent flow, data-minimization control, or handling guidance for sensitive content. This creates a real privacy and data-governance risk because users may unknowingly transmit confidential business data or personal information to a third party, and the persistent identifier enables tracking or correlation across sessions.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

The natural-language description and trigger phrase require a Chinese invocation pattern and present the skill as Chinese-only, with no opt-in or alternative language behavior. Under SQP-3, forcing a specific language without user choice can be a locale policy violation unless the restriction is clearly justified.

Content

No source excerpt is available for this finding.