Disabled APK Signature Verification
Dockerfiles use apk add --allow-untrusted to bypass package signature validation, allowing installation of unsigned or tampered packages from potentially malicious or compromised repositories.
Dockerfiles that use APK package manager with --allow-untrusted flag disable signature verification, enabling installation of unsigned or tampered packages that could contain malicious code. This creates a supply chain attack vector where malicious actors can compromise container images by injecting backdoors, malware, or vulnerable packages that execute arbitrary code during build or runtime, leading to container escape, data exfiltration, and infrastructure compromise.
# VULNERABLE: Dockerfile with untrusted APK packages
FROM alpine:3.18
# VULNERABLE: APK with disabled signature verification
RUN apk add --allow-untrusted curl wget # VULNERABLE: Bypasses signature checks
# VULNERABLE: Multiple packages without verification
RUN apk add --allow-untrusted \
python3 \
py3-pip \
nodejs \
npm \
git # VULNERABLE: All packages unverified
# VULNERABLE: Custom repository without proper keys
RUN echo "http://untrusted.example.com/alpine/v3.18/main" >> /etc/apk/repositories \
&& apk add --allow-untrusted custom-package # VULNERABLE: Untrusted repo
# VULNERABLE: Package installation with force update
RUN apk add --allow-untrusted --force-refresh suspicious-tool
# VULNERABLE: Development tools without verification
RUN apk add --allow-untrusted \
gcc \
musl-dev \
linux-headers \
make
COPY app.py /app/
WORKDIR /app
CMD ["python3", "app.py"]# SECURE: Dockerfile with verified APK packages
FROM alpine:3.18
# SECURE: Install packages with signature verification
RUN apk add --no-cache curl wget # SECURE: No --allow-untrusted flag
# SECURE: Install multiple packages with verification
RUN apk add --no-cache \
python3 \
py3-pip \
nodejs \
npm \
git # SECURE: All packages verified
# SECURE: Use official repositories only
RUN cat /etc/apk/repositories # Verify only trusted repos
# SECURE: Install development tools with verification
RUN apk add --no-cache \
gcc \
musl-dev \
linux-headers \
make # SECURE: All packages verified
COPY app.py /app/
WORKDIR /app
CMD ["python3", "app.py"]Dockerfiles use apk add --allow-untrusted to bypass package signature validation, allowing installation of unsigned or tampered packages from potentially malicious or compromised repositories.
Sourcery automatically identifies remote code execution due to untrusted apk packages in dockerfile and many other security issues in your codebase.