T03 · Remote Payload Retrieval and Execution
Error
- Location
- references/patchmon-setup.md:114
- Finding
- Unpinned Remote Installation Script Executed as Root and Installed Persistently<![CDATA[ ## Vulnerability Details **File Location**: `references/patchmon-setup.md:114-137` **Vulnerability Type**: Unverified remote code execution and persistent service installation **Risk Level**: Critical ### Vulnerable Code ```bash curl -sSL https://raw.githubusercontent.com/PatchMon/PatchMon/main/agent/install.sh | sudo bash ``` The installed agent is configured to update itself: ```yaml features: auto_update: true # Auto-update agent itself docker: true # Enable Docker monitoring ``` It is then registered to start automatically: ```bash sudo systemctl enable patchmon-agent sudo systemctl start patchmon-agent ``` ### Technical Analysis The installation instructions stream a shell script from the mutable `main` branch of an external GitHub repository directly into a root shell. The downloaded content is not pinned to an immutable release or commit, inspected before execution, or verified with a cryptographic signature or checksum. Consequently, the code that executes can change after this Skill has been reviewed. Compromise of the upstream repository, maintainer account, GitHub delivery infrastructure, or installation URL would provide an attacker with arbitrary root-level code execution on every host where the documented command is used. The risk continues after installation because the resulting agent is enabled as a system service and configured with `auto_update: true`. These behaviors are related to PatchMon monitoring, but they exceed the minimum privileges required for the core host-patching scripts and create a persistent third-party execution channel. ### Attack Path 1. An attacker compromises the upstream PatchMon repository, maintainer credentials, release process, or delivery channel. 2. The attacker modifies `agent/install.sh` on the referenced `main` branch. 3. An administrator follows the Skill documentation and runs the `curl | sudo bash` command. 4. The malicious script executes immediately with root privileges. 5. ...[truncated 722 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Do not pipe remotely downloaded content directly into a shell, especially a privileged shell. 2. Pin the installation artifact to an immutable release version or audited commit hash. 3. Download the artifact to a local file before execution: ```bash curl --fail --show-error --location \ --output patchmon-install.sh \ https://example.invalid/pinned-release/install.sh ``` 4. Verify a vendor-provided cryptographic signature and an independently published SHA-256 digest. 5. Review the downloaded script before running it with elevated privileges. 6. Run installation through a narrowly scoped, documented privileged procedure. 7. Default `auto_update` to `false`; require explicit approval for upgrades. 8. Require explicit confirmation before enabling a persistent system service. 9. Document the files, user account, network access, and privileges created by the agent. ]]>
