Back to skill

Security audit

Genor-Comfy-Gate

Security checks for vulnerabilities and agentic risk

Overview

This is a coherent ComfyUI gateway skill, but it exposes high-impact server, file, media, and workflow controls with serious authentication and path-handling risks.

Review before installing. Run only on a trusted local machine or isolated account, set a strong API key, bind the server to 127.0.0.1 unless intentionally publishing it, avoid exposing /mcp to untrusted users, and fix path validation, media-link expiry, authentication, and PM2/admin controls before using it with sensitive files or private generated media.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
Findings (7)

T05 · Unauthorized Access and Privilege Escalation

Error
Location
lib/auth.js:3
Finding

Authentication Bypass When No API Key Is Configured

Content
View full analysis
{ ``` ### Technical Analysis If neither `API_KEY` nor `GCG_API_KEY` is configured, the effective API key is an empty string. Express can parse a query such as `?api_key=` as an empty string, causing the supplied value to equal the configured empty value. Consequently, authentication fails open rather than refusing to start or rejecting all remote requests. In addition, accepting credentials in query parameters exposes them to access logs, browser history, reverse-proxy logs, and monitoring systems. Because `app.listen(PORT)` does not specify a loopback address, Node.js normally listens on all available interfaces. The documented assumption that the gateway is local therefore does not enforce a network security boundary. ### Attack Path 1. The administrator starts the service without setting `API_KEY` or `GCG_API_KEY`. 2. The service listens on port 8188 on network-accessible interfaces. 3. A remote attacker sends a request such as: ` ...[truncated 835 chars]
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Error
Location
lib/mcp-handler.js:779
Finding

Arbitrary Local File Disclosure Through MCP Media Resources

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
lib/workflow-registry.js:121
Finding

Workflow Metadata Enables Arbitrary File Read, Overwrite, and Deletion

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
lib/mcp-handler.js:611
Finding

MCP Workflow Upload Accepts Path Traversal in Workflow IDs

Content
View full analysis
c.toUpperCase()), description: description || `Custom workflow uploaded via MCP`, type: type || 'other', file: `${workflow_id}.json`, ext: ext || 'png', editable_params: [], output_node_ids: [], submit_config: { client_id_generation: 'auto', preserve_seed: true, validation_schema: {}, }, }; const created = createWorkflow(workflowEntry); // NOW save the workflow JSON file (registry entry exists) saveWorkflowJsonFile(workflow_id, json_content); return { content: [{ type: 'text', text: JSON.stringify({ ok: true, workflow: created }, null, 2), mimeType: 'application/json', }], }; } catch (e) { return { isError: true, content: [{ type: 'text', text: `Upload failed: ${e.message}` }], }; } } ``` ### Technical Analysis The MCP handler builds a filename directly from `workflow_id` without validating it as a safe filename component. Slash characters and `..` traversal sequences therefore become part of the persisted `file` value. The handler then calls `saveWorkflowJsonFile`, which joins that unsafe filename with `WORKFLOW_DIR` and writes the supplied JSON without a containment check. Although this issue overlaps with the general w ...[truncated 1011 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
server.js:542
Finding

One-Time Media Access Tokens Are Reusable and Long-Lived

