當前位置:
首頁 > 新聞 > 甲方安全建設之Windows橫向移動攻擊的檢測

甲方安全建設之Windows橫向移動攻擊的檢測

0x00 前言

早上在看RSS的時候,偶然看到了這篇Paper,http://cert.europa.eu/static/WhitePapers/CERT-EU_SWP_17-002_Lateral_Movements.pdf,CERT-EU發的,主要寫了些Windows橫向移動檢測方面的內容。

像平時做滲透的時候,橫向移動是搞內網目標的重要環節,除了考慮如何橫向移動到有價值的目標機器外,也會從甲方安全的角度去思考,如果是我,我會通過什麼手段、設置什麼規則去檢測這種攻擊行為呢?

So,這篇論文還是比較符合我的胃口,於是打算學習一下。

本文主要記錄了學習該論文的過程,同時還會夾雜一些我的思考,如有謬誤,還望各位大牛斧正。

0x01 介紹

橫向移動技術廣泛應用於複雜的網路攻擊中,特別是高級持續性威脅(APT)。攻擊者使用這些技術訪問受感染系統中的其他主機,並訪問敏感資源(如郵箱,共享文件夾或憑證)。這些可以用於滲透其他機器、許可權提升或者竊取更有價值的憑證。通過橫向移動攻擊最終可以拿到域控許可權,進而控制域環境下的全部機器。

這篇論文主要介紹了如何檢測在Windows Vista、7和2008的環境中利用NTLM和Kerberos協議橫向移動的方法。由於Windows 10引入了許多額外的安全機制,因此針對Windows 10橫向移動檢測相關的技術將會在另一篇論文中單獨介紹。

微軟之前已經發布過關於如何緩解hash傳遞攻擊的文章(Pass the Hash)。除了本文中描述的檢測控制手段之外,強烈建議實現微軟官方提供的防護方法。

值得關注的是,這種攻擊類型(橫向移動)不僅僅局限於Windows環境,類似的攻擊場景也可以出現在其他基礎架構的場景中,比如說使用Kerberos協議的UNIX系統,或者利用SSO進行認證的設備。雖然本文專註於檢測Windows系統橫向移動技術,但在適當的日誌記錄存在的情況下,其思路也可以在其他場景中借鑒。

感謝Microsoft的MSRC團隊對本文檔的質量檢查和驗證所做的貢獻。

0x02 背景

Windows橫向移動攻擊

在本文中,橫向移動攻擊是指利用有效的登錄憑證從一台Windows主機登錄到另一台目標Windows主機。(可以是用戶、服務的登錄憑證)

源主機通常是目標Windows環境中的已經拿到許可權的系統。

在大多數情況下,第一台主機的許可權往往通過魚叉式郵件釣魚攻擊獲得(郵件中插入惡意附件或者偽造的釣魚網頁)。

這裡插一句,郵件釣魚只是獲取目標內網許可權的方式之一。由於目標網管的水平參差不齊,所以利用Web漏洞拿到DMZ區的許可權,進而滲透進企業內網進行橫向移動,也是一個比較普遍的方式。

在大多數情況下一旦攻擊成功,攻擊者通常會通過向遠程的CC伺服器反彈shell進而對該機器進行控制。提升許可權後,攻擊者可以dump該機器中的登錄憑證,並使用這些憑證訪問另一台主機。

因此,總結一下橫向移動攻擊總共分為兩步:

1、從當前被控主機中抓取憑證

攻擊者在當前被控主機中抓取有效的憑證。憑證的抓取方式一般通過安全工具從內存中抓取(當然通過鍵盤記錄獲得明文密碼也是一種思路,但不是本文討論的範圍)。本文主要介紹竊取和濫用NT hash和Kerberos憑證。

