Layr-Labs / Layr-Labs/d-inference

Security: curl-pipe-bash installation pattern enables RCE if CDN is compromised

Open
#711 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
522
Forks
113
Avg merge
17h 26m
Merged PRs (30d)
111

Description

## Summary

Both the provider installation and fleet update mechanisms use the `curl | bash` pattern, which provides no integrity verification before executing downloaded code. A compromised or DNS-hijacked `api.darkbloom.dev` results in arbitrary code execution on every machine that installs or updates.

## Evidence

**README / provider install:**
```bash
curl -fsSL https://api.darkbloom.dev/install.sh | bash
```

**Fleet update script** (`deploy/provider-fleet/update-fleet.sh`):
```bash
ssh "$HOST" "curl -fsSL $COORD_URL/install.sh | bash"
```

The fleet script SSHs into each provider machine and pipes a remotely-fetched script directly to bash. A single compromised coordinator endpoint results in simultaneous arbitrary code execution across the entire provider fleet.

## Impact

**For individual providers:**
- A DNS hijack or CDN compromise of `api.darkbloom.dev` serves a malicious `install.sh`
- Executed immediately with the user's privileges
- No opportunity to inspect the script before execution

**For the fleet update path (higher severity):**
- Eigen Labs' own fleet update tooling uses `curl | bash` over SSH
- A coordinator compromise gives an attacker a one-command mechanism to execute arbitrary code on every enrolled provider machine simultaneously
- This is a supply chain attack that scales across the entire network

## Suggested Fix

**Option A: Signed install script (recommended)**

Sign `install.sh` with a GPG key or `cosign`, and verify before execution:

```bash
# Download script and signature separately
curl -fsSL https://api.darkbloom.dev/install.sh -o install.sh
curl -fsSL https://api.darkbloom.dev/install.sh.sig -o install.sh.sig

# Verify signature against pinned public key before executing
gpg --verify install.sh.sig install.sh && bash install.sh
```

Publish the public key fingerprint in this repository so users can pin it independently of the CDN.

**Option B: Homebrew / package manager distribution**

Distributing via `brew install darkbloom` or a signed `.pkg` installer provides OS-level integrity guarantees and eliminates the `curl | bash` pattern entirely.

**Option C: Hash verification with out-of-band hash**

At minimum, publish the SHA-256 of each `install.sh` release to GitHub Releases (separate trust root from the CDN) and instruct users to verify before running:

```bash
curl -fsSL https://api.darkbloom.dev/install.sh -o install.sh
echo " install.sh" | shasum -a 256 -c && bash install.sh
```

**For the fleet update script specifically:**

Replace the `curl | bash` SSH pattern with a versioned, pre-verified binary deployment:

```bash
# Instead of: ssh "$HOST" "curl -fsSL $COORD_URL/install.sh | bash"
# Use: scp verified_binary "$HOST:/usr/local/bin/darkbloom" && ssh "$HOST" "darkbloom update"
```

## References

- `deploy/provider-fleet/update-fleet.sh` -- fleet update curl-pipe-bash
- README installation instructions
- Related issue: #709 (circular binary trust -- the install script has the same CDN single-trust-root problem)
- Prior art: Homebrew's approach to signed formulae, Sigstore cosign for install scripts

Contributor guide

Open the contributing guide

Research direction

Start with deploy/provider-fleet/update-fleet.sh and the installation command in README, then compare both paths with the related trust issue #709. Review the proposed verification and deployment approaches with maintainers; done means neither path executes code fetched from the CDN without an independent integrity check.

Written by the indexing model from the issue text.

Assessment

Tech stack
bash, shell
Domain
devops, infrastructure, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.