mimikatz n’aime pas les Detours

peng_flowers

Un nombre relativement important de produits de sécurité utilise maintenant la librairie Detours de Microsoft.

Cette librairie facilite la mise en place de hooks inline dans ses propres applications, ou dans des processus externes via l’injection d’une librairie.

Software package for re-routing Win32 APIs underneath applications.

http://research.microsoft.com/projects/detours/

Ces hooks, qu’ils soient posés via Detours ou non, s’opèrent majoritairement par le remplacement des 5 premiers octets d’une fonction par un saut inconditionnel vers une autre fonction.
pour des contrôles de sécurité, modifier des paramètres, altérer le comportement, journaliser…

Mais où se trouvent ces hooks ?
Une petite commande a été codé rapidement : misc::detours

  .#####.   mimikatz 2.0 alpha (x64) release "Kiwi en C" (Aug 24 2013 20:44:17)
 .## ^ ##.
 ## / \ ##  /* * *
 ## \ / ##   Benjamin DELPY `gentilkiwi` ( benjamin@gentilkiwi.com )
 '## v ##'   http://blog.gentilkiwi.com/mimikatz
  '#####'                                    with   8 modules * * */

mimikatz # misc::detours
AcroRd32.exe (1020)
	kernel32.dll ! CreateProcessA           0000000074E91072 -> 0000000000230070
	kernel32.dll ! CreateProcessW           0000000074E9103D -> 0000000000230030
	KERNELBASE.dll ! CreateEventW           00000000751C119F -> 0000000000240030
	KERNELBASE.dll ! OpenEventW             00000000751C11CF -> 0000000000240070
notepad.exe (4316)
	ntdll.dll ! LdrLoadDll                 	0000000076E57AC0 -> 000000006D5EE1C0	(SbieDll.dll)
	ntdll.dll ! LdrUnloadDll               	0000000076E53B10 -> 000000006D5ECF40	(SbieDll.dll)
	ntdll.dll ! NtAdjustPrivilegesToken    	0000000076E816C0 -> 000000006D5FAD60	(SbieDll.dll)
	ntdll.dll ! NtAlpcConnectPort           0000000076E819F0 -> 000000006D5E2FE0	(SbieDll.dll)
	ntdll.dll ! NtAlpcCreatePort            0000000076E81A00 -> 000000006D5E2E30	(SbieDll.dll)
	[...]
	USER32.dll ! UnregisterClassA           0000000076879E70 -> 000000006D5DA2A0	(SbieDll.dll)
	USER32.dll ! UnregisterClassW           000000007687D464 -> 000000006D5DA210	(SbieDll.dll)
plugin-container.exe (2616)
	USER32.dll ! GetWindowInfo              0000000074771BBF -> 00000000627EC6FD	(xul.dll)
FlashPlayerPlugin_11_8_800_94.exe (5516)
	kernel32.dll ! CreateProcessA           0000000074E91072 -> 00000000000A0070
	kernel32.dll ! CreateProcessW           0000000074E9103D -> 00000000000A0030
	KERNELBASE.dll ! CreateEventW           00000000751C119F -> 00000000000F0030
	KERNELBASE.dll ! OpenEventW             00000000751C11CF -> 00000000000F0070
	GDI32.dll ! AbortDoc                    00000000748F3ADC -> 0000000000120030
	GDI32.dll ! AddFontResourceW            00000000748ED2B2 -> 0000000000120BF0
	[...]
	ole32.dll ! OleGetClipboard             0000000074A8FDCD -> 00000000001500B0
	ole32.dll ! OleIsCurrentClipboard       0000000074A636B2 -> 0000000000150070
	ole32.dll ! OleSetClipboard             0000000074A60045 -> 0000000000150030
	MPR.dll ! WNetAddConnection2W           0000000072A94744 -> 00000000003200B0
	MPR.dll ! WNetGetResourceInformationW   0000000072A9389D -> 0000000000320070
	MPR.dll ! WNetGetUniversalNameW         0000000072A9D34E -> 0000000000320030

Vous pourrez facilement retrouver SandBoxie, EMET, Adobe, Flash, etc.
Peut-être même quelques antivirus ou HIPS…

La version alpha prenant en charge ces améliorations est disponible : http://blog.gentilkiwi.com/mimikatz (répertoire alpha)

(ne pas oublier privilege::debug pour inspecter les processus différents des siens)