T05 · Unauthorized Access and Privilege Escalation
- Location
scripts/image_review.py:130- Finding
Arbitrary Local File Read and Upload Through the MCP Image Review Tool
- Content
View full analysis
Dict: from image_review import review_image return review_image( args["image"], prompt=args.get("prompt", ""), quick=args.get("quick", False), ) ``` ```python # scripts/image_review.py:132-151 if src.startswith(("http://", "https://")): req = Request(src, headers={"User-Agent": "huo15-review/1.0"}) with urlopen(req, timeout=30) as r: blob = r.read() else: with open(os.path.expanduser(src), "rb") as f: blob = f.read() if blob[:8] == b"\x89PNG\r\n\x1a\n": media = "image/png" elif blob[:3] == b"\xff\xd8\xff": media = "image/jpeg" elif blob[:6] in (b"GIF87a", b"GIF89a"): media = "image/gif" elif blob[:4] == b"RIFF" and blob[8:12] == b"WEBP": media = "image/webp" else: media = "image/png" return base64.b64encode(blob).decode("ascii"), media ``` ```python # scripts/image_review.py:161-207 img_b64, media_type = load_image_b64(image_src) user_content = [] user_content.append({ "type": "image", "source": { "type": "base64", "media_type": media_type, "data": img_b64, }, }) body = { "model": model, "max_tokens": max_tokens, "system": [ ...[truncated 2556 chars]- Remediation
View remediation
