T03 · Remote Payload Retrieval and Execution
Warning
- Location
- SKILL.md:35
- Finding
- Unverified Mutable Executable Download and System-Wide Installation<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 35–37 **Vulnerability Type**: Unverified remote executable retrieval **Risk Level**: Medium ### Vulnerable Code ```bash curl -sL https://github.com/projectdiscovery/nuclei/releases/latest/download/nuclei_$(curl -s https://api.github.com/repos/projectdiscovery/nuclei/releases/latest | grep tag_name | cut -d'"' -f4 | tr -d v)_linux_amd64.zip -o /tmp/nuclei.zip unzip /tmp/nuclei.zip -d /tmp && mv /tmp/nuclei /usr/local/bin/ nuclei -update-templates ``` ### Technical Analysis The installation instructions dynamically resolve the latest Nuclei release, download an executable archive, extract it, and move the resulting binary into the system-wide `/usr/local/bin` directory. No cryptographic checksum or signature is verified before installation. Although the URL belongs to ProjectDiscovery's official GitHub organization rather than a personal pastebin, the `latest` release reference is mutable. Consequently, the executable installed after a future invocation may differ from the version reviewed during this audit. A compromised upstream release, repository account, release artifact, or delivery path could cause arbitrary code to be installed. The procedure also uses predictable shared temporary paths, `/tmp/nuclei.zip` and `/tmp/nuclei`. If these instructions are run in a hostile multi-user environment—particularly with elevated privileges—an attacker may attempt path collisions, pre-placement, or replacement of temporary artifacts. The exact feasibility depends on file ownership, permissions, archive extraction behavior, and operating-system protections. The subsequent `nuclei -update-templates` command retrieves additional mutable remote content. Nuclei templates are necessary for its scanning function, but automatically accepting an unpinned current template set expands the supply-chain trust boundary beyond the reviewed Skill. This behavior exceeds the minimum safe installation procedu ...[truncated 1900 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Pin Nuclei to an explicitly reviewed version instead of resolving `latest` at installation time. 2. Download the corresponding checksum file or signed release metadata from an authenticated official source. 3. Verify the archive with a cryptographic checksum before extraction, and abort installation on any mismatch. 4. Verify a maintainer signature when ProjectDiscovery provides an appropriate signing mechanism. 5. Create a private temporary directory with `mktemp -d`, apply restrictive permissions, and register cleanup with a shell trap. 6. Extract the archive only inside that private directory and validate the expected filename and file type. 7. Install the verified binary using `install` with explicit ownership and mode rather than moving a file directly from shared `/tmp`. 8. Avoid running download, extraction, or template-update operations as root. Elevate only the final verified installation step if system-wide installation is required. 9. Pin Nuclei template revisions or document and review template updates before use in sensitive environments. 10. Prefer a trusted operating-system package or another package source that provides integrity verification and reproducible version pinning. Example hardened workflow: ```bash set -eu VERSION="3.x.y" WORKDIR="$(mktemp -d)" trap 'rm -rf "$WORKDIR"' EXIT chmod 700 "$WORKDIR" ARCHIVE="nuclei_${VERSION}_linux_amd64.zip" curl --fail --show-error --location \ "https://github.com/projectdiscovery/nuclei/releases/download/v${VERSION}/${ARCHIVE}" \ --output "$WORKDIR/$ARCHIVE" curl --fail --show-error --location \ "https://github.com/projectdiscovery/nuclei/releases/download/v${VERSION}/nuclei_${VERSION}_checksums.txt" \ --output "$WORKDIR/checksums.txt" ( cd "$WORKDIR" grep " ${ARCHIVE}$" checksums.txt | sha256sum --check - unzip -- "$ARCHIVE" ) sudo install -o root -g root -m 0755 "$WORKDIR/nuclei" /usr/local/bin/nuclei ``` The exact release naming and checksum ...[truncated 80 chars]
