nitesh@gupta
Proving Grounds Linux

Workaholic

Full walkthrough — enumeration, foothold and privilege escalation.

Nmap output

Nmap scan report for 192.168.239.229
Host is up (0.061s latency).
Not shown: 65506 filtered tcp ports (no-response), 26 closed tcp ports (conn-refused)
Some closed ports may be reported as filtered due to --defeat-rst-ratelimit
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-generator: WordPress 6.7.2
|_http-trane-info: Problem with XML parsing of /evox/about
|_http-title: Workaholic
|_http-favicon: Unknown favicon MD5: 6BD852FF8C391FD56DF5A8EF4C2DB7FC
|_http-server-header: nginx/1.24.0 (Ubuntu)
| http-methods: 
|_  Supported Methods: GET HEAD POST
Service Info: OSs: Unix, Linux; CPE: cpe:/o:linux:linux_kernel

We have a wordpress site running on port 80

Workaholic walkthrough, Got root, screenshot 1
Workaholic, step 1

We ran wpscan and got to know that wp-advanced-search version 3.3.8 is installed

Workaholic walkthrough, Got root, screenshot 2
Workaholic, step 2

We found a sql injection vulnerability for this version of plugin

Workaholic walkthrough, Got root, screenshot 3
Workaholic, step 3

Ran the payload and got password hashes for wp_users

Workaholic walkthrough, Got root, screenshot 4
Workaholic, step 4

We got password by cracking hash : okadamat17 & chrish20 and rU)tJnTw5*ShDt4nOx from wp-config.php

Tried ssh bruteforce and we got charlie & wp-config password working

Workaholic walkthrough, Got root, screenshot 5
Workaholic, step 5

Got access as charlie

Workaholic walkthrough, Got root, screenshot 6
Workaholic, step 6

Got local.txt (2ba5cbd98b00e848562cde3c97d78aa0)

Workaholic walkthrough, Got root, screenshot 7
Workaholic, step 7

We have a wp-monitor SUID

Workaholic walkthrough, Got root, screenshot 8
Workaholic, step 8

After checking strings of the binary we see that it’s looking for /home/ted/.lib/libsecurity.so but didn’t found that library

Workaholic walkthrough, Got root, screenshot 9
Workaholic, step 9

We have write access to ted directory

Workaholic walkthrough, Got root, screenshot 10
Workaholic, step 10

So I followed this guide https://amanisher.medium.com/suid-sgid-shared-object-injection-linux-privilege-escalation-ecda5b05649b to create malicious .so file.

Created libsecurity.c file

Workaholic walkthrough, Got root, screenshot 11
Workaholic, step 11

Created .lib directory and moved libsecurity.so in it

Workaholic walkthrough, Got root, screenshot 12
Workaholic, step 12

Currently we don’t have any privilege as sudo

Workaholic walkthrough, Got root, screenshot 13
Workaholic, step 13

Ran the wp-monitor SUID binary & now we have ALL access as sudo

Workaholic walkthrough, Got root, screenshot 14
Workaholic, step 14

Got root

Workaholic walkthrough, Got root, screenshot 15
Workaholic, step 15

Got proof.txt (6cd6fc3eeae20db0f411e563a8e3d05c)

More walkthroughs