Back to skill

Security audit

ComfyUI TTS

Security checks for vulnerabilities and agentic risk

Overview

This TTS skill is mostly coherent, but it needs Review because unescaped settings can alter the ComfyUI workflow it submits and remote use sends text over plain HTTP.

Install only if you trust the configured ComfyUI service. Keep it bound to localhost when possible, avoid submitting secrets or private text, and harden the script by JSON-encoding all option values, validating numeric parameters, and requiring HTTPS or another protected channel for remote ComfyUI hosts.

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

Warning
Location
scripts/tts.sh:123
Finding

Unvalidated Parameters Permit ComfyUI Workflow JSON Injection

Content
View full analysis

Vulnerability Details

File Location: scripts/tts.sh, lines 123-171
Vulnerability Type: Unvalidated JSON injection
Risk Level: Medium

The script directly interpolates command-line arguments and environment-derived values into a JSON heredoc. Unlike TEXT, which is serialized with jq -R, the character, style, model, and sampling parameters are not safely encoded or validated.

bash
WORKFLOW=$(cat <<EOF
{
  "10": {
    "inputs": {
      "character": "${CHARACTER}",
      "style": "${STYLE}",
      "custom_instruct": ""
    },
    "class_type": "AILab_Qwen3TTSVoiceInstruct",
    "_meta": {
      "title": "Voice Instruct (QwenTTS)"
    }
  },
  "11": {
    "inputs": {
      "filename_prefix": "audio/ComfyUI",
      "audioUI": "",
      "audio": [
        "15",
        0
      ]
    },
    "class_type": "SaveAudio",
    "_meta": {
      "title": "保存音频"
    }
  },
  "12": {
    "inputs": {
      "audioUI": "",
      "audio": [
        "15",
        0
      ]
    },
    "class_type": "PreviewAudio",
    "_meta": {
      "title": "预览音频"
    }
  },
  "14": {
    "inputs": {
      "preview": "",
      "previewMode": null,
      "source": [
        "10",
        0
      ]
    },
    "class_type": "PreviewAny",
    "_meta": {
      "title": "预览任意"
    }
  },
  "15": {
    "inputs": {
      "text": $(echo "$TEXT" | jq -R .),
      "instruct": [
        "10",
        0
      ],
      "model_size": "${MODEL_SIZE}",
      "device": "auto",
      "precision": "bf16",
      "language": "Auto",
      "max_new_tokens": 2048,
      "do_sample": false,
      "top_p": ${TOP_P},
      "top_k": ${TOP_K},
      "temperature": ${TEMPERATURE},

Technical Analysis

Values assigned through --character, --style, --model, --temperature, --top-p, and --top-k, or their corresponding TTS_* env ...[truncated 2109 chars]

Remediation
View remediation

Remediation Suggestions

  • Construct the complete workflow and request payload with jq rather than a shell heredoc.
  • Pass strings with jq --arg so quotation marks, backslashes, and control characters are serialized safely.
  • Validate numeric options with strict regular expressions and range checks before using jq --argjson.
  • Allow-list supported model sizes such as 0.5B, 1.7B, and 3B.
  • Allow-list supported character and style identifiers if the valid values are known.
  • Reject non-finite values, JSON fragments, unexpected whitespace, and out-of-range sampling parameters.
  • Run ComfyUI with only required nodes enabled and under a dedicated, minimally privileged service account.

Example validation and safe construction pattern:

bash
case "$MODEL_SIZE" in
    0.5B|1.7B|3B) ;;
    *) echo "Error: Unsupported model size"; exit 1 ;;
esac

[[ "$TEMPERATURE" =~ ^(0(\.[0-9]+)?|1(\.0+)?)$ ]] ||
    { echo "Error: temperature must be between 0 and 1"; exit 1; }

[[ "$TOP_P" =~ ^(0(\.[0-9]+)?|1(\.0+)?)$ ]] ||
    { echo "Error: top-p must be between 0 and 1"; exit 1; }

[[ "$TOP_K" =~ ^[0-9]+$ ]] ||
    { echo "Error: top-k must be an integer"; exit 1; }

WORKFLOW=$(jq -n \
    --arg text "$TEXT" \
    --arg character "$CHARACTER" \
    --arg style "$STYLE" \
    --arg model "$MODEL_SIZE" \
    --argjson temperature "$TEMPERATURE" \
    --argjson top_p "$TOP_P" \
    --argjson top_k "$TOP_K" \
    '{
      "10": {
        inputs: {
          character: $character,
          style: $style,
          custom_instruct: ""
        },
        class_type: "AILab_Qwen3TTSVoiceInstruct"
      },
      "15": {
        inputs: {
          text: $text,
          model_size: $model,
          temperature: $temperature,
          top_p: $top_p,
          top_k: $top_k
        },
        class_type: "AILab_Qwen3TTSVoiceDesign_Advanced"
      }
    }')

T09 · Insecure Skill Coding Practices

Note
Location
scripts/tts.sh:6
Finding

Remote TTS Content and Generated Audio Are Transmitted over Plaintext HTTP

Content
View full analysis

Vulnerability Details

File Location: scripts/tts.sh, lines 6-8, 95-98, 207-211, and 340-344; scripts/test_history.sh, lines 6-13 and 71-74
Vulnerability Type: Cleartext transmission of potentially sensitive data
Risk Level: Low

Both scripts construct the ComfyUI endpoint with an unconditional http:// scheme:

bash
COMFYUI_HOST="${COMFYUI_HOST:-localhost}"
COMFYUI_PORT="${COMFYUI_PORT:-8188}"
COMFYUI_URL="http://${COMFYUI_HOST}:${COMFYUI_PORT}"

The main script sends the complete TTS workflow, including user-provided text, over this connection:

bash
RESPONSE=$(curl -s -X POST \
    -H "Content-Type: application/json" \
    -d "$PAYLOAD" \
    "${COMFYUI_URL}/prompt")

It subsequently downloads generated audio through the same plaintext endpoint:

bash
if curl -s -o "$OUTPUT_FILE" "$VIEW_URL"; then
    echo "✅ Saved to: ${OUTPUT_FILE}"
else
    echo "⚠️  Warning: Failed to download file"
fi

The diagnostic script uses the same transport configuration and submits a workflow over HTTP:

bash
COMFYUI_HOST="${COMFYUI_HOST:-localhost}"
COMFYUI_PORT="${COMFYUI_PORT:-8188}"
COMFYUI_URL="http://${COMFYUI_HOST}:${COMFYUI_PORT}"

RESPONSE=$(curl -s -X POST \
    -H "Content-Type: application/json" \
    -d "$PAYLOAD" \
    "${COMFYUI_URL}/prompt")

Technical Analysis

Plain HTTP provides neither transport confidentiality nor cryptographic server authentication. This is generally acceptable for a strictly local loopback service, but COMFYUI_HOST is configurable and may point to a remote server. In that configuration, user text, workflow metadata, job identifiers, history responses, and generated audio can cross an untrusted network in cleartext.

An on-path attacker can observe the content, alter HTTP requests or responses, impersonate the configured service, or replace the downloaded audio. The use of curl -s also suppresses useful transport d ...[truncated 1079 chars]

Remediation
View remediation

Remediation Suggestions

  • Keep the default service bound to loopback and explicitly reject non-loopback hosts unless secure transport is configured.
  • Support a full COMFYUI_URL configuration value instead of forcing the http:// scheme.
  • Require HTTPS for remote hosts and retain curl's default certificate verification.
  • Provide a trusted CA bundle or certificate-pinning option for private deployments.
  • Add an authentication mechanism, such as a scoped bearer token, if supported by the ComfyUI deployment or its reverse proxy.
  • Use curl --fail-with-body --show-error so HTTP and transport failures are not silently treated as valid responses.
  • Apply the same transport policy to scripts/test_history.sh.
  • Avoid placing authentication tokens in URLs because URLs may be exposed through logs and process inspection.

A suitable configuration pattern is:

bash
COMFYUI_URL="${COMFYUI_URL:-http://127.0.0.1:8188}"

case "$COMFYUI_URL" in
    http://127.0.0.1:*|http://localhost:*|https://*) ;;
    *)
        echo "Error: Remote ComfyUI connections must use HTTPS"
        exit 1
        ;;
esac

Requests should then use hardened curl behavior:

bash
RESPONSE=$(curl --fail-with-body --silent --show-error \
    -X POST \
    -H "Content-Type: application/json" \
    -d "$PAYLOAD" \
    "${COMFYUI_URL}/prompt")
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (5)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding

The skill invokes shell commands and external binaries (curl, jq) but does not declare any explicit tool scope such as permissions or allowed-tools. This creates an authorization and transparency gap: an agent may execute shell/network actions the user did not clearly consent to, increasing the chance of unintended command execution or data egress.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

All usage examples provide Chinese text input, and the skill references Qwen-TTS without clarifying whether the skill is multilingual or intentionally limited to Chinese. This can create a natural-language policy issue by implying a specific language expectation without an explicit user opt-in or documented justification.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
70% 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 · scripts/test_history.sh (reported line 11)May include surrounding context.

sh
COMFYUI_URL="http://${COMFYUI_HOST}:${COMFYUI_PORT}"

echo "Testing ComfyUI connection..."
if ! curl -s "${COMFYUI_URL}/system_stats" > /dev/null 2>&1; then
    echo "Error: Cannot connect to ComfyUI at ${COMFYUI_URL}"
    exit 1
fi

External Transmission

Medium
Category
Data Exfiltration
Confidence
70% 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 · scripts/tts.sh (reported line 224)May include surrounding context.

sh
)

# Submit and get prompt ID
RESPONSE=$(curl -s -X POST \
    -H "Content-Type: application/json" \
    -d "$PAYLOAD" \
    "${COMFYUI_URL}/prompt")

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
89% confidence
Finding

The documentation does not warn users that provided text is transmitted to a ComfyUI HTTP service and that generated audio is written to disk. This omission can lead to accidental disclosure of sensitive text to another service and unexpected persistence of outputs on the local filesystem.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.