Skip to content

fix: run web container as non-root and disable privilege escalation - #118

Open
hacktron-app-stg[bot] wants to merge 1 commit into
add-k8s-deploymentfrom
hacktron/fix-ccae1384
Open

fix: run web container as non-root and disable privilege escalation#118
hacktron-app-stg[bot] wants to merge 1 commit into
add-k8s-deploymentfrom
hacktron/fix-ccae1384

Conversation

@hacktron-app-stg

Copy link
Copy Markdown

Vulnerability

deployment.yaml runs the web container as the root user and permits privilege escalation:

runAsUser: 0
allowPrivilegeEscalation: true

Running as root (UID 0) combined with allowPrivilegeEscalation: true means that if an attacker gains code execution inside the container, they already have root and can further escalate via setuid binaries — significantly increasing blast radius.

Fix

Harden the container securityContext:

runAsNonRoot: true
runAsUser: 1000
allowPrivilegeEscalation: false
  • runAsNonRoot: true makes the kubelet refuse to start the pod if the image would otherwise run as UID 0, providing defense in depth.
  • runAsUser: 1000 picks a non-root UID.
  • allowPrivilegeEscalation: false sets NoNewPrivs on the process, blocking setuid-based escalation.

The change is limited to the lines flagged in the finding. Unrelated hardening issues in the same manifest (privileged container, host namespaces, hardcoded secret, host-root mount, mutable image tag) are tracked as separate findings and left unchanged to keep this PR minimal and reviewable.

Verification

  • Confirmed the offending settings existed at deployment.yaml:25-26 at the checked-out commit.
  • Verified the edited manifest remains structurally valid YAML (indentation preserved under securityContext).

Automated fix by Hacktron for finding: https://staging.hacktron.ai/testestesttest/findings/ccae1384-92bc-49e4-ae51-a45c12b298f2

The web Deployment ran as root (runAsUser: 0) and allowed privilege
escalation, increasing the impact of any in-container code execution.
Set runAsNonRoot: true, runAsUser: 1000, and
allowPrivilegeEscalation: false.
@hacktron-app-stg
hacktron-app-stg Bot requested a review from maekuss July 23, 2026 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants