T03 · Remote Payload Retrieval and Execution
- Location
scripts/invoke.py:16- Finding
Automatic Execution of an Unpinned Remote Installation Script
- Content
View full analysis
Vulnerability Details
File Location:
scripts/invoke.py:16, 100-135
Vulnerability Type: Remote payload retrieval and execution without integrity verification
Risk Level: CriticalVulnerable Code
python INSTALL_URL = "https://raw.githubusercontent.com/GraySilver/modelcli/main/install.sh"python if script is None: temporary = tempfile.TemporaryDirectory(prefix="modelcli-skill-install-") script = Path(temporary.name) / "install.sh" downloader = shutil.which("curl") if downloader: download = subprocess.run( [downloader, "-LsSf", INSTALL_URL, "-o", str(script)], capture_output=True, text=True, timeout=remaining_seconds(deadline), check=False, ) else: wget = shutil.which("wget") if not wget: return None, "curl or wget is required to install ModelCLI" download = subprocess.run( [wget, "-qO", str(script), INSTALL_URL], capture_output=True, text=True, timeout=remaining_seconds(deadline), check=False, ) if download.returncode != 0: return None, (download.stderr or download.stdout or "failed to download install.sh").strip() result = subprocess.run( ["sh", str(script)], capture_output=True, text=True, timeout=remaining_seconds(deadline), check=False, )Technical Analysis
When the
modelcliexecutable is unavailable, the wrapper automatically downloadsinstall.shfrom the mutablemainbranch of a personal GitHub repository and executes it withsh. The downloaded content is not pinned to an immutable commit or release, and the wrapper performs no checksum, signature, or provenance verification before execution.HTTPS provides transport protection but does not guarantee that the repository's current content matches the code reviewed during this audit. The effective executable payload can change a ...[truncated 2104 chars]
- Remediation
View remediation
Remediation Suggestions
- Remove automatic remote installation from normal inference and diagnostic execution paths. If
modelcliis absent, return a clear error and require the user or administrator to install it separately. - Require explicit user confirmation before performing any installation or executing installation code.
- Use a trusted, versioned release artifact rather than a mutable branch URL.
- Pin the installer or package to an immutable release or commit and verify a hard-coded cryptographic digest, such as SHA-256, before execution.
- Prefer cryptographic signature verification using a trusted public key so authenticity and integrity are independently established.
- Fail closed if verification fails, the signature is missing, the digest differs, or the retrieved artifact redirects to an unapproved origin.
- Prefer a reviewed operating-system package, signed package repository, or isolated package-management workflow over executing a downloaded shell script.
- Run installation with the least-privileged account possible and isolate it from credentials, sensitive files, and unnecessary network access.
- Record the verified version, source, and digest in diagnostic output to support reproducible auditing.
- Remove automatic remote installation from normal inference and diagnostic execution paths. If