Content
View full analysis
{ const entry = oneTimeTokens.get(req.params.token); if (!entry) return res.status(404).json({ error: 'token invalid or used' }); if (Date.now() > entry.expiresAt) { oneTimeTokens.delete(req.params.token); return res.status(410).json({ error: 'token expired' }); } const parts = entry.subpath.split('/').filter(Boolean); const root = parts[0]; const file = parts.slice(1).join('/'); const fullPath = path.join(MEDIA_DIR, root, file); if (!fs.existsSync(fullPath)) return res.status(404).end(); res.set('Content-Type', contentTypeForFile(fullPath)); return fs.createReadStream(fullPath).pipe(res); }); ``` The MCP path creates similarly long-lived tokens: ```js function issueOneTimeAccessUrl(savedFile) { const subpath = path.relative(MEDIA_DIR, savedFile); const token = newToken(); const tokenDuration = 365 * 24 * 60 * 60 * 1000; oneTimeTokens.set(token, { subpath, expiresAt: Date.now() + tokenDuration }); return buildAccessUrl(token); } ``` ### Technical Analysis The token is removed only when it has expired. A successful download does not call `oneTimeTokens.delete`, so the same URL can be used repeatedly despite being documented and named as a one-time link. The default expiration is one year. The endpoint also accepts caller-controlled TTL values without a meaningful u ...[truncated 779 chars]
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Warning
Location
server.js:137
Finding

Workflow and Media Metadata Endpoints Lack Authentication

Content
View full analysis
{ const list = listWorkflowsMeta(); // Backward compat: also expose { workflows: { id: { type, ext, description } } } const workflows = {}; for (const [id, m] of Object.entries(list)) { workflows[id] = { type: m.type, ext: m.ext, description: m.description, title: m.title, }; } res.json({ workflows: list, registry: workflows }); }); app.get('/workflows/:id', (req, res) => { const w = getWorkflow(req.params.id); if (!w) return res.status(404).json({ error: 'Workflow not found' }); return res.json(w); }); ``` ```js app.get('/workflows/:id/preview', (req, res) => { const schema = previewSchema(req.params.id); if (!schema) return res.status(404).json({ error: 'Workflow not found' }); return res.json(schema); }); ``` ```js app.get('/media-list', (req, res) => { res.json( listMedia({ type: req.query.type, q: req.query.q || req.query.search, limit: req.query.limit, }), ); }); ``` ### Technical Analysis These routes omit the `auth` middleware used by other gateway endpoints. This is inconsistent with the documented gateway-wide API-key authentication model. The workflow-detail route returns the complete metadata object rather than a minimal public projection. The media-list route exposes generated filenames, sizes, timestamps, and media URLs. Even where direct media retrieval remains protected, metadata can reveal user activity, prompt-related naming, generated content types, workflow capabilities, and operational patterns. ### Attack Path 1. A remote party reaches the gateway on port 8188. 2. Without supplying an API key, the party requests: - `/workflows` - `/workflows/:id` - `/workflows/:id/preview` - `/m ...[truncated 551 chars]
Remediation
View remediation

T08 · Insecure Dependencies

Warning
Location
autobuild.sh:8
Finding

Installation and Update Scripts Execute Mutable, Insufficiently Pinned Dependencies and Source

Content
View full analysis
/dev/null; then echo " Installing PM2..." npm install -g pm2 fi # 4. Register with PM2 echo "→ Registering with PM2..." pm2 start pm2-ecosystem.config.cjs 2>/dev/null || pm2 restart genor-comfy-gate 2>/dev/null || true pm2 save ``` From `autobuild.sh`: ```bash echo "Fetching latest changes..." git pull || echo "No git repo or already up to date" echo "Installing dependencies..." npm install --production # Restart via PM2 (if already running) or start if not if pm2 list | grep -q genor-comfy-gate; then echo "Restarting genor-comfy-gate via PM2..." pm2 restart genor-comfy-gate else echo "Starting genor-comfy-gate via PM2..." pm2 start pm2-ecosystem.config.cjs fi pm2 save ``` ### Technical Analysis The installer globally installs PM2 without specifying a version or recording it in the project lockfile. Global installation expands the privilege and supply-chain impact and makes the resulting environment difficult to reproduce. The update script performs `git pull`, installs dependencies with `npm install`, and immediately restarts the persistent PM2 service. There is no commit pinning, signed-tag verification, source review gate, or deployment approval between retrieval and execution. The checked package lock uses the official npm registry, and no malicious dependency was identified during this audit. The risk arises from the deployment process and its trust in mutable future upstream state. The flagged `SKIL ...[truncated 1109 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • System Prompt LeakageDirect Leakage, Indirect Extraction, Tool-Based Exfiltration
Findings (28)

Credential Access

High
Category
Privilege Escalation
Confidence
89% confidence
Finding

