Back openDesk Edu for a sovereign, open-source education — every vote counts.
Vote nowSave products you love by clicking the heart icon.
LLMs können Terraform-Code generieren – aber nur 3 von 7 Modellen liefern sicherheitskonformen Code. Eine aktuelle Studie benchmarkt Modelle für sichere IaC-Generierung und zeigt, wie du KI sicher einsetzt.
The hard truth: Your containers are likely insecure. A recent study by Cristhian Kapelinski, Beatriz Machado, and Diego Kreutz (2026) analyzed the most popular Docker Hub images and found an alarming result: A single insecure base image can compromise an entire organization—and nearly every image has at least one critical vulnerability.
Docker Hub is the foundation for most container deployments worldwide. If you:
FROM ubuntu, FROM nginx, FROM node)...then you most likely depend on one of the analyzed base images—and thus inherit their security status.
💥 Fact: A vulnerability in a base image is inherited by all derived images. If
ubuntu:latesthas a critical flaw, it affects millions of deployments built on top of it.
The researchers examined the top 1,000 most downloaded Docker Hub images for:
| Criteria | Findings | Risk |
|---|---|---|
| Vulnerabilities (CVEs) | 89.2% had at least 1 critical CVE | ❌ High |
| Hardcoded Secrets | 12.4% contained API keys/passwords | ❌ High |
| Misconfigurations | 67.8% ran as root user | ❌ Medium |
| Outdated Packages | 78.3% had outdated dependencies | ❌ Medium |
| Image | Critical CVEs | Secrets Found | Runs as Root | Recommendation |
|---|---|---|---|---|
alpine:latest | 3 | ❌ No | ✅ Yes | ✅ Use alpine:3.18 + Distroless |
ubuntu:latest | 12 | ❌ No | ✅ Yes | ✅ Use ubuntu:22.04 + Minimal |
nginx:latest | 5 | ✅ Yes! | ✅ Yes | ❌ Avoid! Use nginx:alpine |
node:latest | 8 | ✅ Yes! | ✅ Yes | ❌ Use node:18-alpine |
python:latest | 10 | ✅ Yes! | ✅ Yes | ❌ Use python:3.11-slim |
A classic example: The SolarWinds Hack (2020).
# Example: Verify Cosign signature
cosign verify --key cosign.pub ghcr.io/user/image:tag
The study found API keys, database passwords, and private SSH keys in public images.
python:latest image contained an AWS access key with full admin privileges.# Trivy: Scan for vulnerabilities and secrets
trivy image --severity CRITICAL,MEDIUM your-image:tag
67.8% of images run as the root user – a critical security risk!
nginx can take over the host if the container runs as root.💡 Solution: Always run as a non-root user and use the
USERdirective in your Dockerfile.
# Example: Non-Root User in Dockerfile
FROM alpine:3.18
# Create a non-root user
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
# Run as non-root user
USER appuser
# Copy and run your application
COPY --chown=appuser:appgroup . /app
WORKDIR /app
CMD ["./start.sh"]
78.3% of images had outdated packages – a major source of vulnerabilities.
openssl:1.0.2 (outdated) has multiple critical CVEs, while openssl:3.0+ is secure.💡 Solution: Automatic updates with
dependabotorrenovateand regular scans.
# Example: GitHub Dependabot for Dockerfile
# .github/dependabot.yml
version: 2
updates:
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "weekly"
| Purpose | Recommended Image | Why? |
|---|---|---|
| General (Alpine) | alpine:3.18 | Lightweight, minimal, secure |
| General (Debian) | debian:12-slim | Stable, well-maintained |
| General (Ubuntu) | ubuntu:22.04 | LTS, long-term updates |
| Distroless | gcr.io/distroless/base | No shell, minimal attack surface |
| Node.js | node:18-alpine | Alpine-based, smaller |
| Python | python:3.11-slim | Slim variant, fewer packages |
| Nginx | nginx:alpine | Alpine-based, more secure |
| Postgres | postgres:15-alpine | Alpine-based, smaller attack surface |
💡 Tip: Use
--platform=linux/amd64to avoid multi-arch images (which may contain vulnerabilities).
# Example: Pull a secure image
docker pull --platform=linux/amd64 node:18-alpine
| Tool | Purpose | Installation | Example Command |
|---|---|---|---|
| Trivy | Vulnerabilities + Secrets | brew install trivy | trivy image your-image:tag |
| Snyk | Vulnerabilities + Licenses | npm install -g snyk | snyk container test your-image:tag |
| Grype | Vulnerabilities | brew install grype | grype your-image:tag |
| Docker Scout | Vulnerabilities (Docker Native) | Built into Docker Desktop | docker scout quickview your-image:tag |
💡 Tip: Integrate into CI/CD (e.g., GitHub Actions, GitLab CI).
# Example: Trivy in GitHub Actions
# .github/workflows/docker-scan.yml
name: Docker Image Scan
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build Docker image
run: docker build -t your-image:latest .
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: 'your-image:latest'
format: 'sarif'
output: 'trivy-results.sarif'
severity: 'CRITICAL,HIGH'
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
if: always()
with:
sarif_file: 'trivy-results.sarif'
Problem: Many images include build tools (e.g., gcc, make) that are not needed in production but can contain vulnerabilities.
Solution: Multi-stage builds – keep only what’s necessary in the final image.
# Example: Multi-Stage Build for Node.js
# Stage 1: Build
FROM node:18-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
# Stage 2: Production
FROM node:18-alpine
WORKDIR /app
# Copy only build artifacts (no build tools!)
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/package*.json ./
# Non-Root User
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
USER appuser
EXPOSE 3000
CMD ["node", "dist/index.js"]
| Image Type | Pros | Cons | Example |
|---|---|---|---|
| Distroless | ❌ No shell, minimal | ⚠️ Hard to debug | gcr.io/distroless/nodejs:18 |
| Alpine | ❌ Lightweight, secure | ✅ Good for most apps | alpine:3.18 |
| Slim | ❌ Fewer packages | ⚠️ Larger than Alpine | debian:12-slim |
| Scratch | ❌ Absolutely minimal | ❌ No libraries ( static binaries only) | scratch |
💡 Tip: Use Distroless for production images, but Alpine for development (due to shell availability).
# Example: Distroless for Node.js
FROM gcr.io/distroless/nodejs:18 AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
FROM gcr.io/distroless/nodejs:18
WORKDIR /app
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./
USER nonroot:nonroot
EXPOSE 3000
CMD ["/app/dist/index.js"]
Problem: FROM ubuntu:latest can change at any time – and suddenly introduce new vulnerabilities.
Solution: Always use specific versions (e.g., ubuntu:22.04.3).
# ❌ Bad Practice (can change)
FROM ubuntu:latest
FROM node:latest
FROM alpine:latest
# ✅ Good Practice (immutable)
FROM ubuntu:22.04.3
FROM node:18.17.1
FROM alpine:3.18.4
💡 Tip: Use
renovateordependabotto automatically update to new versions.
| Question | Yes | No | Action |
|---|---|---|---|
Do I use specific versions (no latest)? | ✅ | ❌ | Pin versions |
| Do my containers run as non-root users? | ✅ | ❌ | Use USER directive |
| Do I scan images before deployment? | ✅ | ❌ | Integrate Trivy/Snyk |
| Do I use multi-stage builds? | ✅ | ❌ | Remove build tools |
| Do I use minimal base images (Alpine/Distroless)? | ✅ | ❌ | Switch to Distroless/Alpine |
| Do I verify image signatures? | ✅ | ❌ | Use Cosign/Notary |
| Do I have Dependabot/Renovate for Dockerfiles? | ✅ | ❌ | Set up automatic updates |
| Do my containers run with least privileges? | ✅ | ❌ | Check security context |
💡 Tip: 9/9 Yes? → Your setup is state-of-the-art! 0–4 Yes? → Urgent action required!
| Tool | Vulnerability Scanning | Secret Scanning | License Scanning | Integration | Cost |
|---|---|---|---|---|---|
| Trivy | ✅ Yes | ✅ Yes | ❌ No | CLI, CI/CD | Free |
| Snyk | ✅ Yes | ✅ Yes | ✅ Yes | CLI, CI/CD, IDE | Freemium |
| Grype | ✅ Yes | ❌ No | ❌ No | CLI, CI/CD | Free |
| Docker Scout | ✅ Yes | ❌ No | ❌ No | Docker GUI | Free (Docker Pro) |
| Anchore | ✅ Yes | ✅ Yes | ✅ Yes | CLI, CI/CD | Freemium |
| Clair | ✅ Yes | ❌ No | ❌ No | API, Kubernetes | Free |
💡 Recommendation: Trivy for beginners, Snyk for enterprise.
The study shows: Docker Hub is a minefield. But the good news is: You can protect yourself – and it doesn’t require much effort.
🎯 Immediate Actions:
latest tags with specific versions.🚀 Long-Term:
💡 Final Tip: Start today. The next vulnerability in your Docker setup could be exploited tomorrow.
🔗 Original Study: Vulnerabilities, Secrets and Misconfiguration in the Highest-Exposure Docker Hub Images (arXiv:2608.02669v1)
📌 Tags: #Docker #Security #DevOps #Container #SupplyChain #Cloud