Back to skill

Security audit

magic-text2video

Security checks for vulnerabilities and agentic risk

Overview

This text-to-video skill has a coherent purpose, but its instructions and client create avoidable risks around local command execution and API-key exposure.

Review before installing. Use only non-sensitive text, rotate MAGIC_API_KEY if this client was used on untrusted networks, and do not run the documented shell command with raw user text. The publisher should restore normal TLS verification and change the invocation guidance to pass text through a structured no-shell argument API or stdin.

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
scripts/media_gen_client.py:50
Finding
TLS Certificate and Hostname Verification Disabled<![CDATA[ ## Vulnerability Details **File Location**: `scripts/media_gen_client.py:50-54` **Vulnerability Type**: Improper certificate validation **Risk Level**: High ### Vulnerable Code ```python try: ctx = ssl.create_default_context() ctx.check_hostname = False ctx.verify_mode = ssl.CERT_NONE with urllib.request.urlopen(req, timeout=timeout_s, context=ctx) as resp: ``` ### Technical Analysis The client creates a default TLS context but then explicitly disables hostname verification and certificate-chain validation. Consequently, the HTTPS connection provides encryption without reliable authentication of the remote server. This setting applies to every request made through `_http_request_json`, including video creation and task-status polling. Those requests carry the `MAGIC_API_KEY` in the `Authorization: Bearer` header. Video creation requests also contain the complete user-provided text. Sending the API key and user content to the declared remote generation service is necessary for the Skill's functionality. Disabling TLS verification is not necessary and exceeds acceptable handling risk for those sensitive values. ### Attack Path 1. An attacker obtains a network interception position, such as through a malicious Wi-Fi access point, compromised proxy, DNS manipulation, or routing attack. 2. The attacker redirects or intercepts a request intended for `open-test.magiclight.ai`. 3. The attacker presents an arbitrary or self-signed TLS certificate. 4. Because both certificate verification and hostname checking are disabled, the client accepts the attacker's endpoint. 5. The client transmits the bearer API key and, during task creation, the user's complete text to the attacker. 6. The attacker can return forged task JSON, including a fabricated task ID, status, or attacker-controlled video URL. ### Impact Assessment A successful attacker can obtain the `MAGIC_API_KEY` and any user text submitted for video generation. The stolen key may p ...[truncated 516 chars]
Remediation
<![CDATA[ ## Remediation Suggestions Use Python's default verified TLS behavior and do not override certificate or hostname checks: ```python ctx = ssl.create_default_context() with urllib.request.urlopen(req, timeout=timeout_s, context=ctx) as resp: raw = resp.read().decode("utf-8") ``` Alternatively, omit the custom context entirely and allow `urllib.request.urlopen` to use the platform's trusted certificate store. Additional hardening should include: 1. Never introduce a fallback that retries with certificate verification disabled. 2. Fail closed and return a clear network error when certificate validation fails. 3. If the service uses a private certificate authority, load only that CA through `SSLContext.load_verify_locations()` rather than disabling validation. 4. Consider certificate or public-key pinning only if the service has a reliable certificate-rotation process. 5. Rotate the API credential if the vulnerable client has been used over untrusted networks. 6. Avoid logging authorization headers or full sensitive request bodies while diagnosing TLS failures. ]]>

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:47
Finding
Shell Command Injection Through Documented User-Text Interpolation<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:47-56` **Vulnerability Type**: Shell command injection **Risk Level**: Critical ### Vulnerable Instructions ```markdown 1. Extract the text the user wants to generate a video from and assign it to `TEXT`. - If the text contains double quotes `"`, properly escape them before constructing the command (for example, by replacing `"` with `\"`) to avoid shell parsing errors. 2. Run the following command (executed by the agent/tool; `{baseDir}` will be replaced with the Skill directory): ```bash python3 {baseDir}/scripts/media_gen_client.py video-create \ --text "TEXT" ``` ``` ### Technical Analysis The Skill directs the Agent to interpolate untrusted user text into a shell command. It recommends escaping only double-quote characters, which does not prevent shell evaluation inside a double-quoted argument. In common POSIX shells, command substitutions such as `$(command)` and backtick substitutions remain active inside double quotes. Shell metacharacters embedded through a quote-breaking payload may also alter command structure if escaping is incomplete or implemented inconsistently. The Python client itself uses `argparse` and does not invoke a shell. The vulnerability arises from the execution procedure prescribed by `SKILL.md`, where the Agent or tool may construct and execute a shell command containing attacker-controlled text. Shell interpretation is unnecessary for the declared text-to-video functionality and violates least-privilege input handling. ### Attack Path 1. An attacker asks the Skill to create a video from text containing a shell substitution, for example: `Create a video saying $(id > /tmp/proof)`. 2. Following `SKILL.md`, the Agent substitutes that text into the documented double-quoted `--text` argument. 3. The shell evaluates `$(id > /tmp/proof)` before starting the Python process. 4. The injected command executes with the operating-system permissions of the Agent or t ...[truncated 1070 chars]
Remediation
<![CDATA[ ## Remediation Suggestions Do not interpolate user text into a shell command. Invoke the client with a structured argument array so no shell parses the input. Conceptually, the execution interface should be equivalent to: ```python subprocess.run( [ "python3", f"{base_dir}/scripts/media_gen_client.py", "video-create", "--text", user_text, ], check=True, shell=False, ) ``` Update `SKILL.md` to require a no-shell tool invocation and explicitly prohibit composing a command string from user input. If the execution environment supports only shell commands, redesign the client to accept text through standard input or a securely created input file. For example, add a `--text-stdin` mode and send the text through the process's stdin using a structured process API. Further hardening should include: 1. Treat all user-provided video text as opaque data. 2. Do not rely on ad hoc escaping, shell quoting, blacklists, or replacement of selected metacharacters. 3. Keep `shell=False` when using process APIs. 4. Add regression tests using inputs containing `$()`, backticks, quotes, semicolons, newlines, backslashes, and Unicode characters. 5. Run the Skill under a restricted account or sandbox with minimal filesystem and network permissions to reduce impact if another injection defect is introduced. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (6)

Tainted flow: 'req' from os.environ.get (line 55, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Content
ctx = ssl.create_default_context()
        ctx.check_hostname = False
        ctx.verify_mode = ssl.CERT_NONE
        with urllib.request.urlopen(req, timeout=timeout_s, context=ctx) as resp:
            raw = resp.read().decode("utf-8")
            return json.loads(raw) if raw else {}
    except urllib.error.HTTPError as e:
Confidence
99% confidence
Finding
This is a real security issue, primarily because TLS certificate validation and hostname verification are explicitly disabled before sending the request. That means the Bearer API key and user-supplied prompt can be intercepted or modified by a man-in-the-middle attacker, making the environment-to-network taint especially dangerous in this skill because it handles credentials for a remote service.

Lp3

Medium
Category
MCP Least Privilege
Confidence
94% confidence
Finding
The skill invokes Python code that uses both an environment-provided API key and outbound network access, but it declares no explicit tool scope or allowed-tools boundary. This weakens policy enforcement and reviewability, increasing the risk that the skill can access capabilities beyond what users or operators expect.

Missing User Warnings

Medium
Confidence
97% confidence
Finding
The skill tells the agent to submit user-provided text to a remote video service, but the user-facing description does not clearly warn that their prompt content will leave the local environment over an API call. This can cause inadvertent disclosure of sensitive or regulated text because users may reasonably assume the content is processed locally.

Missing User Warnings

Medium
Confidence
92% confidence
Finding
The client sends the user-provided --text value to a remote service and includes a bearer API key in the request, but there is no confirmation prompt or explicit user-facing warning in the CLI help or output that data will be transmitted off-system. For a code file, network transmission of user or system data should have some visible disclosure unless already clearly warned elsewhere.

Natural-Language Policy Violations

Low
Confidence
81% confidence
Finding
The invocation examples are written only in Chinese, which imposes a language-specific interaction pattern without stating that the skill is region-specific or offering alternative language options. Under the language/locale policy, skills should either allow user choice or clearly justify a locale restriction.

Intent-Code Divergence

Low
Confidence
97% confidence
Finding
The top-level parser description on L129 says "image & video generation," but every implemented subcommand in this file is limited to video-create, video-status, and video-wait. This is an active documentation mismatch about the tool's capabilities rather than a mere omission.

Static analysis

No suspicious patterns detected.