攻擊者可以再被接管的機器中抓取憑證,這些憑證可能是正在使用或者之前使用過(Cached and Stored Credentials Technical Overview,http://support.microsoft.com/kb/2871997 )。

比較有價值的憑證有:目標域環境的高許可權賬號,像幫助台、域管理員、高許可權服務的賬號、或者本地管理員賬號。在很多情況下,密碼是通殺的,即密碼是有規律或者同一密碼在大量的服務中被使用。

2、使用抓到的憑證去登陸其他的機器或服務

登陸憑證被盜後,攻擊者可以使用hash傳遞攻擊或者Kerberos票據傳遞攻擊的方式訪問其他資源,比如說主機或服務(例如Exchange e-mail帳戶)。關於這兩種攻擊的方式可以參考附錄中文章。

這裡介紹幾種攻擊場景:

如果沒有安裝更新補丁的情況下,只要有任意用戶之前登陸過這台被接管的機器,攻擊者均可以再內存中將該登陸憑證dump出來。

Windows會在內存中緩存登陸憑據以提供單點登錄等功能:

使用網路登錄或RDP(遠程桌面)[限制管理模式登錄]到被接管的目標主機的帳戶是不會被公開或者緩存到本地內存中。

當採用其他類型的登陸方式時(包括本地登陸,通過域用戶或服務賬戶登陸)有關憑證緩存的更多詳細信息,可以參考後面的文章。

有價值的憑證不僅僅局限於明文的用戶名、密碼。用於請求Kerberos TGT的NT hash,Kerberos票證、Kerberos密鑰在橫向移動的過程中也存在價值。

攻擊者需要管理員許可權才能訪問本地內存中的憑證(即Windows安全帳戶管理器,憑證管理器或lsass進程),可以參考這篇文章:Pass the Hash。如果被接管的用戶當前許可權較低,可以藉助本地許可權提升漏洞進行提權。

橫向移動不限於訪問另一個工作站,也可以用於訪問其他資源,例如Exchange伺服器或業務一同。

橫向移動使用標準協議,如Kerberos和NTLM協議,這使得無法創建專用Windows事件、IDS規則用於檢測這種攻擊行為。

橫向移動攻擊的優點之一是攻擊者可以抓取憑證並在以後使用它們。

橫向移動不僅僅局限於Windows,因為任何使用單點登錄的身份驗證協議都存在類似的問題。

任何單點登錄解決方案都需要以某種有效格式存儲憑證,以便它們可以重複使用對其他服務進行身份驗證,而無需每次都重新輸入密碼。

APT攻擊中使用橫向移動的經典案例

一般來說,APT攻擊中有很多情況下都是從一個工作站橫向移動到另一個工作站,以期待可以獲得高許可權賬號,直到拿到域管理員登陸憑證為止。

攻擊的下一步通常是訪問域控制器並dump Windows域用戶的全部登陸憑證。

下圖展示了APT攻擊中橫向移動的典型攻擊場景:

憑證緩存

正如前一節所述,用戶連接到或運行命令(例如在執行RDP(受限制管理模式除外)或runas命令時),登陸憑據(包括域用戶或管理員)會緩存在工作站的內存中。

下表總結了,當用戶user1已登錄主機的狀態下,user2(admin用戶)的Kerberos TGT票證的緩存情況。

因此,由於user2用戶登陸過user1的機器,當user1的機器被攻擊者接管,user2的賬號憑證也會被攻擊者抓到。Microsoft的指導手冊提供了有關目標主機上公開的可復用憑據的更詳盡的總結(見文末參考鏈接)。

基於以管理員身份運行的Windows功能的用例,它授予完整的管理員訪問token(UAC)。管理員使用runas命令打開應用程序(例如,cmd.exe)時,Windows的行為會有所不同:

當退出應用程序時,以管理員(UAC)身份運行打開,NT hash和ticket仍然保留在內存中。

當使用runas /user:\domuser2命令,登陸憑證將會在內存中清除。

有趣的是,最後一種情況(緩存的互動式登錄,以管理員身份運行,後面跟著一個netlogon)不需要重新輸入netlogon的密碼。

註:

所有測試均在非特權互動式會話上完成(在user1的控制台上登錄)。

網路登錄不是持久的。

測試是通過授權開關完成的(帳戶敏感並且不能委派功能)。

註銷測試是在註銷過程中正確關閉或保持打開目標帳戶會話的情況下完成。結果仍然一樣。

Pass-the-Hash和Pass-the-Ticket

下表總結了利用pass-the-hash和pass-the-ticket之間的主要區別。

一些有趣的結論:

需要管理許可權才能竊取憑證,但不使用Kerberos票據。

密碼更改不會導致Kerberos票據失效。

0x03 檢測Windows橫向移動

一般規則

一個合法的SMB連接請求和協議級別的哈希傳遞攻擊、票據傳遞攻擊沒有區別。

事實上,這種攻擊並沒有利用協議的缺陷。因此,沒有預定義的規則來檢測它們。

然而,攻擊者在行為級別創建異常。

譯者註:

就是說從協議包的傳遞過程中通過hash傳遞攻擊和正常的SMB鏈接請求時一樣的,所以無法設置IDS規則,通過網路流量去檢測橫向移動的攻擊行為。

但是可以通過特定高許可權賬號的登陸行為判斷是否存在異常情況。

舉個例子,如果域管理員帳戶my-admin只能從特定的工作站使用,則my-admin賬號如果登陸其他機器則有較大可能存在問題,表明存在潛在的橫向移動攻擊。

因此,通過監視Windows事件檢測橫向移動攻擊行為是可行的。

我們可以定義如下規則用於檢測橫向移動行為:

橫向移動可以通過特定賬戶登錄未認證的系統進行檢測和識別。

有一些重要的限制條件需要理解:

這一規則的落地的實現方法為限制對特權賬戶橫向移動的檢測。檢測所有的橫向運動行為是有難度的。

為此,需要維護一個用戶、工作站、IP地址的對應列表,當出現與預期結果不符的情況則予以告警。

但是這樣的話,仍然有一些行為是不能被預期的規則檢測到。(例如,從預期的用戶、工作站訪問資源,但是在限定的規則下進行惡意操作。)

實施這些規則的可行性將強烈依賴於定義的策略,活動目錄結構和網路隔離。

策略應該要求為需要監控的帳戶使用指定主機,例如專用OU、管理員、工作站。

這些工作站的清單必須保持。

對這些賬戶和工作站的策略越清晰,檢測橫向移動和避免誤報就越有效。

網路隔離將有助於識別橫向移動,特別是在Kerberos情況下,因為Kerberos在相關事件中不提供主機名信息。

使用本地帳戶(例如本地管理員)檢測橫向移動需要收集來自所有潛在目標工作站的事件(4624/4625)。這在某些情況下可能無法做到。

由於Windows主要事件存儲在域控制器上,所以在監視域帳戶時這個問題不太相關。

微軟已經推出了兩個SID來簡化使用GPO的本地管理員賬戶的操作。

以下部分介紹執行哈希傳遞攻擊和票據傳遞攻擊時生成的事件以及可以設置為檢測橫向移動的規則。

公約和假設

本文側重於使用管理員帳戶(命名為ADMIN)檢測橫向移動,並從其自己的ADMIN-WS以外的工作站發起。

可以對相同的規則進行微調以檢測其他情況,例如服務帳戶或其他特權帳戶。

在下面給出的例子中,我們假設:

通過查詢Active Directory可以輕鬆識別域管理員帳戶(使用命令:net group "Domain Admins" /domain)

管理員的工作站可以很容易地被識別。

例如:

通過主機名進行識別

維護OU或列表

通過命名規則進行識別,例如admin-ws-1,admin-ws-2等

通過IP地址進行識別

這些工作站有一個專用的VLAN

使用或強制使用跳板機

檢測NTLM橫向移動(PtH:哈希傳遞攻擊)

生成的事件摘要

下圖總結了如果一個域用戶在域控制器中被使用,NTLM憑證請求生成的全部事件。

在被接管的工作站(infected-ws)上記錄了事件4648:使用顯式憑據嘗試登錄

這裡產生的事件取決於攻擊者的操作方式。在這種情況下,攻擊者運行一個psexec.exe \Target cmd.exe,它使用先前注入的NT hash在目標主機上打開命令提示符。更多細節見附錄C。

被接管的工作站上的事件對於取證時非常有用,但主動檢測hash傳遞攻擊則效率不高。

在這種情況下,該事件提供了橫向移動的目的主機名,clean-ws。

在域控制器上記錄兩個事件4776:域控制器試圖驗證帳戶的憑據

第一個事件4776在機器驗證過程中生成,clean-ws$到域控制器。這個事件對於檢測pass-the-hash用處不大。

第二個事件4776表示當訪問目標工作站clean-ws時,帳戶my-admin的確認信息。該事件表明存在橫向移動行為,其為監控橫向移動攻擊行為的關鍵事件。

目標主機上記錄的事件4624(clean-ws):已成功登錄帳戶

此事件表示目標用戶my-admin在目標工作站上clean-ws成功登錄。

該事件可用於檢測橫向移動,但需要從所有工作站收集特定日誌。對於數量有限的工作站或伺服器來說還是比較實用的。

無論如何,此事件和登錄失敗事件4625對於取證目的非常有用,因為它們提供了登錄類型(本例中為網路登錄),同時還包含攻擊者從何處發起連接的來源信息(infected-ws)。

登錄目標主機的事件4634/4647:已註銷帳戶/已啟動帳戶。

此事件表明攻擊者已註銷。這對於取證來說用處比較大,可以通過事件4624的登錄ID值和此事件來確定攻擊的完整會話。

通用檢測規則

本節提供從各個來源收集的事件以及可用於檢測NTLM橫向移動的值。

如上所述,要監視的主要事件 - 4776位於域控制器(DC)上。事件4624和4625(登陸失敗)是可選的,但建議從關鍵系統上收集該事件信息。

注意:不要忽略工作站上事件日誌,特別是那些敏感或特權帳戶的事件日誌。

檢測Kerberos橫向移動(Pass-the-Ticket)

生成的事件ID

下圖顯示了在執行Kerberos身份驗證時每端生成的事件摘要信息。詳細的事件信息參考下文。

這個場景沒有生成關於pass-the-hash的事件4648。

登錄到域控制器的事件4768:請求了Kerberos身份驗證票據(TGT)。

生成第一個事件4768以向域控制器請求Kerberos TGT票據。該事件可能在pass-the-ticket攻擊過程中看不到,因為TGT票據先前被抓到注入在攻擊請求中,而不會再次向Kerberos密鑰分發中心、域控制器發起新的請求。

登錄到域控制器的事件4769:請求了Kerberos服務票據。

生成此事件以請求訪問目標系統或資源,在上例中為clean-ws$。

該事件可以用於檢測橫向移動行為。

目標主機(clean-ws)登錄事件4624:帳戶已成功登錄

此事件表明用戶(my-admin)的在目標系統(clean-ws)的登陸情況。該事件可以應用於主動檢測橫向移動行為,但需要從所有工作站收集日誌信息。

對於數量有限的工作站或伺服器來說仍然有用。

在任何情況下,登錄失敗事件4625對於取證來說非常有用,因為它提供了登錄類型(在這種情況下為網路登錄),更有趣的是攻擊者從何處(infected-ws)發起連接的信息也會記錄。

事件4634/4647:已註銷帳戶/已啟動帳戶。

此事件表明攻擊者已註銷。這對於取證來說很有用,通過事件4624的登錄ID值和此事件來確定攻擊的完整會話。

通用檢測規則

本部分提供從各個來源收集的事件以及可用於通過票據傳遞攻擊進行橫向移動的事件ID。

如上所述,要監控的主要事件位於域控制器(DC)4769和潛在的4768。需要注意的是,Kerberos事件不提供主機名,所以只能嚴重IP地址,對於啟用DHCP的環境來說,這是一個問題。

事件4624和4625(失敗嘗試)也是可選做監控的對象,但由於垃圾信息太多,建議從關鍵系統收集。

可能存在誤報的事件ID:

值得注意的是,如果管理員(例如幫助台)正在遠程主機上打開應用程序(例如,執行遠程訪問,然後是帶有runas管理員的cmd.exe),則可能會生成事件4768。

檢測Golden Ticket

詳情參考這篇文章:

http://cert.europa.eu/static/WhitePapers/UPDATED%20-%20CERT-EU_Security_Whitepaper_2014-007_Kerberos_Golden_Ticket_Protection_v1_4.pdf

重點賬號監控

本文檔中描述的監控規則基於域管理員帳戶。其他重要賬戶也需要被監控:

服務賬號(例如備份賬號)

很少使用的賬號

緊急賬號

關鍵業務賬號

其他監控事件

可以看一下NSA發的這篇文章

https://www.iad.gov/iad/library/reports/spotting-the-adversary-with-windows-event-log-monitoring.cfm

這篇文章提供了有助於檢測潛在攻擊的附加事件。該報告涵蓋了廣泛的事件和攻擊類型,不僅是橫向移動。

0x04 技術名稱釋義

Pass-the-hash:哈希傳遞攻擊,一種攻擊技術,允許攻擊者通過使用先前抓到的用戶密碼的NTLM或LanMan hash來驗證遠程伺服器/服務,而不需要輸入明文密碼進行登陸。

Pass-the-ticket:票據傳遞攻擊,類似於Pass-the-hash,但是使用Kerberos票據而不使用NT hash。

Credentials:認證憑證,不僅僅局限於明文密碼,可以使Windows NTLM hash或Kerberos Ticket。具體是什麼取決去採用何種Windows身份認證協議。

有些情況下,Windows將登陸憑證緩存在內存中用於提供單點登陸功能。本文重點介紹的是TGT和Kerberos票據。

TGT and ST Kerberos tickets: TGT和服務票據是Kerberos協議的一部分。

KDC:密鑰分發中心

[1]Mitigating Pass-the-Hash (PtH) Attacks and Other Credential Theft Techniques http://www. Pass the Hash

[2]Kerberos Authentication Technical Reference TechNet Library Home cc739058(v=ws.10).aspx

[3]Chapter 3 - Recovering from Active Directory Attacks Resources and Tools for IT Professionals library/bb727066.aspx#ECAA

[4]Credential Protection and Management Credentials Protection and Management. aspx

[5]Windows events

https://www.ultimatewindowssecurity.com/securitylog/encyclopedia/Default.

aspx

[6]Windows 7 and 2008 Security events Windows, Office, Xbox & More 50034

[7]Techniques for spotting an adversary

https://www.iad.gov/iad/library/reports/spotting-the-adversary-with-windows-event-log-monitoring.cfm

[8]Protection from Kerberos Golden Ticket

http://cert.europa.eu/static/WhitePapers/UPDATED%20-%20CERT-EU_Security_Whitepaper_2014-007_Kerberos_Golden_Ticket_Protection_v1_4.pdf

0x06 詳細事件信息

-PackageName = MICROSOFT_AUTHENTICATION_PACKAGE_V1_0-TargetUserName = my-admin-Workstation = USER-WS-Status = 0x00000000Command: `psexec.exe \admin-ws cmd.exe`Comment: The domain controller attempted to validate the credentials for an accountTime: 06:33:37Event: 4776Event content:-PackageName = MICROSOFT_AUTHENTICATION_PACKAGE_V1_0-TargetUserName = my-admin-Workstation = USER-WS-Status = 0x00000000Command: robocopy.exe c:goodiessch \admin-wsc$Comment: The domain controller attempted to validate the credentials for an accountTime: 06:34:16Event: 4776Event content:-PackageName = MICROSOFT_AUTHENTICATION_PACKAGE_V1_0-TargetUserName = my-admin-Workstation = USER-WS-Status = 0x00000000Command: at.exe \admin-ws 06:35 c:schedule.batComment: The domain controller attempted to validate the credentials for an account

源主機/被接管的主機事件(user-ws)

Time: 06:32:44Event: 4624Event content:-SubjectUserSid = S-1-5-18 SubjectUserName = USER-WS$-SubjectDomainName = CORP-SubjectLogonId = 0x00000000000003e7 TargetUserSid = S-1-5-18 TargetUserName = SYSTEM TargetDomainName = NT AUTHORITY TargetLogonId = 0x00000000001046e9-LogonType = 9-LogonProcessName = seclogo-AuthenticationPackageName = Negotiate-WorkstationName = LogonGuid = -TransmittedServices = - LmPackageName = - KeyLength = 0 ProcessId = 0x00000000000003b4-ProcessName = C:/Windows/System32/svchost.exe IpAddress = ::1 IpPort = 0Command: sekurlsa::pth /user:my-admin /domain:corp /ntlm:[nt hash] /run:cmd.exeComment: Succesful logon, TargetLogonId = 0x00000000001046e9Time: 06:32:44Event: 4672Event content:-SubjectUserSid = S-1-5-18 SubjectUserName = SYSTEM SubjectDomainName = NT AUTHORITY-SubjectLogonId = 0x00000000001046e912-PrivilegeList = SeCreateTokenPrivilege SeAssignPrimaryTokenPrivilege SeTcbPrivilege SeSecurityPrivilege SeTakeOwnershipPrivilege SeLoadDriverPrivilege SeBackupPrivilegeSeRestorePrivilege SeDebugPrivilege SeAuditPrivilege SeSystemEnvironmentPrivilegeSeImpersonatePrivilegeComment: Special privileges assigned to new logon, as above. LogonId = 0x00000000001046e9Time: 06:32:55Event: 4648Event content:-SubjectUserSid = S-1-5-18 SubjectUserName = SYSTEM SubjectDomainName = NT AUTHORITY-SubjectLogonId = 0x00000000001046e9 LogonGuid = -TargetUserName = -------- TargetDomainName = ---- TargetLogonGuid = -TargetServerName = admin-ws.corp.pass.thehash TargetInfo = admin-ws.corp.pass.thehash-ProcessId = 0x0000000000000004 ProcessName =-IpAddress = - IpPort = -Command: psexec.exe \admin-ws cmd.exeComment: A logon was attempted using explicit credentials. This event is generated when a process attempts to log on an account by explicitly specifying that accounts credentials. This most commonly occurs in batch-type configurations such as scheduled tasks, or when using the RUNAS command. SubjectLogonId = 0x00000000001046e9Time: 06:32:55Event: 4648Event content:-SubjectUserSid = S-1-5-18 SubjectUserName = SYSTEM SubjectDomainName = NT AUTHORITY-SubjectLogonId = 0x00000000001046e9 LogonGuid = -TargetUserName = -------- TargetDomainName = ---- TargetLogonGuid = -TargetServerName = admin-ws.corp.pass.thehash TargetInfo = admin-ws.corp.pass.thehash ProcessId = 0x0000000000000998-ProcessName = C:/goodies/PsExec.exe-IpAddress = - IpPort = -Comment: LogonId = 0x00000000001046e9Time: 06:33:35Event: 4648Event content:-SubjectUserSid = S-1-5-18 SubjectUserName = SYSTEM SubjectDomainName = NT AUTHORITY-SubjectLogonId = 0x00000000001046e9 LogonGuid = -TargetUserName = -------- TargetDomainName = ---- TargetLogonGuid = -TargetServerName = admin-ws.corp.pass.thehash TargetInfo = admin-ws.corp.pass.thehash-ProcessId = 0x0000000000000004 ProcessName =-IpAddress = - IpPort = -Command: robocopy.exe c:goodiessch \admin-wsc$Comment: A logon was attempted using explicit credentials. LogonId = 0x00000000001046e9Time: 06:34:15Event: 4648Event content:-SubjectUserSid = S-1-5-18 SubjectUserName = SYSTEM SubjectDomainName = NT AUTHORITY-SubjectLogonId = 0x00000000001046e9 LogonGuid = -TargetUserName = -------- TargetDomainName = ---- TargetLogonGuid = -TargetServerName = admin-ws.corp.pass.thehash TargetInfo = admin-ws.corp.pass.thehash-ProcessId = 0x0000000000000004 ProcessName =-IpAddress = - IpPort = -Command: at.exe \admin-ws 08:00 c:schedule.batComment: A logon was attempted using explicit credentials.LogonId = 0x00000000001046e9

目標主機事件(admin-ws)

Time: 06:32:55Event: 4672Event content:-SubjectUserSid = S-1-5-21-2976932740-3244455291-537790045-1105-SubjectUserName = my-admin-SubjectDomainName = CORP SubjectLogonId = 0x00000000000f133c PrivilegeList = SeSecurityPrivilege SeBackupPrivilege SeRestorePrivilege SeTakeOwnershipPrivilege SeDebugPrivilege SeSystemEnvironmentPrivilege SeLoadDriverPrivilegeSeImpersonatePrivilegeComment: Special privileges assigned to new logon.Time: 06:32:55Event: 4624Event content:-SubjectUserSid = S-1-0-0 SubjectUserName = - SubjectDomainName = - SubjectLogonId = 0x0000000000000000 TargetUserSid = S-1-5-21-2976932740-3244455291-537790045-1105-TargetUserName = my-admin-TargetDomainName = CORP-TargetLogonId = 0x00000000000f133c-LogonType = 3-LogonProcessName = NtLmSsp-AuthenticationPackageName = NTLM WorkstationName = USER-WS-LogonGuid = TransmittedServices = - LmPackageName =NTLM V1 KeyLength = 128 ProcessId = 0x0000000000000000 ProcessName = - IpAddress = 192.168.89.101 IpPort = 49286Command: psexec.exe \admin-ws cmd.exeComment: Succesful logon. TargetLogonId = 0x00000000000f133cTime: 06:33:32Event: 4634Event content:-TargetUserSid = S-1-5-21-2976932740-3244455291-537790045-1105-TargetUserName = my-admin-TargetDomainName = CORP-TargetLogonId = 0x00000000000f133c-LogonType = 3Comment: TargetLogonId = 0x00000000000f133cTime: 06:33:35Event: 4672Event content:-SubjectUserSid = S-1-5-21-2976932740-3244455291-537790045-1105-SubjectUserName = my-admin-SubjectDomainName = CORP-SubjectLogonId = 0x00000000000f2736-PrivilegeList = SeSecurityPrivilege SeBackupPrivilege SeRestorePrivilege SeTakeOwnershipPrivilege SeDebugPrivilege SeSystemEnvironmentPrivilege SeLoadDriverPrivilege SeImpersonatePrivilegeTime: 06:33:35Event: 4624Event content:-SubjectUserSid = S-1-0-0 SubjectUserName = - SubjectDomainName = - SubjectLogonId = 0x0000000000000000 TargetUserSid = S-1-5-21-2976932740-3244455291-537790045-1105-TargetUserName = my-admin-TargetDomainName = CORP-TargetLogonId = 0x00000000000f273614-LogonType = 3-LogonProcessName = NtLmSsp-AuthenticationPackageName = NTLM-WorkstationName = USER-WS-LogonGuid = TransmittedServices = - LmPackageName = NTLM V1 KeyLength = 128 ProcessId = 0x0000000000000000 ProcessName = --IpAddress = 192.168.89.101 IpPort = 49298Command: robocopy.exe c:goodiessch \admin-wsc$Time: 06:34:02Event: 4634Event content:-TargetUserSid = S-1-5-21-2976932740-3244455291-537790045-1105-TargetUserName = my-admin-TargetDomainName = CORP-TargetLogonId = 0x00000000000f2736-LogonType = 3Time: 06:34:15Event: 4672Event content:-SubjectUserSid = S-1-5-21-2976932740-3244455291-537790045-1105-SubjectUserName = my-admin SubjectDomainName = CORP-SubjectLogonId = 0x00000000000f309b-PrivilegeList = SeSecurityPrivilege SeBackupPrivilege SeRestorePrivilegeSeTakeOwnershipPrivilege SeDebugPrivilege SeSystemEnvironmentPrivilege SeLoadDriverPrivilege SeImpersonatePrivilege LogonId = 0x00000000000f309bTime: 06:34:15Event: 4624Event content:-SubjectUserSid = S-1-0-0 SubjectUserName = - SubjectDomainName = - SubjectLogonId = 0x0000000000000000 TargetUserSid = S-1-5-21-2976932740-3244455291-537790045-1105-TargetUserName = my-admin-TargetDomainName = CORP-TargetLogonId = 0x00000000000f309b-LogonType = 3-LogonProcessName = NtLmSsp-AuthenticationPackageName = NTLM-WorkstationName = USER-WS-LogonGuid = TransmittedServices = - LmPackageName = NTLM V1 KeyLength = 128 ProcessId = 0x0000000000000000 ProcessName = --IpAddress = 192.168.89.101 IpPort = 49299Command: at.exe \admin-ws 08:00 c:schedule.batComment: LogonId = 0x00000000000f309bTime: 06:34:26Event: 4634Event content:-TargetUserSid = S-1-5-21-2976932740-3244455291-537790045-1105-TargetUserName = my-admin-TargetDomainName = CORP-TargetLogonId = 0x00000000000f309b-LogonType = 3Comment: LogonId = 0x00000000000f309b

Time: 14:11:12Event: 4769Event content:-TargetUserName = myadmin@corp-TargetDomainName = corp-ServiceName = ADMIN-WS$-ServiceSid = S-1-5-21-2976932740-3244455291-537790045-1107-TicketOptions = 0x40810000-TicketEncryptionType = 0x00000012-IpAddress = ::ffff:192.168.89.101 IpPort = 49407-Status = 0x00000000-LogonGuid = -TransmittedServices = -Command: net use \admin-ws

目標主機事件(admin-ws)

Time: 14:11:12Event: 4624Event content:-SubjectUserSid = S-1-0-0 SubjectUserName = - SubjectDomainName = - SubjectLogonId = 0x0000000000000000-TargetUserSid = S-1-5-21-2976932740-3244455291-537790045-500 TargetUserName = myadmin TargetDomainName = corp-TargetLogonId = 0x000000000051f916-LogonType = 3 LogonProcessName = Kerberos AuthenticationPackageName = Kerberos-WorkstationName =-LogonGuid = TransmittedServices = - LmPackageName = - KeyLength = 0 ProcessId = 0x0000000000000000 ProcessName = --IpAddress = 192.168.89.101 IpPort = 49406Command: net use \admin-wsTime: 14:11:12Event: 4672Event content:-SubjectUserSid = S-1-5-21-2976932740-3244455291-537790045-500 SubjectUserName = myadmin-SubjectDomainName =-SubjectLogonId = 0x000000000051f916-PrivilegeList = SeSecurityPrivilege SeBackupPrivilege SeRestorePrivilegeSeTakeOwnershipPrivilege SeDebugPrivilege SeSystemEnvironmentPrivilege SeLoadDriverPrivilege SeImpersonatePrivilegeCommand: net use \admin-wsTime: 14:11:3916Event: 4624Event content:-SubjectUserSid = S-1-0-0 SubjectUserName = - SubjectDomainName = - SubjectLogonId = 0x0000000000000000-TargetUserSid = S-1-5-21-2976932740-3244455291-537790045-500 TargetUserName = myadmin TargetDomainName = corp-TargetLogonId = 0x00000000005204ad-LogonType = 3 LogonProcessName = Kerberos AuthenticationPackageName = Kerberos-WorkstationName =-LogonGuid = TransmittedServices = - LmPackageName = - KeyLength = 0 ProcessId = 0x0000000000000000 ProcessName = --IpAddress = 192.168.89.101 IpPort = 49409Command: psexec.exe \admin-ws cmd.exeTime: 14:11:39Event: 4672Event content:-SubjectUserSid = S-1-5-21-2976932740-3244455291-537790045-500 SubjectUserName = myadmin SubjectDomainName =-SubjectLogonId = 0x00000000005204ad-PrivilegeList = SeSecurityPrivilege SeBackupPrivilege SeRestorePrivilege SeTakeOwnershipPrivilege SeDebugPrivilege SeSystemEnvironmentPrivilege SeLoadDriverPrivilegeSeImpersonatePrivilegeCommand: psexec.exe \admin-ws cmd.exe

Security Windows事件

本節描述本文討論的主要安全事件。

事件ID:4624 帳戶已成功登錄

Subject:Security ID:%1Account Name:%2Account Domain:%3Logon ID:%4Logon Type:%9New Logon:Security ID:%5Account Name:%6Account Domain:%7Logon ID:%8Logon GUID:%13Process Information:Process ID:%17Process Name:%18Network Information:Workstation Name: %12Source Network Address: %19Source Port:%20Detailed Authentication Information:Logon Process:%1017Authentication Package: %11Transited Services: %14Package Name (NTLM only): %15Key Length:%16This event is generated when a logon session is created. It is generated on the computer that was accessed.The subject fields indicate the account on the local system which requested the logon. This is most commonly a service such as the Server service, or a local process such as Winlogon.exe or Services.exe.The logon type field indicates the kind of logon that occurred. The most common types are 2 (interactive) and 3 (network).The New Logon fields indicate the account for whom the new logon was created, i.e. the account that was logged on.The network fields indicate where a remote logon request originated. Workstation name is not always available and may be left blank in some cases.The authentication information fields provide detailed information about this specific logon request.-Logon GUID is a unique identifier that can be used to correlate this event with a KDC event.-Transited services indicate which intermediate services have participated in this logon request.-Package name indicates which sub-protocol was used among the NTLM protocols.-Key length indicates the length of the generated session key. This will be 0 if no session key was requested.

事件ID:4625 帳戶登錄失敗

Subject:Security ID:%1Account Name:%2Account Domain:%3Logon ID:%4Logon Type:%11Account For Which Logon Failed:Security ID:%5Account Name:%6Account Domain:%7Failure Information:Failure Reason:%9Status:%8Sub Status:%10Process Information:Caller Process ID: %18Caller Process Name: %19Network Information:Workstation Name: %14Source Network Address: %20Source Port:%21Detailed Authentication Information:Logon Process:%12Authentication Package: %13Transited Services: %15Package Name (NTLM only): %1618Key Length:%17This event is generated when a logon request fails. It is generated on the computer where access was attempted.The Subject fields indicate the account on the local system which requested the logon. This is most commonly a service such as the Server service, or a local process such as Winlogon.exe or Services.exe.The Logon Type field indicates the kind of logon that was requested. The most common types are 2 (interactive) and 3 (network).The Process Information fields indicate which account and process on the system requested the logon.The Network Information fields indicate where a remote logon request originated. Workstation name is not always available and may be left blank in some cases.The authentication information fields provide detailed information about this specific logon request.-Transited services indicate which intermediate services have participated in this logon request.-Package name indicates which sub-protocol was used among the NTLM protocols.-Key length indicates the length of the generated session key. This will be 0 if no session key was requested.

事件ID:4634 帳戶已註銷

Subject:Security ID:%1Account Name:%2Account Domain:%3Logon ID:%4Logon Type:%5This event is generated when a logon session is destroyed. It may be positively correlated with a logon event using the Logon ID value. Logon IDs are only unique between reboots on the same computer.Event ID: 4647User initiated logoff.Subject:Security ID:%1Account Name:%2Account Domain:%3Logon ID:%4This event is generated when a logoff is initiated but the token reference count is not zero and the logon session cannot be destroyed. No further user-initiated activity can occur. This event can be interpreted as a logoff event.

事件ID:4648 使用顯式憑據嘗試登錄

Subject:Security ID:%1Account Name:%2Account Domain:%319Logon ID:%4Logon GUID:%5Account Whose Credentials Were Used:Account Name:%6Account Domain:%7Logon GUID:%8Target Server:Target Server Name: %9Additional Information: %10Process Information:Process ID:%11Process Name:%12Network Information:Network Address: %13Port:%14This event is generated when a process attempts to log on an account by explicitly specifying that accounts credentials. This most commonly occurs in batch-type configurations such as scheduled tasks, or when using the RUNAS command.

事件ID:4672 給新登錄用戶分配特殊許可權

Subject:Security ID:%1Account Name:%2Account Domain:%3Logon ID:%4Privileges:%5

事件ID:4768 請求Kerberos身份驗證票據(TGT)

Account Information:Account Name:%1Supplied Realm Name: %2User ID:%3Service Information:Service Name:%4Service ID:%5Network Information:Client Address:%10Client Port:%11Additional Information:Ticket Options:%6Result Code:%7Ticket Encryption Type: %8Pre-Authentication Type: %9Certificate Information:Certificate Issuer Name:%12Certificate Serial Number: %13Certificate Thumbprint:%1420Certificate information is only provided if a certificate was used for pre-authentication.Pre-authentication types, ticket options, encryption types and result codes are defined in RFC 4120.

事件ID:4769 請求Kerberos服務票據

Account Information:Account Name:%1Account Domain:%2Logon GUID:%10Service Information:Service Name:%3Service ID:%4Network Information:Client Address:%7Client Port:%8Additional Information:Ticket Options:%5Ticket Encryption Type: %6Failure Code:%9Transited Services: %11This event is generated every time access is requested to a resource such as a computer or a Windows service. The service name indicates the resource to which access was requested.This event can be correlated with Windows logon events by comparing the Logon GUID fields in each event. The logon event occurs on the machine that was accessed, which is often a different machine than the domain controller which issued the service ticket.Ticket options, encryption types, and failure codes are defined in RFC 4120.

事件ID:4776 域控制器試圖驗證帳戶憑據

Authentication Package: %1Logon Account: %2Source Workstation: %3Error Code: %4

0x07 後記

通過這篇文章可以學習到Windows日誌相關的知識,同時接觸到了Pass-the-Hash和Pass-the-Ticket的工作原理,以及如何科學的收集日誌信息可以做到低誤報的針對該類攻擊行為的告警。希望對此類知識有興趣的同學看到本文能有所收穫,當然,如行文中有謬誤還請不吝賜教。


喜歡這篇文章嗎?立刻分享出去讓更多人知道吧!

本站內容充實豐富,博大精深,小編精選每日熱門資訊,隨時更新,點擊「搶先收到最新資訊」瀏覽吧!


請您繼續閱讀更多來自 嘶吼RoarTalk 的精彩文章:

滲透基礎——獲得當前系統已安裝的程序列表
DNS 隧道通信後門的分析報告

TAG:嘶吼RoarTalk |