llvm / llvm/llvm-project

[Security] Windows CI Dockerfile: Plain HTTP Downloads + Missing SHA-256 Verification + Weak MD5 Checksums (Supply Chain Risk)

Open
#206,759 1 comment 0 reactions 0 assignees View on GitHub
infrastructure
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

## Summary

The Windows CI container Dockerfile downloads and executes multiple
critical installers (VS Build Tools, GitHub Runner, LLVM/Clang,
XZ Utils) without cryptographic integrity verification.

Additionally:
- Two downloads use plain `http://` instead of `https://`
- Where verification exists, the cryptographically broken MD5
algorithm is used instead of SHA-256

This creates a viable supply chain attack vector affecting all CI
builds and potentially thousands of downstream releases.

---

## Affected File

| Field | Value |
|-----------|-------|
| File | `.github/workflows/containers/github-action-ci-windows/Dockerfile` |
| Branch | main |
| Commit | `dd87edd1f48b02e4a58dbd0a6fdda07c36c4dea8` |
| Permalink | https://github.com/llvm/llvm-project/blob/dd87edd1f48b02e4a58dbd0a6fdda07c36c4dea8/.github/workflows/containers/github-action-ci-windows/Dockerfile |

---

## Severity

**High** — Supply chain attack vector on CI build infrastructure.

---

## Specific Vulnerable Lines

| Line | Component | Protocol | Verification | Risk |
|------|-----------------|----------|------------------|----------|
| 9 | VS Build Tools | HTTPS | ❌ None | Critical |
| 15 | VS Channel File | HTTPS | ❌ None | Critical |
| 118 | XZ Utils | ⚠️ HTTP | ⚠️ MD5 (broken) | Critical |
| 123 | LLVM/Clang | ⚠️ HTTP | ⚠️ MD5 (broken) | Critical |

---

## Steps to Reproduce

```bash
# 1. Clone the repository
git clone https://github.com/llvm/llvm-project.git
cd llvm-project
git checkout main

# 2. Navigate to the affected file
cd .github/workflows/containers/github-action-ci-windows/

# 3. Verify missing integrity checks
grep -n "Invoke-WebRequest" Dockerfile

# 4. Verify plain HTTP usage (should return 0 results after fix)
grep -n "http://" Dockerfile

# 5. Verify weak MD5 checksums (should return 0 results after fix)
grep -n "MD5" Dockerfile
```
Scope | Detail
-- | --
Direct | All CI container builds using this Dockerfile
Downstream | All artifacts built with compromised CI tools
Persistence | Backdoored compiler silently modifies compiled output
Scale | Thousands of downstream LLVM/ROCm consumers

---

## Recommended Fix
**Fix 1 — Replace HTTP with HTTPS**
```bash
# ❌ Before
Invoke-WebRequest -Uri "http://github.com/releases/.../xz.exe"

# ✅ After
Invoke-WebRequest -Uri "https://github.com/releases/.../xz.exe"
```

**Fix 2 — Pin and Verify SHA-256 After Every Download**

```bash
# Declare pinned hash as build argument
ARG XZ_SHA256=""

# Download
Invoke-WebRequest `
-Uri "https://github.com/.../xz-windows.exe" `
-OutFile xz_installer.exe

# Verify BEFORE executing
$actual = (Get-FileHash xz_installer.exe -Algorithm SHA256).Hash
if ($actual -ne $env:XZ_SHA256) {
Write-Error "Hash mismatch! Expected: $env:XZ_SHA256, Got: $actual"
exit 1
}

# Execute only after successful verification
Start-Process xz_installer.exe -Wait
```

**Fix 3 — Replace MD5 with SHA-256**

```bash
# ❌ Before
Get-FileHash filename.exe -Algorithm MD5

# ✅ After
Get-FileHash filename.exe -Algorithm SHA256
```

## Verification After Fix

1. grep -n "http://" Dockerfile → zero results
2. Every Invoke-WebRequest followed immediately by SHA-256 check
3. Build explicitly exits on hash mismatch
4. grep -n "MD5" Dockerfile → zero results
5. Expected hashes sourced from official release pages

## References

1. [CWE-494: Download of Code Without Integrity Check](https://cwe.mitre.org/data/definitions/494.html)
2. [CWE-328: Use of Weak Hash](https://cwe.mitre.org/data/definitions/328.html)

Contributor guide

Open the contributing guide

Research direction

Open .github/workflows/containers/github-action-ci-windows/Dockerfile and run the listed grep checks to inspect each Invoke-WebRequest, HTTP URL, and MD5 use. Review the official release pages for expected hashes, then verify that every download uses HTTPS, has a SHA-256 check before execution, and exits on mismatch.

Written by the indexing model from the issue text.

Assessment

Tech stack
dockerfile, github-actions, powershell
Domain
build-system, ci-cd, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.