Skip to content

Commit 145a58d

Browse files
authored
Merge pull request #1862 from HackTricks-wiki/research_update_src_linux-hardening_privilege-escalation_docker-security_namespaces_uts-namespace_20260205_131526
Research Update Enhanced src/linux-hardening/privilege-escal...
2 parents cd6d1d3 + 9589ad5 commit 145a58d

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

  • src/linux-hardening/privilege-escalation/docker-security/namespaces

src/linux-hardening/privilege-escalation/docker-security/namespaces/uts-namespace.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,22 @@ sudo find /proc -maxdepth 3 -type l -name uts -exec ls -l {} \; 2>/dev/null | g
7575
nsenter -u TARGET_PID --pid /bin/bash
7676
```
7777

78-
{{#include ../../../../banners/hacktricks-training.md}}
78+
## Abusing host UTS sharing
79+
80+
If a container is started with `--uts=host`, it joins the host UTS namespace instead of getting an isolated one. With capabilities such as `--cap-add SYS_ADMIN`, code in the container can change the host hostname/NIS name via `sethostname()`/`setdomainname()`:
81+
82+
```bash
83+
docker run --rm -it --uts=host --cap-add SYS_ADMIN alpine sh -c "hostname hacked-host && exec sh"
84+
# Hostname on the host will immediately change to "hacked-host"
85+
```
7986

87+
Changing the host name can tamper with logs/alerts, confuse cluster discovery or break TLS/SSH configs that pin the hostname.
8088

89+
### Detect containers sharing UTS with the host
8190

91+
```bash
92+
docker ps -aq | xargs -r docker inspect --format '{{.Id}} UTSMode={{.HostConfig.UTSMode}}'
93+
# Shows "host" when the container uses the host UTS namespace
94+
```
95+
96+
{{#include ../../../../banners/hacktricks-training.md}}

0 commit comments

Comments
 (0)