Back to skill

Security audit

media-processor

Security checks for vulnerabilities and agentic risk

Overview

This is a disclosed media-processing skill, but it accepts unrestricted remote URLs and raw output paths in ways that can reach internal networks or overwrite writable files.

Install only in an isolated environment with restricted network egress and a dedicated output directory. Avoid giving it untrusted URLs or arbitrary output paths until it adds URL allowlisting, private-network blocking, download size/time limits, safer FFmpeg handling, and pinned dependencies.

Vulnerability Patterns
  • 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
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
Findings (4)

T09 · Insecure Skill Coding Practices

Error
Location
run.py:14
Finding

Unrestricted Remote URL Fetching Enables Server-Side Request Forgery

Content
View full analysis

Vulnerability Details

File Location: run.py:14-28, run.py:112-131
Vulnerability Type: Server-Side Request Forgery (SSRF)
Risk Level: High

Vulnerable Code

python
def is_url(path):
    return path.startswith(('http://', 'https://'))

def download_file(url, suffix):
    try:
        fd, temp_path = tempfile.mkstemp(suffix=suffix)
        os.close(fd)
        print(f"正在下载: {url} -> {temp_path}")
        
        # 使用 Request 对象添加 User-Agent 避免 403
        req = urllib.request.Request(url, headers={'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36'})
        with urllib.request.urlopen(req) as response, open(temp_path, 'wb') as out_file:
            out_file.write(response.read())
            
        return temp_path
    except Exception as e:
        print(f"错误: 下载失败: {str(e)}")
        return None
python
# 如果是 URL,先下载(如果是视频,ffmpeg 支持直接传 URL,但为了统一逻辑和 output 命名,图片必须下载)
if is_url(input_path):
    if args.type == 'image':
        suffix = ".jpg" if args.action != 'watermark' else ".png"
        input_path = download_file(args.input, suffix)
        if not input_path:
            sys.exit(1)
        temp_files.append(input_path)
    else:
        # 视频 URL 也可以下载,或者让 ffmpeg 直接处理。
        # 为了获取更好的 output 文件名,建议 m3u8 以外的下载,
        # 但 m3u8 必须让 ffmpeg 处理。
        if "m3u8" in args.input:
            pass # ffmpeg direct
        else:
            input_path = download_file(args.input, ".mp4")
            if not input_path:
                sys.exit(1)
            temp_files.append(input_path)

Technical Analysis

The application treats every string beginning with http:// or https:// as a permitted remote resource. It performs no destination validation, DNS resolution checks, redirect validation, port restriction, or host allowlisting.

Consequently, an un ...[truncated 1705 chars]

Remediation
View remediation

Remediation Suggestions

  • Prefer an explicit allowlist of trusted media domains.
  • Resolve hostnames before connecting and reject loopback, private, link-local, multicast, reserved, unspecified, and metadata-service addresses for both IPv4 and IPv6.
  • Revalidate the resolved destination after every redirect and protect against DNS rebinding.
  • Restrict permitted schemes to HTTPS where possible and allow only required destination ports.
  • Apply the same policy to m3u8 playlists, nested playlists, encryption-key URLs, and segment URLs.
  • Do not pass untrusted network URLs directly to unrestricted FFmpeg. Use a controlled downloader or run FFmpeg in an isolated environment with restricted egress.
  • Add network-level egress filtering as defense in depth.

T09 · Insecure Skill Coding Practices

Warning
Location
run.py:23
Finding

Unbounded Remote Downloads Permit Memory, Disk, and Worker Exhaustion

Content
View full analysis

Vulnerability Details

File Location: run.py:17-28, especially run.py:23-24
Vulnerability Type: Uncontrolled Resource Consumption
Risk Level: Medium

Vulnerable Code

python
def download_file(url, suffix):
    try:
        fd, temp_path = tempfile.mkstemp(suffix=suffix)
        os.close(fd)
        print(f"正在下载: {url} -> {temp_path}")
        
        # 使用 Request 对象添加 User-Agent 避免 403
        req = urllib.request.Request(url, headers={'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36'})
        with urllib.request.urlopen(req) as response, open(temp_path, 'wb') as out_file:
            out_file.write(response.read())
            
        return temp_path
    except Exception as e:
        print(f"错误: 下载失败: {str(e)}")
        return None

Technical Analysis

response.read() reads the entire response body into memory before writing it to the temporary file. The operation has no maximum response size, connection timeout, read timeout, bandwidth limit, content-type validation, or processing-duration limit.

A large response can therefore consume both process memory and temporary storage. A slow or non-terminating response can retain the worker indefinitely. After download, maliciously complex image or video content can impose additional decoder and transcoder resource costs.

