T03 · Remote Payload Retrieval and Execution
- Location
install.sh:29- Finding
Unverified Remote D2 Installer Is Downloaded and Executed
- Content
View full analysis
/dev/null; then echo "Installing D2..." curl -fsSL https://d2lang.com/install.sh | sh ``` The same unsafe installation command is presented directly to users in both README files: ```bash curl -fsSL https://d2lang.com/install.sh | sh ``` ### Technical Analysis The installer retrieves a mutable shell script from an external URL and immediately passes its response to `sh`. The downloaded content is not version-pinned, inspected, signature-verified, or checked against a known cryptographic digest. HTTPS protects the connection under normal conditions, but it does not guarantee that the upstream script will remain unchanged. A compromised upstream server, release process, domain, DNS path, or trusted TLS infrastructure could cause arbitrary shell commands to be returned and executed. D2 is relevant to the declared diagram-rendering functionality. However, executing an unverified remote script is not the minimum privilege or minimum-trust installation approach required to provide that functionality. ### Attack Path 1. A user follows either README or runs `install.sh`. 2. The installer requests `https://d2lang.com/install.sh`. 3. The upstream endpoint or its delivery infrastructure returns modified shell code. 4. The response is streamed directly into `sh` without review or integrity verification. 5. The malicious commands execute with all privileges available to the user running the installer. 6. The payload can read accessible files, alter user configuration, download additional executables, or establish persistence. ### Impact Assessment Successful exploitation provides arbitrary code execution under the installer user's account. This can expose source code, environm ...[truncated 380 chars]- Remediation
View remediation
