Back to skill

Security audit

Comfyui-Api

Security checks for vulnerabilities and agentic risk

Overview

This ComfyUI image skill is mostly coherent, but it exposes under-documented remote controls and can upload arbitrary local files to a configurable server.

Install only if you trust the configured ComfyUI server and are comfortable with the skill sending prompts there. Avoid using the upload command for sensitive paths, keys, configs, documents, or workspace files; the artifact does not constrain uploads to image directories or trusted destinations. Be aware that it can also inspect and mutate the remote ComfyUI queue beyond simple generation.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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)

T05 · Unauthorized Access and Privilege Escalation

Warning
Location
comfyui.py:243
Finding

Unrestricted Local File Upload to a User-Configurable Remote Server

Content
View full analysis

Vulnerability Details

File Location: comfyui.py:243-255, with command exposure at comfyui.py:700-710 and comfyui.py:738-755
Vulnerability Type: Arbitrary local file read and remote upload
Risk Level: Medium

Vulnerable Code

python
async def upload_file(self, file_path: str, subfolder: str = "", filename: str = None) -> Dict[str, Any]:
    """Upload an image file to the server"""
    try:
        session = await self._get_session()
        with open(file_path, 'rb') as f:
            data = aiohttp.FormData()
            data.add_field('image', f, filename=filename or os.path.basename(file_path))
            data.add_field('subfolder', subfolder)
            data.add_field('type', 'input')
            
            async with session.post(f"{self.server_url}/upload/image", data=data) as resp:
                return await resp.json()
    except Exception as e:
        return {"error": str(e)}

The unrestricted method is exposed through a command handler:

python
async def handle_upload(args: List[str]) -> Dict[str, Any]:
    comfy = await get_comfyui()
    if not comfy.server_url:
        return {"error": "Please configure the server address first"}
    if not args:
        return {"error": "Usage: upload <file_path> [subfolder] [filename]"}
    
    file_path = args[0]
    subfolder = args[1] if len(args) > 1 else ""
    filename = args[2] if len(args) > 2 else None
    
    return await comfy.upload_file(file_path, subfolder, filename)

It is registered in the public command dispatcher:

python
handlers = {
    "set_url": handle_set_url,
    "status": handle_status,
    "generate": handle_generate,
    "sys_stats": handle_system_stats,
    "queue": handle_queue_status,
    "history": handle_history,
    "submit": handle_submit_task,
    "cancel": handle_cancel_task,
    "interrupt": handle_interrupt,
    "models": 
...[truncated 2516 chars]
Remediation
View remediation

Remediation Suggestions

  1. Remove the upload command if local-file uploads are not essential to the intended text-to-image feature.
  2. If uploads are required, restrict source files to a dedicated, explicitly configured upload directory.
  3. Resolve the requested path with pathlib.Path.resolve() and verify that it remains beneath the allowed directory before opening it. Reject traversal, symbolic-link escapes, absolute paths outside the boundary, and special device files.
  4. Validate uploads as expected image formats using file signatures or a trusted image parser rather than relying only on extensions.
  5. Enforce conservative file-size limits and permit only regular files.
  6. Require explicit user confirmation that displays the canonical source path and destination hostname before transmission.
  7. Restrict destinations to HTTPS servers on an explicit trusted-host allowlist. Reject arbitrary loopback, link-local, private-network, and untrusted external destinations where they are not required.
  8. Separate file-upload permission from ordinary generation permission so callers allowed to generate images do not automatically receive filesystem-read capability.
  9. Document the upload feature, destination behavior, and required filesystem and network permissions in SKILL.md.
  10. Avoid returning raw exception messages to untrusted callers because they may disclose local paths or network details; log detailed errors securely and return a generic failure response.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (10)

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill says any user input containing a URL will automatically set the connection target, which creates an overly broad activation boundary. This can cause unintended server reconfiguration from ordinary conversation or pasted content, potentially redirecting requests to attacker-controlled or internal endpoints and enabling SSRF-like behavior or data exfiltration through the image-generation backend.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

Mandating automatic translation of Chinese prompts into English without user choice changes user input before transmission and may expose meaning the user did not intend to send verbatim. This can create privacy, integrity, and safety issues because nuanced or sensitive prompts are silently transformed, and users cannot verify or opt out of the modified outbound content.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

User prompts are transmitted to a remote ComfyUI server without clear disclosure that prompt contents leave the local environment. Prompts can contain sensitive business data, personal data, or proprietary creative content, so silent network transmission creates a privacy and data-handling risk.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill’s stated purpose is simple image generation, but it also exposes queue cancellation, interrupt, history inspection, model enumeration, system stats, and file upload operations against the configured ComfyUI server. This expands the capability surface beyond user expectations and can enable unintended remote administration or data transfer if the server URL points to a sensitive or shared instance.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The upload feature reads an arbitrary local file path and sends the file contents to the configured remote server with no user-facing warning about exfiltration, trust boundary crossing, or privacy impact. In an agent setting, this can cause accidental disclosure of sensitive local files if the server is untrusted or attacker-controlled.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The workflow builder unconditionally translates the user's prompt to English before generation, and command handlers also translate prompts automatically. This imposes a specific language behavior without user choice, which matches the locale/language policy violation category.

Content

No source excerpt is available for this finding.

Cloud Storage Exfiltration

Medium
Category
Data Exfiltration
Confidence
55% confidence
Finding

Data is uploaded to cloud storage (S3 / GCS / Azure Blob). This may be a legitimate backup or exfiltration to an external bucket. Manual review is recommended.

Content

Scanner excerpt · comfyui.py (reported line 710)May include surrounding context.

python
subfolder = args[1] if len(args) > 1 else ""
    filename = args[2] if len(args) > 2 else None
    
    return await comfy.upload_file(file_path, subfolder, filename)

async def handle_help(args: List[str]) -> str:
    return """╔══════════════════════════════════════╗

Vague Triggers

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

The phrase indicating users can directly input prompts to generate images does not clearly separate normal conversation from command invocation. In an agent setting, ambiguous activation boundaries can cause accidental tool execution on conversational text, leading to unintended requests to the configured backend and reduced user control.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

The header documents only POST /api/prompt and WS /ws, suggesting a narrow API surface, but the implementation also calls /queue, /history, /system_stats, /prompt, /interrupt, /upload/image, /object_info, and /view. This creates a description-behavior mismatch about the breadth of remote operations the skill performs.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
85% confidence
Finding

Several status/error messages and the help output are presented in Chinese regardless of the user's preferred language. Because the file does not provide a language-selection mechanism or document a region-specific constraint, this is a natural-language policy concern.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.