T03 · Remote Payload Retrieval and Execution
- Location
scripts/gateway_manager.py:148- Finding
Automatic Download and Execution of an Opaque Native Binary
- Content
View full analysis
Path: if not spec.url: raise SkillError( "Security program download URL is missing.", {"platform": spec.platform_key, "url": spec.url}, ) BIN_DIR.mkdir(parents=True, exist_ok=True) target = BIN_DIR / spec.filename try: with urllib.request.urlopen(spec.url, timeout=30) as resp: data = resp.read() target.write_bytes(data) except (urllib.error.URLError, TimeoutError, OSError) as e: raise SkillError( "Security program download failed.", {"url": spec.url, "reason": str(e)}, ) if spec.sha256: actual = self._sha256(target) if actual != spec.sha256.lower(): raise SkillError( "Downloaded file verification failed.", { "expected": spec.sha256, "actual": actual, "file": str(target), }, ) if platform.system().lower() != "windows": mode = target.stat().st_mode target.chmod(mode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH) return target ``` ```python def run(self, subcommand: str, args: list[str], timeout: int = 20) -> dict: bin_path = self.ensure_binary(auto_download=True) cmd = [str(bin_path), subcommand, *args] result = subprocess.run( cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, timeout=timeout, env=self._build_subprocess_env(), ) ``` The configured executable sources include URLs such as: ```json { "arch": "linux-amd64", "url": "https://aigc-online.oss- ...[truncated 2778 chars]- Remediation
View remediation