The skill documents a one-time token endpoint that allows media access without an API key. If tokens are guessable, logged, leaked via referrers, or exposed in chat/output, generated files could be retrieved by unauthorized parties despite normal authentication controls.

Content

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

md
| Method | Path | Description |
|--------|------|-------------|
| GET | `/media-list` | List generated files (name, size, date, preview URLs) |
| POST | `/media-link-once` | Create one-time access token for a file |
| GET | `/media-once/:token` | Access file via one-time token (no API key needed) |

### Workflow Injection

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

Status Check

bash
curl -s http://127.0.0.1:8188/ | python3 -m json.tool
curl -s http://127.0.0.1:8188/queue | python3 -m json.tool

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

Status Check

bash
curl -s http://127.0.0.1:8188/ | python3 -m json.tool
curl -s http://127.0.0.1:8188/queue | python3 -m json.tool

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

Status Check

bash
curl -s http://127.0.0.1:8188/ | python3 -m json.tool
curl -s http://127.0.0.1:8188/queue | python3 -m json.tool

Media Location

Self-Modification

High
Category
Rogue Agent
Confidence
94% confidence
Finding

The instruction to update SKILL.md and CHANGELOG.md encourages self-modification of the skill's own guidance. In an agent setting, this can create persistence for prompt-injected or attacker-influenced instructions, allowing unsafe behavior to survive beyond the current session and alter future executions.

Content

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

md
### Growing Our Knowledge
When we discover new caption patterns, texture word effects, or workflow tricks:
1. Update this SKILL.md
2. Note the date and what we learned in `CHANGELOG.md` (next to this skill)

---

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

| Stop | pm2 stop genor-comfy-gate | | Logs | pm2 logs genor-comfy-gate | | Status | pm2 list \| grep genor-comfy-gate | | Health check | curl -s http://127.0.0.1:8188/ \| python3 -m json.tool |

First-Time Setup Flow

bash

Direct Prompt Extraction

High
Category
System Prompt Leakage
Confidence
85% confidence
Finding

Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.

Content

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

md
mode: {
          type: 'string',
          enum: ['sync', 'auto'],
          description: 'sync (default): block until done, return access_url. auto: submit async, return prompt_id.',
          default: 'sync',
        },
      },

Direct Prompt Extraction

High
Category
System Prompt Leakage
Confidence
85% confidence
Finding

Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.

Content

Scanner excerpt · lib/mcp-handler.js (reported line 93)May include surrounding context.

js
mode: {
          type: 'string',
          enum: ['sync', 'auto'],
          description: 'sync (default): block until done, return access_url. auto: submit async, return prompt_id.',
          default: 'sync',
        },
      },

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The MCP surface exposes a restart tool that directly invokes pm2 restart genor-comfy-gate, giving any caller with tool access operational control over the gateway process. In an LLM-accessible media-generation gateway, this is dangerous because it enables denial of service, disruption of active jobs, and abuse of the agent to perform infrastructure actions unrelated to normal media generation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The checklist section is written as mandatory instructions in Polish ('OBOWIĄZKOWA CHECKLISTA', 'musisz'), which imposes a specific language on operators without offering a language choice. This matches the locale-policy violation criterion because the file does not provide opt-in, alternatives, or a documented reason that the skill must operate in Polish.

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

POST /generate-and-wait — Full Reference

bash
curl -s -X POST http://127.0.0.1:8188/generate-and-wait \
  -H "Content-Type: application/json" \
  -d '{
    "workflow": "acestep-rapcore",

Session Persistence

Medium
Category
Rogue Agent
Confidence
80% confidence
Finding

The documented workflow addition process includes modifying server.js and persisting new workflow definitions, which expands future agent behavior beyond the current task. If an agent follows these instructions automatically, untrusted workflow names or parameters could become durable configuration changes and widen the attack surface.

Content

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