Attack Path

  1. An attacker supplies a URL under their control as --input.
  2. The remote server returns a very large body, streams data indefinitely, or sends data extremely slowly.
  3. response.read() continues buffering the body without enforcing a byte limit.
  4. The process consumes excessive memory and subsequently writes the response to temporary storage.
  5. The worker becomes unavailable, crashes, or contributes to host-wide memory or disk exhaustion.
  6. Repeated or concurrent invocations amplify the deni ...[truncated 390 chars]
Remediation
View remediation

Remediation Suggestions

  • Configure explicit connection and read timeouts.
  • Read the response in fixed-size chunks instead of calling unbounded response.read().
  • Track cumulative bytes and abort when a documented maximum media size is exceeded.
  • Reject oversized Content-Length values, while still enforcing the runtime limit because that header is optional and untrusted.
  • Validate expected media content types and inspect file signatures before processing.
  • Limit image dimensions, frame counts, video duration, bitrate, and transcoding time.
  • Run media decoding and FFmpeg in resource-constrained workers using memory, CPU, disk, process, and execution-time limits.
  • Apply request concurrency and per-caller rate limits.
  • Ensure partially downloaded temporary files are removed after failures and cancellations.

T09 · Insecure Skill Coding Practices

Warning
Location
run.py:106
Finding

Caller-Controlled Output Paths Allow Destructive File Overwrites

Content
View full analysis

Vulnerability Details

File Location: run.py:30-36, run.py:38-55, run.py:82-88, run.py:106, run.py:147-154
Vulnerability Type: Arbitrary File Overwrite
Risk Level: Medium

Vulnerable Code

python
def compress_image(input_path, output_path, quality=85):
    try:
        img = Image.open(input_path)
        if img.mode in ("RGBA", "P"):
            img = img.convert("RGB")
        img.save(output_path, "JPEG", quality=quality, optimize=True)
        print(f"成功: 图片压缩完成 -> {output_path}")
    except Exception as e:
        print(f"错误: 图片压缩失败: {str(e)}")
python
def add_image_watermark(input_path, output_path, text="OpenClaw"):
    try:
        img = Image.open(input_path)
        draw = ImageDraw.Draw(img)
        # 简单水印逻辑:右下角绘制文字
        width, height = img.size
        # 尝试加载中文字体,如果不存在则使用默认
        try:
            font = ImageFont.truetype("/usr/share/fonts/truetype/wqy/wqy-zenhei.ttc", int(height/20))
        except:
            font = ImageFont.load_default()
        
        draw.text((width - width/4, height - height/10), text, fill=(255, 255, 255, 128), font=font)
        img.save(output_path)
        print(f"成功: 图片水印添加完成 -> {output_path}")
    except Exception as e:
        print(f"错误: 图片水印添加失败: {str(e)}")
python
print(f"正在执行 FFmpeg 处理: {action}...")
stream.overwrite_output().run(capture_stdout=True, capture_stderr=True)
print(f"成功: 视频 {action} 完成 -> {output_path}")
python
parser.add_argument('--output', help='输出文件路径')
python
try:
    if args.type == 'image':
        if args.action == 'compress' or args.action == 'convert':
            compress_image(input_path, args.output)
        elif args.action == 'watermark':
            add_image_watermark(input_path, args.output, args.text)
    elif args.type == 'video':
        process_video(input_path, args.output, args.action)

Technical An

...[truncated 1665 chars]

Remediation
View remediation

Remediation Suggestions

  • Restrict all generated files to a dedicated output directory owned by the service.
  • Canonicalize the requested destination and verify that it remains beneath the approved directory.
  • Reject absolute paths and path traversal when callers should provide only output names.
  • Reject symbolic links and use race-resistant file-opening techniques.
  • Create new outputs atomically with exclusive-create semantics and deny replacement of existing files by default.
  • Remove unconditional FFmpeg overwrite behavior, or permit overwrite only after trusted authorization.
  • Run the skill as a dedicated, unprivileged operating-system account with no write access to application code, configuration, credentials, or shared system paths.
  • Return a service-generated output identifier rather than accepting a raw filesystem path from untrusted callers.

T08 · Insecure Dependencies

Note
Location
requirements.txt:1
Finding

Mutable and Unverified Dependency Constraints Prevent Reproducible Installation

Content
View full analysis

Vulnerability Details

File Location: requirements.txt:1-3; related installation guidance at README.md:36-40
Vulnerability Type: Unpinned Third-Party Dependencies
Risk Level: Low

Vulnerable Code

text
Pillow>=10.0.0
ffmpeg-python>=0.2.0
static-ffmpeg>=2.5.0

Related installation guidance:

bash
pip install -r requirements.txt

# If an externally managed environment error occurs (PEP 668), use:
pip install -r requirements.txt --break-system-packages

Technical Analysis

Each dependency uses only a lower-bound version constraint. Installation may therefore select any later release available from the configured package index. The project provides no lockfile or cryptographic hashes to verify the exact artifacts installed.

