# config-leak.yaml.txt # ==================== # INTENTIONALLY VULNERABLE Kubernetes deployment for CTF / code-auditing practice. # DO NOT apply to any cluster. All misconfigurations are educational. apiVersion: v1 kind: Namespace metadata: name: production-app --- # VULNERABILITY: Secrets stored in plain text (not base64-encoded Secret object) apiVersion: v1 kind: ConfigMap metadata: name: app-config namespace: production-app data: DATABASE_URL: "postgresql://appuser:S3cretPa$$w0rd@db.internal:5432/proddb" REDIS_URL: "redis://:r3d1sP@ss@redis.internal:6379/0" API_SECRET_KEY: "sk-live-4f3c2b1a0d9e8f7c6b5a4d3e2f1a0b9c" AWS_ACCESS_KEY_ID: "AKIAIOSFODNN7EXAMPLE" AWS_SECRET_ACCESS_KEY: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY" STRIPE_SECRET_KEY: "sk_live_51HGb2LExample1234567890abcdefg" JWT_SIGNING_KEY: "my-jwt-secret-do-not-share" SMTP_PASSWORD: "mailP@ss123" --- apiVersion: apps/v1 kind: Deployment metadata: name: web-app namespace: production-app spec: replicas: 3 selector: matchLabels: app: web-app template: metadata: labels: app: web-app spec: # VULNERABILITY: Running as root with no service account restrictions # TODO: add a non-root securityContext hostNetwork: true # VULNERABILITY: shares host network namespace hostPID: true # VULNERABILITY: shares host PID namespace containers: - name: web-app image: internal-registry.company.com/web-app:latest # no image digest pinning ports: - containerPort: 8080 envFrom: - configMapRef: name: app-config # injects all secrets as env vars securityContext: privileged: true # VULNERABILITY: full host privileges runAsUser: 0 # VULNERABILITY: running as root allowPrivilegeEscalation: true readOnlyRootFilesystem: false capabilities: add: - SYS_ADMIN # VULNERABILITY: dangerous capability - NET_ADMIN - SYS_PTRACE # VULNERABILITY: No resource limits -- allows resource exhaustion / noisy neighbor # resources: # limits: # cpu: "500m" # memory: "512Mi" # requests: # cpu: "100m" # memory: "128Mi" volumeMounts: - name: host-root mountPath: /host # VULNERABILITY: host filesystem mounted - name: debug-sidecar image: busybox:latest command: ["sleep", "infinity"] securityContext: privileged: true # VULNERABILITY: debug container left in production runAsUser: 0 volumes: - name: host-root hostPath: path: / # VULNERABILITY: entire host filesystem exposed type: Directory --- # VULNERABILITY: Service exposed without NetworkPolicy restrictions apiVersion: v1 kind: Service metadata: name: web-app-service namespace: production-app spec: type: NodePort # VULNERABILITY: exposed on all node IPs selector: app: web-app ports: - port: 8080 targetPort: 8080 nodePort: 30080 # fixed port, easily scannable --- # VULNERABILITY: Overly permissive RBAC -- service account has cluster-admin apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: name: web-app-admin-binding subjects: - kind: ServiceAccount name: default # VULNERABILITY: using default service account namespace: production-app roleRef: kind: ClusterRole name: cluster-admin # VULNERABILITY: full cluster admin privileges apiGroup: rbac.authorization.k8s.io --- # VULNERABILITY: Ingress with no TLS, no rate limiting, no WAF apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: web-app-ingress namespace: production-app # No annotations for rate limiting, CORS, or security headers spec: rules: - host: app.example.com http: paths: - path: / pathType: Prefix backend: service: name: web-app-service port: number: 8080 # No TLS block -- VULNERABILITY: traffic is unencrypted