Back to skill

Security audit

Dify工作流调用

Security checks for vulnerabilities and agentic risk

Overview

This skill does what it says by sending questions to a configured Dify API, but it can transmit an API token and internal questions to an unrestricted or unencrypted endpoint.

Review the configured DIFY_API_BASE before installing or using this skill. Use only a trusted HTTPS Dify endpoint, avoid sending secrets or highly sensitive company data in prompts, and treat the advertised multi-turn and streaming features as unreliable until fixed.

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
scripts/dify_chat.py:61
Finding

Bearer Token and Confidential Queries May Be Transmitted Over Unencrypted HTTP

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • 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
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (11)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The documented behavior materially differs from the described implementation: multi-turn context is reportedly unsupported because conversation_id is fixed empty, streaming is claimed while response_mode is blocking, and the call is a general chat API rather than a constrained knowledge-base/workflow interaction. This mismatch can mislead users into sending sensitive internal queries under the false assumption of local-only, scoped, conversational behavior, increasing the chance of unintended data disclosure or policy bypass.

Content

No source excerpt is available for this finding.

Context Leakage

High
Category
Data Exfiltration
Confidence
75% confidence
Finding

Code or instructions that leak agent conversation context to external services, potentially exposing sensitive user interactions.

Content

Scanner excerpt · scripts/dify_chat.py (reported line 98)May include surrounding context.

python
try:
                        json_data = json.loads(decoded_line[6:])
                        
                        # Extract conversation_id
                        if conversation_id is None and json_data.get("conversation_id"):
                            conversation_id = json_data["conversation_id"]
                            print(f"\033[1;33m💬 Conversation ID: {conversation_id}\033[0m", file=sys.stderr)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
89% confidence
Finding

The skill documents file reads of a local config file and outbound network access to a Dify API, but it declares no explicit tool scope or permission boundaries. In an agent ecosystem, missing scope declarations can cause overbroad invocation and reduce operator visibility into what resources the skill may access or transmit to external services.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The activation criteria are broad enough to trigger on generic requests like querying a knowledge base, which may cause the agent to invoke this networked skill in more situations than users expect. In a corporate setting, overbroad routing raises the risk that sensitive prompts or proprietary documents are sent to the Dify backend without sufficiently explicit user intent.

Content

No source excerpt is available for this finding.

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

md
- Dify 服务未启动

**解决**:
1. 确认 Base URL 正确:`curl -I http://your_DIFY_API_BASE
2. 检查网络连通性
3. 验证 Dify 服务状态

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The manifest and module docs say the skill supports multi-turn conversation for a single workflow, and the CLI accepts a conversation ID argument. However, the API payload always sends an empty "conversation_id" and never uses the provided conv_id parameter, so follow-up turns are not continued as claimed.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The script transmits raw user queries to an HTTP endpoint without any user-facing disclosure or consent prompt, even though the skill is explicitly meant for internal knowledge-base usage where prompts may contain sensitive company information. In this context, users may reasonably assume a local/private action, so silent external transmission increases the risk of unintended data disclosure.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
89% confidence
Finding

The code sends user-supplied query content and an API bearer token to a configured remote service via requests.post. In a knowledge-base skill handling internal company questions, this is security-relevant because sensitive prompts can leave the local trust boundary, especially if DIFY_API_BASE is misconfigured to a non-HTTPS or untrusted endpoint.

Content

Scanner excerpt · scripts/dify_chat.py (reported line 84)May include surrounding context.

python
print("\033[0;34m🔄 Calling Dify API...\033[0m")
    
    try:
        response = requests.post(url, headers=headers, json=payload, stream=True)
        response.raise_for_status()
        
        conversation_id = None

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

L156 与 L177 的排障说明提到需要添加或配置 DIFY_WORKFLOW_ID,但前面的环境变量定义仅包含 DIFY_API_KEY、DIFY_API_BASE 和 DIFY_USER,且流程图与示例调用也都围绕 /chat-messages 对话接口展开。这属于文档内部对技能意图和所需配置的主动矛盾,容易误导用户以为该技能实际执行的是 workflow run 而非对话查询。

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
91% confidence
Finding

The natural-language description, examples, and CLI help are presented in Chinese only, with no indication that users may choose another language or that the tool is intentionally region-specific. Under the stated policy, a fixed language/locale without opt-in or justification is a natural-language policy concern.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
98% confidence
Finding

The comments say the call was changed to use streaming, but the actual payload sets "response_mode" to "blocking". This is an active contradiction between inline documentation and code behavior, especially relevant because the skill description emphasizes streamed responses.

Content

No source excerpt is available for this finding.