Sybaris
Gaining Access
Nmap scan:
$ nmap -p- --min-rate 3000 -Pn 192.168.243.93
Starting Nmap 7.93 ( https://nmap.org ) at 2023-07-17 20:45 +08
Nmap scan report for 192.168.243.93
Host is up (0.17s latency).
Not shown: 65519 filtered tcp ports (no-response)
PORT STATE SERVICE
21/tcp open ftp
22/tcp open ssh
80/tcp open http
6379/tcp open redisI ran a detailed scan to enumerate further:
21/tcp open ftp vsftpd 3.0.2
| ftp-syst:
| STAT:
| FTP server status:
| Connected to 192.168.45.231
| Logged in as ftp
| TYPE: ASCII
| No session bandwidth limit
| Session timeout in seconds is 300
| Control connection is plain text
| Data connections will be plain text
| At session startup, client count was 2
| vsFTPd 3.0.2 - secure, fast, stable
|_End of status
| ftp-anon: Anonymous FTP login allowed (FTP code 230)
|_drwxrwxrwx 2 0 0 6 Apr 01 2020 pub [NSE: writeable]
22/tcp open ssh OpenSSH 7.4 (protocol 2.0)
| ssh-hostkey:
| 2048 2194ded36964a84da8f0b50aeabd02ad (RSA)
| 256 674245198bf5f9a5a4cffb8748a266d0 (ECDSA)
|_ 256 f3e229a3411e761eb1b746dc0bb99177 (ED25519)
80/tcp open http Apache httpd 2.4.6 ((CentOS) PHP/7.3.22)
| http-cookie-flags:
| /:
| PHPSESSID:
|_ httponly flag not set
|_http-title: Sybaris - Just another HTMLy blog
| http-robots.txt: 11 disallowed entries
| /config/ /system/ /themes/ /vendor/ /cache/
| /changelog.txt /composer.json /composer.lock /composer.phar /search/
|_/admin/
|_http-generator: HTMLy v2.7.5
|_http-server-header: Apache/2.4.6 (CentOS) PHP/7.3.22
6379/tcp open redis Redis key-value store 5.0.9The most interesting thing was the Redis instance because it was a version that was vulnerable to the Redis Module exploit.
Rabbit Holes
Port 80 was full of Rabbit Holes, nothing was useful about it.
FTP Creds -> RCE
The FTP service allowed for anonymous access:
Not sure what this directory is used for. The Redis RCE exploit requires that we put a shared object file within the file system, then use Redis's MODULE LOAD to run it.
I transferred this file over to the pub directory and tried to find the correct directory to load my module. After a bit of guessing, I found that we uploaded module.so to /var/ftp.

We can then easily get a reverse shell.

Privilege Escalation
Cronjob -> Library Hijack
I ran a linpeas.sh scan, and found this cronjob running:

Turns out that there are some directories that we can write to within the LD_LIBRARY_PATH, and the cronjob running log-sweeper doesn't have a utils.so specified:
This was pretty easy to exploit. Just generate this reverse shell:
Then transfer it to the /usr/local/lib/dev directory and wait. Be sure to run chmod 777 utils.so on it just in case. The cronjob runs every minute, so the connection takes about 30 seconds to appear:

Rooted!
Last updated