T03 · Remote Payload Retrieval and Execution
Error
- Location
- pi_claw.py:20
- Finding
- Automatic Download and Execution of an Unverified Native Binary<![CDATA[ ## Vulnerability Details **File Location**: `pi_claw.py:20-52` **Vulnerability Type**: Unverified remote payload retrieval and execution **Risk Level**: Critical ### Vulnerable Code ```python def download_pi(): """Download the pi executable""" system = platform.system() pi_path = get_pi_path() if system == "Windows": url = "https://github.com/noah-smith-max/pi_public/releases/download/r0.0.1/pi.exe" elif system == "Darwin": url = "https://github.com/noah-smith-max/pi_public/releases/download/r0.0.1/pi" else: print("Error: Linux is not supported yet.") sys.exit(1) print(f"Downloading pi from {url}...") urllib.request.urlretrieve(url, pi_path) if system != "Windows": os.chmod(pi_path, 0o755) print("Download completed successfully.") def main(): """Main function""" pi_path = get_pi_path() # Check if pi exists if not os.path.exists(pi_path): download_pi() # Build command arguments args = [pi_path] + sys.argv[1:] # Execute pi command try: result = os.system(' '.join(args)) sys.exit(result) except Exception as e: print(f"Error executing pi: {e}") sys.exit(1) ``` The same release assets are advertised in `SKILL.md:67-72`: ```markdown ## Download - Windows: https://github.com/noah-smith-max/pi_public/releases/download/r0.0.1/pi.exe - macOS: https://github.com/noah-smith-max/pi_public/releases/download/r0.0.1/pi ``` ### Technical Analysis The wrapper does not implement the declared Android and Flutter SDK management functionality itself. Instead, it delegates that functionality to a native executable retrieved from a personal GitHub release. When the expected local binary is absent, `urllib.request.urlretrieve` downloads the platform-specific artifact directly into the Skill directory. On macOS, the wrapper then grants executable permissions with `os.chmod(p ...[truncated 2394 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Replace the opaque native executable with auditable source code included in the Skill or distribute it through a suitably controlled and authenticated package channel. 2. Publish a separate, immutable SHA-256 digest for each supported platform and embed the expected digest in the reviewed wrapper. 3. Download to a temporary file, calculate its digest, and fail closed before moving or executing it if the digest differs. 4. Apply code signing and verify the signature and expected publisher identity before execution: - Use Authenticode verification on Windows. - Use Apple code-signing and notarization verification on macOS. 5. Require explicit user confirmation that identifies the source, destination, version, and integrity value before downloading or executing the artifact. 6. Avoid relying only on a versioned URL as an integrity guarantee. 7. Use atomic file replacement and restrictive file permissions to reduce local replacement and partial-download risks. 8. Separate download, verification, and execution into distinct steps, with verification mandatory before execution. 9. Document the binary's source, build process, requested permissions, and expected network and filesystem behavior. 10. Run the tool with the least-privileged account practical for project setup and avoid administrative execution unless a specific operation requires it. ]]>
