SKY-D328 · Security in code
Remote script piped into a shell
"curl | bash" downloads a script and runs it in the same breath, so nobody sees or checks what ran. SKY-D328 reports a curl or wget of an outside URL whose output goes straight into a shell or interpreter.
- Languages
- Dockerfile, Shell, GitHub Actions, GitLab CI, Python, TypeScript/JavaScript
- Quality gate
- counted toward the gate limits (full and diff scans)
- Finding type
- review
- Catalog name
- Remote script piped to shell
Why it matters
Whoever controls that URL, its DNS or its CDN at build time controls your build. A swapped install script runs with the image's or runner's permissions and secrets, and the next build may fetch something else again, so the image cannot be reproduced.
What Skylos flags
FROM debian:bookworm-slimRUN apt-get update && apt-get install -y --no-install-recommends curl ca-certificates \ && rm -rf /var/lib/apt/lists/*RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -yWhat Skylos leaves alone
FROM debian:bookworm-slimARG RUSTUP_SHA256RUN apt-get update && apt-get install -y --no-install-recommends curl ca-certificates \ && rm -rf /var/lib/apt/lists/*RUN curl -fsSLo /tmp/rustup-init \ https://static.rust-lang.org/rustup/dist/x86_64-unknown-linux-gnu/rustup-init \ && echo "${RUSTUP_SHA256} /tmp/rustup-init" | sha256sum -c - \ && chmod +x /tmp/rustup-init && /tmp/rustup-init -yWhy Skylos leaves it alone
The installer is saved to a file, its SHA-256 is checked against a value pinned in the build, and only then is the saved copy run. No download is piped into an interpreter; the one pipe feeds sha256sum.
More languages
YAML
Flagged
name: Linton: [push]permissions: contents: readjobs: lint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Install the linter run: | curl -fsSL https://get.example-lint.dev/install.sh | bash example-lint --version - run: example-lint check .Not flagged
name: Linton: [push]permissions: contents: readjobs: lint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Install the linter run: | curl -fsSL https://get.example-lint.dev/example-lint-1.8.2.tar.gz | tar -xz ./example-lint --version - run: ./example-lint check .Why Skylos leaves it alone
This download is piped into tar, which unpacks a fixed release archive. tar is not an interpreter, so nothing from the URL is run as a script by the pipe itself.
How Skylos decides
- Reads shell commands in
.sh,.bash,.zsh,.kshand.batsfiles, GitHub Actionsrun:steps, GitLab CI script items, DockerfileRUNinstructions (continuation lines joined), fixed command strings in Pythonos.system()-style calls orshell=Truecalls, and fixed strings passed tochild_process.exec()in TypeScript and JavaScript. - Splits each command at
;,&&and||, then into pipeline parts at|. Reports when a part whose command iscurlorwgethas an outsidehttp(s)://URL and a later part of the same pipeline runsbash,sh,dash,ksh,zsh,python,python3,node,rubyorperl(also aftersudo,nohup,timeorcommand). - Also reports an interpreter that runs a
$(curl …)or$(wget …)substitution of anhttp(s)://URL anywhere in the command, as insh -c "$(curl -fsSL https://…)". - Skips
http://localhost,127.0.0.1and0.0.0.0URLs, downloads piped into tools that are not interpreters (tar,jq,sha256sum), and downloads saved to a file and run in a later command. Every finding is HIGH.
How to fix it
Download to a file, check it against a checksum or signature you pinned, then run the saved copy. Better still, install a pinned release from a package manager or copy the binary from a versioned image.
FROM debian:bookworm-slimAdded: ARG RUSTUP_SHA256RUN apt-get update && apt-get install -y --no-install-recommends curl ca-certificates \ && rm -rf /var/lib/apt/lists/*Removed: RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -yAdded: RUN curl --proto '=https' --tlsv1.2 -sSfo /tmp/rustup-init.sh https://sh.rustup.rs \Added: && echo "${RUSTUP_SHA256} /tmp/rustup-init.sh" | sha256sum -c - \Added: && sh /tmp/rustup-init.sh -yWhen it can be wrong
- An installer from a host you trust and pin (a vendor's signed script behind a fixed URL) is reported the same as any other, because Skylos cannot see what the URL serves.
- Missed: process substitution such as
bash <(curl -fsSL https://…); and in a GitHub Actionsrun: |block, or a multi-line GitLab item, a pipe that starts on a later line, because the block is split only at;,&&,||and|, not at line breaks.
Seeing a case that isn't listed here? Report the wrong result so the rule can be fixed. Don't paste company code: describe the shape of it.
How to silence it
In a Dockerfile the marker goes on the first line of the
RUNinstruction or on the line directly above it, one rule per marker. Text after#on aRUNline becomes a shell comment, so the build is unchanged.Dockerfile # skylos: ignore[SKY-D328] vendor script, signature checked in CIRUN curl -fsSL https://get.example-lint.dev/install.sh | sh[tool.skylos] ignore = ["SKY-D328"]turns the rule off for the whole project.