Adding a New Workflow (any modality)

  1. Export workflow JSON from ComfyUI → save to workflows/<name>.json
  2. Add entry to WORKFLOW_INFO in server.js:
    js
    '<name>': { file: '<name>.json', type: 'audio'|'image'|'video', ext: 'mp3'|'png'|'mp4',
                promptNode: '94', promptField: 'tags', lyricsNode: '252', lyricsField: 'String',
    

Session Persistence

Medium
Category
Rogue Agent
Confidence
82% confidence
Finding

The install flow explicitly creates directories, workspace state, and PM2 saved processes, which establishes persistence on the host. In an agent environment, persistent services and saved process managers can outlive the initiating session and continue handling data or commands without renewed authorization.

Content

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

cd ~/.openclaw/workspace/projects/Genor-Comfy-Gate bash install.sh

text
Does everything: `npm install` → create media dirs → create workspace → PM2 start/save.

### One-Command Auto-build & Restart
```bash

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

No manifest is available, so there is no declared purpose that would justify accessing secret material from process environment. This file implements credential loading from environment variables, which is a sensitive capability not clearly tied to an unknown-purpose skill.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The restart action is immediately executable and has no in-code warning, consent gate, or confirmation mechanism at execution time. In an agent setting, this increases the chance of accidental or prompt-induced disruptive actions, allowing a model or user to take the service offline without a meaningful safety barrier.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The upload_workflow tool allows callers to persist new workflow definitions and register them for future use, expanding the service from transient generation into persistent configuration mutation. This broadens the attack surface by allowing unauthorized modification of server state, storage abuse, and introduction of malicious or unsafe workflows that later users or agents may invoke.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The workflow upload path writes persistent files and updates the registry without any execution-time disclosure, approval, or review step. In an MCP/LLM context, silent persistent mutation is risky because an agent may be induced to change server state in ways the operator did not intend, creating durable and hard-to-detect changes.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The code persists generated media and a JSON sidecar containing workflow and user-supplied metadata to disk under a stable workspace path, but there is no indication of consent, retention controls, minimization, or protection of potentially sensitive content. In a media-generation context, prompts, artist/title fields, and generated outputs can reveal private user interests or proprietary material, so silent persistence increases privacy and data exposure risk if the host is shared, backed up, or later served through the media endpoint.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The code deletes a workflow file from disk using fs.unlinkSync when a registry entry has an associated file. Although the function name implies deletion, there is no confirmation prompt, warning comment, or user-facing disclosure near this destructive operation in the file.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The '/media-list' endpoint is exposed without the 'auth' middleware, allowing unauthenticated users to enumerate stored media metadata and likely discover user-generated files. Even if the files themselves require authentication in some paths, unauthenticated listing leaks existence, names, and searchable attributes of stored content, which is a privacy and information disclosure issue.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The '/media-once/:token' endpoint does not invalidate the token after a successful fetch, so a supposedly one-time link can be reused until expiration. This breaks the security expectation implied by the feature name and enables anyone who obtains the URL to repeatedly access the file for the full token lifetime, which is especially concerning because the default TTL is effectively one year.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The '/media-once/:token' endpoint serves files without authentication, and combined with reusable long-lived tokens it creates public access links to stored media. In this gateway context, generated media may contain sensitive or user-specific content, so leaked URLs can expose private assets to unintended parties.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

The file reads API credentials from environment variables via process.env.API_KEY and process.env.GCG_API_KEY, but provides no user-facing log, warning, or explanatory comment about this sensitive credential access. Under the code-file criteria, access to sensitive environment variables should have some form of disclosure unless already documented elsewhere in this file.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
81% confidence
Finding

This function writes workflow JSON content directly to a file with fs.writeFileSync, modifying user/project data on disk. The file does not provide a warning comment, docstring, confirmation, or user-facing log around this write operation.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
79% confidence
Finding

The importWorkflow function writes a workflow JSON file to the workflows directory and updates the registry, which changes on-disk project state. While importing implies persistence, the file lacks an explicit warning, confirmation, or nearby disclosure that this operation creates or overwrites workflow files.

Content

No source excerpt is available for this finding.