T05 · Unauthorized Access and Privilege Escalation
- Location
scripts/_shared/ark_api.py:49- Finding
Undeclared Arbitrary Local File Upload Capability in a Local-Only Skill
- Content
View full analysis
str: """Text-to-image / image-to-image. Returns the first image URL. reference_images accepts file paths or URLs and converts them to data URIs. """ content = [{"type": "text", "text": prompt}] for img in reference_images or []: content.append({ "type": "image_url", "image_url": {"url": self._image_to_data_uri(img)}, }) body = { "model": model or MODELS["image"], "content": content, "size": size, "watermark": False, } resp = requests.post( f"{self.base_url}/images/generations", headers=self.headers, json=body, timeout=120, ) ``` The local-file conversion is implemented as follows: ```python @staticmethod def _image_to_data_uri(path_or_url: str) -> str: if path_or_url.startswith(("http://", "https://", "data:")): return path_or_url p = pathlib.Path(path_or_url) ext = p.suffix.lower().lstrip(".") or "jpeg" if ext == "jpg": ext = "jpeg" b64 = base64.b64encode(p.read_bytes()).decode() return f"data:image/{ext};base64,{b64}" ``` ### Technical Analysis The Skill declares itself as a purely local FFmpeg editing utility. Its documented entry point, `scripts/edit.py`, does not require network access or remote image-generation capabilities. However, the bundled `ArkClient` accepts arbitrary caller-supplied paths through `reference_images`. `_image_to_data_uri()` resolves no trust boundary and directly reads the complete contents of each path using `p.read_bytes()`. The bytes are Base64-enco ...[truncated 2671 chars]- Remediation
View remediation
