Advisory

GHSA-2c7f-fxww-6w6c

Details, part 2 of 2. The advisory

Details

poc.py

#!/usr/bin/env python3
"""
VULN-001 PoC Runner
Exploit: Arbitrary File Write via MCP caption-download (CWE-73)
Target : pkg/caption/caption.go:272 -- os.Create(c.File) without pkg.Root confinement

Usage: python3 poc.py
"""
import os
import subprocess
import sys

VULN_DIR = os.path.dirname(os.path.abspath(__file__))
CONTEXT_DIR = os.path.dirname(VULN_DIR) # mcp_49_eat-pray-ai__yutu/
DOCKERFILE = os.path.join(VULN_DIR, "Dockerfile")
IMAGE_NAME = "yutu-vuln001-poc"


def run(cmd, check=False, **kwargs):
 print("$ " + " ".join(str(a) for a in cmd))
 result = subprocess.run(cmd, =True, **kwargs)
 return result


def main():
 print("=" * 70)
 print("VULN-001: Arbitrary File Write via MCP caption-download")
 print("CWE-73 | pkg/caption/caption.go:272 | os.Create(c.File)")
 print("=" * 70)

 # ── Build ────────────────────────────────────────────────────────────────
 build_cmd = [
 "docker", "build",
 "--no-cache",
 "-t", IMAGE_NAME,
 "-f", DOCKERFILE,
 CONTEXT_DIR,
 ]
 print("\n[Step 1] Building Docker image ...")
 result = run(build_cmd, capture_output=False)
 if result.returncode != 0:
 print("\n[FAIL] Docker build failed.", file=sys.stderr)
 sys.exit(1)

 # ── Run ──────────────────────────────────────────────────────────────────
 run_cmd = ["docker", "run", "--rm", IMAGE_NAME]
 print("\n[Step 2] Running PoC container ...")
 result = run(run_cmd, capture_output=True)

 stdout = result.stdout or ""
 stderr = result.stderr or ""
 print(stdout, end="")
 if stderr:
 print(stderr, end="", file=sys.stderr)

 # ── Verdict ──────────────────────────────────────────────────────────────
 passed = (
 result.returncode == 0
 and "VULNERABILITY CONFIRMED" in stdout
 and "PASS" in stdout
 and "os.Create bypasses pkg.Root" in stdout
 )

 if passed:
 print("\n[RESULT] PASS – vulnerability dynamically reproduced.")
 else:
 print(f"\n[RESULT] FAIL – container exit code {result.returncode}.", file=sys.stderr)
 sys.exit(1)


if __name__ == "__main__":
 main()

Sources & licences