T03 · Remote Payload Retrieval and Execution
Error
- Location
- scripts/install.py:62
- Finding
- Unverified Mutable Executable Download and Execution<![CDATA[ ## Vulnerability Details **File Location**: `scripts/install.py:62-74, 134-167`; execution occurs through `scripts/rgh.js:17-24, 43-52` and `scripts/rgh.py:17-25, 43-49` **Vulnerability Type**: Remote payload retrieval and execution **Risk Level**: Critical ### Vulnerable Code ```python def get_latest_release_assets(): """Query GitHub API for the latest release assets.""" api_url = "https://api.github.com/repos/RollingGo-AI/oauth-hotel-cli/releases/latest" req = urllib.request.Request( api_url, headers={'User-Agent': 'RollingGo-Installer/1.0'} ) try: with urllib.request.urlopen(req) as response: data = json.loads(response.read().decode('utf-8')) return data.get('assets', []), data.get('tag_name', 'latest') except Exception as e: print(f"⚠️ Could not fetch latest release info from GitHub API: {e}") return None, None ``` ```python assets, tag = get_latest_release_assets() download_url = None if assets: for asset in assets: name = asset.get('name', '').lower() if asset_keyword in name: download_url = asset.get('browser_download_url') print(f"Found matching asset for version {tag}: {asset.get('name')}") break if not download_url: print("Using hardcoded fallback download URL...") if system == "windows": download_url = "https://github.com/RollingGo-AI/oauth-hotel-cli/releases/latest/download/rgh-win.exe" elif system == "darwin": download_url = "https://github.com/RollingGo-AI/oauth-hotel-cli/releases/latest/download/rgh-macos" else: download_url = "https://github.com/RollingGo-AI/oauth-hotel-cli/releases/latest/download/rgh-linux" success = download_binary(download_url, dest_path) if not success and assets and system == "windows": print("Retrying with alternative Windows asset name...") download_url = "https://github.com/RollingGo-AI/oauth-hotel-cli/releases/late ...[truncated 3186 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Pin a specific, reviewed CLI version rather than resolving `latest`. 2. Maintain an explicit mapping of supported operating-system and architecture combinations to exact asset names and SHA-256 digests. 3. Download to a newly created temporary file and verify its digest before moving it atomically into `bin`. 4. Verify a cryptographic release signature against a trusted public key bundled with the Skill. 5. Validate that API-provided and final redirected URLs use HTTPS and match an exact approved host and repository path. 6. Reject ambiguous substring matches; require exact asset names and validate architecture as well as operating system. 7. Apply restrictive file permissions and refuse to overwrite an existing binary unless the replacement passes all checks. 8. Minimize the environment passed to the child process, supplying only variables required by the CLI. 9. Document the pinned version and provide a separately reviewed upgrade process rather than automatically trusting future releases. ]]>
