新聞中心
0x00 前言

成都創(chuàng)新互聯(lián)專業(yè)為企業(yè)提供霍州網(wǎng)站建設、霍州做網(wǎng)站、霍州網(wǎng)站設計、霍州網(wǎng)站制作等企業(yè)網(wǎng)站建設、網(wǎng)頁設計與制作、霍州企業(yè)網(wǎng)站模板建站服務,10余年霍州做網(wǎng)站經(jīng)驗,不只是建網(wǎng)站,更提供有價值的思路和整體網(wǎng)絡服務。
在之前的文章中介紹了兩種維持域控權限的方法——SSP和Skeleton Key,這兩種方法均需要借助Mimikatz來實現(xiàn),或多或少存在一些不足,所以這次接著介紹一個更加隱蔽且不需要使用Mimikatz的后門方法——Hook PasswordChangeNotify.
0x01 簡介
Hook PasswordChangeNotify這個概念最早是在2013年9月15日由clymb3r提出,通過Hook PasswordChangeNotify攔截修改的帳戶密碼。
需要了解的相關背景知識如下:
在修改域控密碼時會進行如下同步操作:
a. 當修改域控密碼時,LSA首先調(diào)用PasswordFileter來判斷新密碼是否符合密碼復雜度要求 b. 如果符合,LSA接著調(diào)用PasswordChangeNotify在系統(tǒng)上同步更新密碼
函數(shù)PasswordChangeNotify存在于rassfm.dll
rassfm.dll可理解為Remote Access Subauthentication dll,只存在于在Server系統(tǒng)下,xp、win7、win8等均不存在
可以使用dumpbin查看rassfm.dll導出函數(shù)來驗證結論2:
1dumpbin /exports c:\windows\system32\rassfm.dll
如圖
0x02 特點
對于之前介紹過的Security Support Provider,在實際使用過程中不可避免的會有以下不足:
安裝后需要重啟系統(tǒng)
需要在System32文件夾下放置dll
需要修改注冊表
而使用Hook PasswordChangeNotify卻有如下優(yōu)點:
不需要重啟
不需要修改注冊表
甚至不需要在系統(tǒng)放置dll
可以說在隱蔽性上,使用Hook PasswordChangeNotify優(yōu)于Security Support Provider
0x03 技術實現(xiàn)
根據(jù)clymb3r提供的poc,實現(xiàn)Hook PasswordChangeNotify共包含兩部分:
1、Hook dll
下載鏈接:
https://github.com/clymb3r/Misc-Windows-Hacking
(1)為PasswordChangeNotify創(chuàng)建一個inline Hook,將初始函數(shù)重定向到PasswordChangeNotifyHook
(2)在PasswordChangeNotifyHook中實現(xiàn)記錄密碼的操作,然后重新將控制權交給PasswordChangeNotify
2、dll注入
可以利用 Powershell tricks中的Process Injection將我們自己編寫的dll注入到lsass進程,實現(xiàn)Hook功能
0x04 實際測試
測試環(huán)境:
Server 2008 R2 x64
Server 2012 R2 x64
測試步驟:
1、生成Hook dll
poc下載地址:
https://github.com/clymb3r/Misc-Windows-Hacking
使用VS2015開發(fā)環(huán)境,MFC設置為在靜態(tài)庫中使用MFC
編譯工程,生成HookPasswordChange.dll
2、生成dll注入的powershell腳本
下載Powershell的dll注入腳本
https://github.com/clymb3r/PowerShell/blob/master/Invoke-ReflectivePEInjection/Invoke-ReflectivePEInjection.ps1
在代碼尾部添加如下代碼:
Invoke-ReflectivePEInjection -PEPath HookPasswordChange.dll –procname lsass
并命名為HookPasswordChangeNotify.ps1
3、Hook PasswordChangeNotify
上傳HookPasswordChangeNotify.ps1和HookPasswordChange.dll
管理員權限執(zhí)行:
1PowerShell.exe -ExecutionPolicy Bypass -File HookPasswordChangeNotify.ps1
如圖
4、自動記錄新密碼
在Server 2012 R2 x64下,手動修改域控密碼后
在C:\Windows\Temp下可以找到passwords.txt,其中記錄了新修改的密碼
如圖
在Server 2008 R2 x64下,同樣成功
如圖
0x05 小結
本文依舊是對常規(guī)功能做了演示,后續(xù)可自定義dll代碼實現(xiàn)更多高級功能,如自動上傳新密碼。
以下鏈接中的代碼可作為參考,其中實現(xiàn)了將獲取的新密碼上傳至Http服務器
http://carnal0wnage.attackresearch.com/2013/09/stealing-passwords-every-time-they.html
使用Hook PasswordChangeNotify來記錄新密碼,如果放在以前,進程注入的操作很容易被檢測,但是得益于Powershell應用的發(fā)展,通過Powershell來進程注入可以繞過常規(guī)的攔截。
當然,Hook PasswordChangeNotify僅僅是眾多Hook方法中的一個。
我已經(jīng)Fork了clymb3r的代碼,并結合本文需要的代碼做了更新,下載地址如下:
https://github.com/3gstudent/Hook-PasswordChangeNotify
0x06 參考資料
Intercepting Password Changes With Function Hooking
http://carnal0wnage.attackresearch.com/2013/09/stealing-passwords-every-time-they.html
http://www.processlibrary.com/en/directory/files/rassfm/305529/
https://github.com/clymb3r/Misc-Windows-Hacking/tree/master/HookPasswordChange
http://www.slideshare.net/nFrontSecurity/how-do-password-filters-work
新聞名稱:域滲透——Hook PasswordChangeNotify
網(wǎng)站鏈接:http://www.dlmjj.cn/article/dpgdjsh.html


咨詢
建站咨詢