This does not establish that any named dependency is malicious. The weakness is that reviewed and deployed dependency sets can differ over time, allowing future compromised, vulnerable, or incompatible releases to enter the environment without a project change. The documented --break-system-packages option also weakens environment isolation and can modify a shared system Python environment.

Attack Path

  1. An administrator installs the project from requirements.txt.
  2. The package resolver selects versions available at installation time rather than a fixed, reviewed set.
  3. A future compromised, vulnerable, or behaviorally incompatible release satisfying the lower-bound constraint is selected.
  4. Package installation or later import executes code from that artifact.
  5. If installed with elevated privileges or into a shared system environment, the impact extends to that environment and its dependent applications.

Impact Assessment

No currently malicious dependency was identified from the audited files. The potential impact depends on a future or repository-level supply-chain compromise and the privileges used during installation. A compromis ...[truncated 195 chars]

Remediation
View remediation

Remediation Suggestions

  • Pin each dependency to an exact, reviewed version.
  • Generate and commit a lockfile suitable for the deployment platform.
  • Require hashes for downloaded artifacts where supported.
  • Install from a trusted package index and review transitive dependencies.
  • Use automated vulnerability and provenance scanning in continuous integration.
  • Install into an isolated virtual environment or container.
  • Remove the recommendation to use --break-system-packages.
  • Define a controlled dependency-update process that reviews and tests new versions before deployment.
Vulnerability Patterns
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (9)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
93% confidence
Finding

The skill invokes a local Python command and explicitly accepts remote URLs as input, which gives it both shell-execution and network-fetch capability, yet the manifest declares no permissions or allowed-tools scope. That omission weakens policy enforcement and user awareness, increasing the chance the skill is run with broader authority than intended for downloading and writing files.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The markdown states that the skill will download remote media and auto-generate output files, but it does not clearly warn users about outbound network access or filesystem writes. In a media-processing context this is functional, but the lack of explicit disclosure makes unintended SSRF-style fetches, unexpected data transfer, or silent file creation more likely.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
91% confidence
Finding

The README explicitly advertises fetching and processing remote HTTP/HTTPS and m3u8 media, but it does not clearly warn users that this causes outbound network access and ingestion of untrusted content. In an agent setting, that increases the risk of SSRF-style access to internal resources, unexpected data egress, and exposure of downstream media parsers such as FFmpeg to malformed or hostile files.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

The manifest description forces a specific language/locale in user-facing text, and the rest of the document is likewise written in Chinese. Under the stated policy, language constraints should offer user choice or be explicitly documented as a justified locale-specific limitation.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
96% confidence
Finding

The dependency is specified with a lower-bound only, which allows installation of any newer release and makes builds non-reproducible. In a media-processing skill that handles untrusted images and video, this increases supply-chain and patch-validation risk because different environments may resolve to different versions with different security properties.

Content

Scanner excerpt · requirements.txt (reported line 1)May include surrounding context.

text
Pillow>=10.0.0
ffmpeg-python>=0.2.0
static-ffmpeg>=2.5.0

Unverifiable Dependency: Pillow has 16 known advisory(ies) (CVE-2016-2533 (Pillow buffer overflow in ImagingPcdDecode); CVE-2023-50447 (Arbitrary Code Execution in Pillow); CVE-2021-27922 (Pillow Uncontrolled Resource Consumption) +13 more), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
95% confidence
Finding

Pillow has multiple known advisories, and because the manifest does not pin a specific version, it is impossible to determine from this file whether the deployed version is patched. This is especially important here because the skill processes potentially untrusted image inputs, making image-parser vulnerabilities such as code execution, buffer issues, or resource exhaustion more relevant.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
92% confidence
Finding

The ffmpeg-python package is not pinned to an exact version, so dependency resolution may pull different releases over time. For a tool that orchestrates media handling pipelines, this can introduce unpredictable behavior, supply-chain exposure, and difficulty verifying whether a deployed environment contains a vulnerable or incompatible package.

Content

Scanner excerpt · requirements.txt (reported line 2)May include surrounding context.

text
Pillow>=10.0.0
ffmpeg-python>=0.2.0
static-ffmpeg>=2.5.0

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
97% confidence
Finding

static-ffmpeg is unpinned even though it is directly related to obtaining and using FFmpeg binaries, which raises supply-chain and reproducibility concerns. In a skill that downloads and processes remote media including m3u8 and mp4, relying on an unpinned binary-distribution dependency increases the chance of introducing vulnerable or unexpected executable components.

Content

Scanner excerpt · requirements.txt (reported line 3)May include surrounding context.

text
Pillow>=10.0.0
ffmpeg-python>=0.2.0
static-ffmpeg>=2.5.0

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
97% confidence
Finding

The file contains comments, status/error prints, and argparse help text in Chinese throughout, including the tool description and argument help strings. This imposes a specific language on users with no opt-in or alternative locale selection, which matches the language/locale policy violation category.

Content

No source excerpt is available for this finding.