Skip to content

Network access during build for multiple recipes breaks build isolation #46

@pbeza

Description

@pbeza

Several recipes in meta-dstack/ fetch source tarballs over the network during the Yocto build using SRC_URI with HTTP(S) URLs, making the build non-reproducible and vulnerable to supply-chain attacks if the upstream source is compromised.

Root Cause

Three build recipes enable network access during compilation via do_compile[network] = "1":

  1. libnvidia-container: Also uses curl --insecure
  2. dstack-guest: Go dependencies fetched during build
  3. dstack-sysbox: Go dependencies fetched during build

Yocto's default build isolation disables network access during do_compile to ensure reproducibility and supply-chain integrity. When do_compile[network] = "1" is set, dependencies are fetched at build time without the checksum verification that SRC_URI provides in do_fetch.

Attack Path

  1. Attacker compromises a dependency server or performs a MitM attack on the build network
  2. During do_compile, the build fetches Go modules or other dependencies over the network
  3. Fetched dependencies are not checksum-verified (unlike SRC_URI entries in do_fetch)
  4. Malicious code is compiled into the resulting binaries
  5. Affected binaries are included in the dstack guest image

Impact

Supply-chain integrity gap. Dependencies fetched during compilation bypass Yocto's integrity verification. A compromised upstream server or network attacker can inject malicious code into three components: NVIDIA container runtime, dstack guest agent, and sysbox container runtime.

Suggested Fix

  1. Pre-fetch all Go dependencies during do_fetch with checksum verification:
SRC_URI += "file://vendor.tar.gz"
do_compile:prepend() {
    cp -r ${WORKDIR}/vendor ${S}/vendor
    export GOFLAGS="-mod=vendor"
}
  1. Use Go module vendoring (go mod vendor) and include the vendor directory in the source
  2. Remove do_compile[network] = "1" from all three recipes

Note: This issue was created automatically. The vulnerability report was generated by Claude and has not been verified by a human.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions