T07 · Tool Hijacking and Spoofing
- Location
scripts/upscale.py:156- Finding
macOS System Utility Can Be Hijacked Through PATH
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This appears to be a legitimate local image upscaling, inspection, and compression skill, with disclosed downloads, local file processing, and no evidence of hidden data theft or persistence.
Install only if you are comfortable with a skill that downloads and runs a pinned native image-processing runtime. Keep IMAGE_UPSCALER_CACHE and IMAGE_UPSCALER_MIRRORS pointed to trusted locations, run it only on intended image folders, and prefer offline mode after setup when network access is not needed.
scripts/upscale.py:156macOS System Utility Can Be Hijacked Through PATH
scripts/setup.py:124Execution-Time Integrity Verification Does Not Cover the Complete Extracted Runtime
The declared description presents a broad image tool focused on upscaling, inspection, and compression with multiple enhancement modes and output-size/resolution controls. The supplied code chunk is much narrower: it compresses images to a target file size, using JPEG re-encoding and optional downscaling to meet the byte limit. It does support some declared aspects, such as local operation on macOS/Windows, supported JPG/PNG/WebP inputs, aspect-ratio-preserving resizing, strict target file sizes, and batch folder processing. However, the primary advertised capabilities around upscaling, enhancement algorithm/profile selection, resolution-targeted enlargement, and inspection are absent from this code. Because the actual behavior is a limited compression-only utility rather than the broader described upscale/inspect/compress tool, this is a material description-behavior mismatch.
The code substantially matches the core declared purpose of local image upscaling on macOS/Windows: it handles JPG/PNG/WebP inputs, supports batch folders, preserves aspect ratio via long-edge scaling, offers profile/model selection, targets 1K/2K/4K/8K or custom max edge, uses cached local runtime/model assets, and verifies runtime/model integrity with SHA-256 before execution. However, the description also claims capabilities that are not present in this code chunk. Most notably, there is no mechanism to compress an image to a strict target file size such as 200KB; the only compression-related option is a simple quality/compression parameter passed to the upscaler or JPEG save routine, without iterative size targeting. Likewise, 'verified download fallbacks' are not implemented here; the script only checks for missing/integrity-failed cached assets and tells the user to run setup, rather than downloading or falling back itself. Finally, while the script reads and prints image dimensions during processing, it is not really an image inspection utility on its own. So this is a partial mismatch: the primary purpose is mostly accurate, but important declared features are absent from the supplied code chunk.
The skill describes capabilities that require shell, filesystem, environment-variable, and network access, but it does not declare an explicit tool scope or permissions boundary. That omission can cause the agent to run with broader-than-necessary privileges, increasing the blast radius if the skill is misused, the referenced scripts are unsafe, or untrusted inputs influence shell/file/network operations.
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
"-s", "format", "jpeg", "-s", "formatOptions", str(quality),
str(source), "--out", str(destination),
]
result = subprocess.run(command, check=False, stdout=subprocess.DEVNULL, stderr=subprocess.PIPE)
if result.returncode != 0:
raise RuntimeError(f"macOS JPEG encoding failed: {result.stderr.decode(errors='replace').strip()}")
return
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
"IC_HEIGHT": str(height),
"IC_QUALITY": str(quality),
})
result = subprocess.run(
[str(trusted_windows_powershell()), "-NoProfile", "-NonInteractive", "-Command", script],
check=False,
env=environment,
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
if output_format == "jpg":
command.extend(["-s", "formatOptions", str(quality or 95)])
command.extend([str(source), "--out", str(destination)])
completed = subprocess.run(command, check=False, stdout=subprocess.DEVNULL)
if completed.returncode != 0:
raise RuntimeError(f"macOS exact resize failed with code {completed.returncode}")
return
Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.
if output_format == "jpg":
command.extend(["-s", "formatOptions", str(quality or 95)])
command.extend([str(source), "--out", str(destination)])
completed = subprocess.run(command, check=False, stdout=subprocess.DEVNULL)
if completed.returncode != 0:
raise RuntimeError(f"macOS exact resize failed with code {completed.returncode}")
return
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
"IU_FORMAT": output_format,
"IU_QUALITY": str(quality or 95),
})
completed = subprocess.run(
[str(trusted_windows_powershell()), "-NoProfile", "-NonInteractive", "-Command", script],
check=False,
env=environment,
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
]
if args.tta:
command.append("-x")
completed = subprocess.run(command, check=False)
if completed.returncode != 0:
raise RuntimeError(f"Upscaler exited with code {completed.returncode}")
if dimensions:
Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.
]
if args.tta:
command.append("-x")
completed = subprocess.run(command, check=False)
if completed.returncode != 0:
raise RuntimeError(f"Upscaler exited with code {completed.returncode}")
if dimensions:
The module docstring says it will 'Upscale one image or a folder of images', which suggests a narrower operation. In practice, the code also performs exact resizing after 4x processing, converts between PNG/JPG/WebP, and applies compression/quality controls via resize_exact and output-format handling.
This code creates output directories and later writes generated image files, which affects user data on disk. Although the script prints progress messages during processing, there is no upfront user-facing warning in comments, docstrings, or prompts that running the skill will create new files and folders.