52 ret = snprintf(Line, MaxLength,
"%s(%-*s", Header, NameAlignment, Task->ProcName);
56 ret = snprintf(Line, MaxLength,
"%s(%s", Header, Task->ProcName);
61 ERROR(
"[ERROR] Encoding error with snprintf: %d\n", ret);
70 ret = snprintf(Line, MaxLength,
" '%s' [0x%08x], %016llx, %016llx, %016llx, %d/%d",
71 Task->Comm, Task->CommHash, Task->Gva, Task->Cr3, Task->MmGva, Task->Pid, Task->Tgid);
75 ERROR(
"[ERROR] Encoding error with snprintf: %d\n", ret);
86 ret = snprintf(Line, MaxLength,
", CLI:`%s`", Task->CmdLine);
90 ERROR(
"[ERROR] Encoding error with snprintf: %d\n", ret);
100 ret = snprintf(Line, MaxLength,
")");
123 DWORD procNameAlignment;
128 if (NULL == Originator->LixProc)
130 ERROR(
"[ERROR] Originator process is NULL!\n");
134 procNameAlignment = 0;
135 if (Victim->Object.LixProc)
138 MAX(Victim->Object.LixProc->ProcNameLength,
139 Originator->LixProc->ProcNameLength));
154 ret = snprintf(l, rem,
", VA: %016llx", Originator->SourceVA);
158 ret = snprintf(l, rem,
", RIP: %016llx", Originator->Rip);
163 ERROR(
"[ERROR] Encoding error with snprintf: %d\n", ret);
172 ", Parent: ", l, rem, 0);
185 ret = snprintf(l, rem,
", RIP: %016llx", Originator->Rip);
189 ERROR(
"[ERROR] Encoding error with snprintf: %d\n", ret);
198 ", Parent: ", l, rem, 0);
217 ret = snprintf(l, rem,
", InjInfo: (%u, %016llx)",
218 Victim->Injection.Length, Victim->Injection.Gva);
222 ret = snprintf(l, rem,
", ExecInfo: (%016llx, %016llx), Stack: (0x%016llx, 0x%16llx), RSP = 0x%016llx",
223 Victim->Ept.Gva, Victim->Ept.Gpa, Victim->ExecInfo.StackBase, Victim->ExecInfo.StackLimit,
224 Victim->ExecInfo.Rsp);
229 ERROR(
"[ERROR] Encoding error with snprintf: %d\n", ret);
238 ", Parent: ", l, rem, 0);
247 const char *libName = (Victim->Object.Type ==
introObjectTypeVdso) ?
"[vdso]" :
"[vsyscall]";
253 ret = snprintf(l, rem,
", Address: (%0llx, %0llx), Lib: %s, WriteInfo: (%u, %016llx -> %016llx)",
254 Victim->Ept.Gva, Victim->Ept.Gpa,
255 libName, Victim->WriteInfo.AccessSize,
256 Victim->WriteInfo.OldValue[0],
257 Victim->WriteInfo.NewValue[0]);
260 ERROR(
"[ERROR] Encoding error with snprintf: %d\n", ret);
276 ret = snprintf(l, rem,
"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^%sMALWARE (user-mode) ",
277 (Victim->Object.LixProc && Victim->Object.LixProc->Protection.Mask &
PROC_OPT_BETA) ?
281 ERROR(
"[ERROR] Encoding error with snprintf: %d\n", ret);
292 ret = snprintf(l, rem,
"(no sig)");
295 ret = snprintf(l, rem,
"(no exc)");
298 ret = snprintf(l, rem,
"(extra)");
301 ret = snprintf(l, rem,
"(error)");
304 ret = snprintf(l, rem,
"(value)");
307 ret = snprintf(l, rem,
"(value code)");
310 ret = snprintf(l, rem,
"(idt)");
313 ret = snprintf(l, rem,
"(version os)");
316 ret = snprintf(l, rem,
"(version intro)");
319 ret = snprintf(l, rem,
"(export)");
322 ret = snprintf(l, rem,
"(process creation)");
325 ret = snprintf(l, rem,
"(unknown)");
328 ret = snprintf(l, rem,
"(%d)", Reason);
334 ERROR(
"[ERROR] Encoding error with snprintf: %d\n", ret);
342 snprintf(l, rem,
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
378 ret = snprintf(Line, MaxLength,
"%s(%-*s", Header, NameAlignment, Process->Name);
382 ret = snprintf(Line, MaxLength,
"%s(%s", Header, Process->Name);
387 ERROR(
"[ERROR] Encoding error with snprintf: %d\n", ret);
396 ret = snprintf(Line, MaxLength,
" [0x%08x], %0*llx, %0*llx, %u, F%x",
402 ERROR(
"[ERROR] Encoding error with snprintf: %d\n", ret);
411 if (Process->Wow64Process)
413 ret = snprintf(Line, MaxLength,
", WOW64");
417 ERROR(
"[ERROR] Encoding error with snprintf: %d\n", ret);
427 if (Process->SystemProcess)
429 ret = snprintf(Line, MaxLength,
", SYS");
433 ERROR(
"[ERROR] Encoding error with snprintf: %d\n", ret);
443 if (Process->Peb64Address)
445 ret = snprintf(Line, MaxLength,
", PEB64: %0*llx",
gGuest.
WordSize * 2, Process->Peb64Address);
449 ERROR(
"[ERROR] Encoding error with snprintf: %d\n", ret);
459 if (Process->Peb32Address)
461 ret = snprintf(Line, MaxLength,
", PEB32: %0*llx",
gGuest.
WordSize * 2, Process->Peb32Address);
465 ERROR(
"[ERROR] Encoding error with snprintf: %d\n", ret);
475 if (Process->CommandLine)
477 ret = snprintf(Line, MaxLength,
", CLI:`%s`", Process->CommandLine);
481 ERROR(
"[ERROR] Encoding error with snprintf: %d\n", ret);
491 ret = snprintf(Line, MaxLength,
")");
530 wName = Module->Path->Path;
531 nameHash = Module->Path->NameHash;
550 ret = snprintf(Line, MaxLength,
"%s(%-*s", Header, NameAlignment, name);
554 ret = snprintf(Line, MaxLength,
"%s(%s", Header, name);
559 ERROR(
"[ERROR] Encoding error with snprintf: %d\n", ret);
568 ret = snprintf(Line, MaxLength,
" [0x%08x], %0*llx, F%x",
569 nameHash,
gGuest.
WordSize * 2, Module->VirtualBase, Module->Flags);
572 ERROR(
"[ERROR] Encoding error with snprintf: %d\n", ret);
581 if (Module->Cache && Module->Cache->Info.TimeDateStamp)
583 ret = snprintf(Line, MaxLength,
", VerInfo: %x:%x",
584 Module->Cache->Info.TimeDateStamp, Module->Cache->Info.SizeOfImage);
588 ERROR(
"[ERROR] Encoding error with snprintf: %d\n", ret);
598 if (Module->Cache && (Module->Cache->Info.IatRva || Module->Cache->Info.IatSize))
600 ret = snprintf(Line, MaxLength,
", IAT: %x:%x",
601 Module->Cache->Info.IatRva, Module->Cache->Info.IatSize);
605 ERROR(
"[ERROR] Encoding error with snprintf: %d\n", ret);
615 ret = snprintf(Line, MaxLength,
")");
638 DWORD modNameAlignment;
643 if (NULL == Originator->WinProc)
645 ERROR(
"[ERROR] Originator process is NULL!\n");
651 Originator->WinLib->DoubleAgentAlertSent)
656 modNameAlignment = 0;
659 if (Victim->Object.Library.WinMod && Originator->WinLib)
662 MAX(Victim->Object.Library.WinMod->Path->PathSize,
663 Originator->WinLib->Path->PathSize) >> 1);
682 ret = snprintf(l, rem,
", VA: %0*llx",
gGuest.
WordSize * 2, Originator->SourceVA);
686 ret = snprintf(l, rem,
", RIP: %0*llx",
gGuest.
WordSize * 2, Originator->Rip);
691 ERROR(
"[ERROR] Encoding error with snprintf: %d\n", ret);
707 Originator->Return.Library &&
708 Originator->Return.Rip != Originator->Rip)
714 "Return -> Module: ",
721 ret = snprintf(l, rem,
", RIP %0*llx",
gGuest.
WordSize * 2, Originator->Return.Rip);
725 ERROR(
"[ERROR] Encoding error with snprintf: %d\n", ret);
738 CHAR instr[ND_MIN_BUF_SIZE];
741 ndstatus = NdToText(Originator->Instruction, Originator->Rip,
sizeof(instr), instr);
742 if (!ND_SUCCESS(ndstatus))
751 ret = snprintf(l, rem,
", RIP %0*llx",
gGuest.
WordSize * 2, Originator->Rip);
755 ERROR(
"[ERROR] Encoding error with snprintf: %d\n", ret);
767 ret = snprintf(l, rem,
", Instr: %s", instr);
771 ERROR(
"[ERROR] Encoding error with snprintf: %d\n", ret);
781 if (Originator->Return.Library && Originator->Return.Rip != Originator->Rip)
787 "Return -> Module: ",
794 ret = snprintf(l, rem,
", RIP %0*llx",
gGuest.
WordSize * 2, Originator->Return.Rip);
798 ERROR(
"[ERROR] Encoding error with snprintf: %d\n", ret);
825 ret = snprintf(l, rem,
", InjInfo: (%u, %0*llx), Init: (%u, %u)",
827 Victim->Injection.Gva, Victim->Object.WinProc->StartInitializing,
828 Victim->Object.WinProc->Initialized);
833 ret = snprintf(l, rem,
", ExecInfo: (0x%0*llx, 0x%0*llx), Stack: (0x%0*llx, 0x%0*llx), SP = 0x%0*llx",
836 Victim->ExecInfo.StackLimit,
gGuest.
WordSize * 2, Victim->ExecInfo.Rsp);
841 ERROR(
"[ERROR] Encoding error with snprintf: %d\n", ret);
855 if (Victim->Object.Vad)
859 if (Victim->Object.Vad->Path)
861 path = Victim->Object.Vad->Path->Path;
863 else if (Victim->Object.Vad->IsStack)
868 LOG(
"Victim -> VAD: [%llx - %llx], Prot: %x, VadProt: %x, Type: %d, Name: %s\n",
869 Victim->Object.Vad->StartPage, Victim->Object.Vad->EndPage, Victim->Object.Vad->Protection,
870 Victim->Object.Vad->VadProtection, Victim->Object.Vad->VadType,
utf16_for_log(path));
873 if (Victim->Object.Library.WinMod)
875 QWORD startGva, exportGva;
887 startGva = exportGva = Victim->Injection.Gva;
891 startGva = exportGva = Victim->Ept.Gva;
895 if (Victim->Object.Library.Export == NULL)
901 pExport = Victim->Object.Library.Export;
906 ret = snprintf(l, rem,
", Exports (%u) : [", pExport->
NumberOfOffsets);
909 ERROR(
"[ERROR] Encoding error with snprintf: %d\n", ret);
921 ret = snprintf(l, rem,
"'%s'", pExport->
Names[export]);
925 ret = snprintf(l, rem,
"'%s',", pExport->
Names[export]);
930 ERROR(
"[ERROR] Encoding error with snprintf: %d\n", ret);
940 ret = snprintf(l, rem,
"], Delta: +%02x, ",
941 (
DWORD)(Victim->Ept.Gva - Victim->Object.Library.WinMod->VirtualBase - pExport->
Rva));
944 ERROR(
"[ERROR] Encoding error with snprintf: %d\n", ret);
961 "Victim -> Module: ",
969 if (Victim->Object.Library.Export == NULL)
975 pExport = Victim->Object.Library.Export;
980 ret = snprintf(l, rem,
", Exports (%u) : [", pExport->
NumberOfOffsets);
983 ERROR(
"[ERROR] Encoding error with snprintf: %d\n", ret);
995 ret = snprintf(l, rem,
"'%s'", pExport->
Names[export]);
999 ret = snprintf(l, rem,
"'%s',", pExport->
Names[export]);
1004 ERROR(
"[ERROR] Encoding error with snprintf: %d\n", ret);
1014 ret = snprintf(l, rem,
"], Delta: +%02x, ",
1015 (
DWORD)(Victim->Ept.Gva - Victim->Object.Library.WinMod->VirtualBase - pExport->
Rva));
1018 ERROR(
"[ERROR] Encoding error with snprintf: %d\n", ret);
1027 ret = snprintf(l, rem,
", Address: (%0*llx, %0*llx)",
1032 ERROR(
"[ERROR] Encoding error with snprintf: %d\n", ret);
1040 ret = snprintf(l, rem,
", WriteInfo: (%u, %016llx -> %016llx)",
1041 Victim->WriteInfo.AccessSize,
1042 Victim->WriteInfo.OldValue[0],
1043 Victim->WriteInfo.NewValue[0]);
1046 ERROR(
"[ERROR] Encoding error with snprintf: %d\n", ret);
1054 if (Victim->ZoneFlags)
1056 ret = snprintf(l, rem,
", Flags:%s%s%s%s%s (0x%llx)",
1062 (
unsigned long long)Victim->ZoneFlags);
1065 ERROR(
"[ERROR] Encoding error with snprintf: %d\n", ret);
1082 ret = snprintf(l, rem,
"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^%sMALWARE (user-mode) ",
1083 (Victim->Object.WinProc->BetaDetections) ?
" (B) " :
" ");
1086 ERROR(
"[ERROR] Encoding error with snprintf: %d\n", ret);
1097 ret = snprintf(l, rem,
"(no sig)");
1100 ret = snprintf(l, rem,
"(no exc)");
1103 ret = snprintf(l, rem,
"(extra)");
1106 ret = snprintf(l, rem,
"(error)");
1109 ret = snprintf(l, rem,
"(value)");
1112 ret = snprintf(l, rem,
"(value code)");
1115 ret = snprintf(l, rem,
"(export)");
1118 ret = snprintf(l, rem,
"(idt)");
1121 ret = snprintf(l, rem,
"(version os)");
1124 ret = snprintf(l, rem,
"(version intro)");
1127 ret = snprintf(l, rem,
"(process creation)");
1130 ret = snprintf(l, rem,
"(unknown)");
1133 ret = snprintf(l, rem,
"(%d)", Reason);
1139 ERROR(
"[ERROR] Encoding error with snprintf: %d\n", ret);
1147 snprintf(l, rem,
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
1160 if (NULL == pDebugger)
1162 LOG(
"[DPI] Process %s [0x%08x] (%d, 0x%016llx) is debugged by process %s!\n",
1167 LOG(
"[DPI] Process %s [0x%08x] (%d, 0x%016llx) is debugged by process %s [0x%08x] (%d, 0x%016llx)!\n",
1177 LOG(
"[DPI] Process %s [0x%08x] (%d, 0x%016llx) attempted to start process %s [0x%08x] " 1178 "(%d, 0x%016llx) with a pivoted stack!\n",
1182 LOG(
"[DPI] Current stack 0x%016llx [base 0x%016llx, limit 0x%016llx], wow64 " 1183 "stack 0x%016llx [base 0x%016llx, limit 0x%016llx]\n",
1204 ERROR(
"[ERROR] IntVirtMemMap failed for 0x%016llx: 0x%08x\n",
1208 goto _skip_trap_frame;
1228 ERROR(
"[ERROR] IntVirtMemMap failed for 0x%016llx: 0x%08x\n",
1232 goto _skip_trap_frame;
1249 LOG(
"[DPI] Process %s [0x%08x] (%d, 0x%016llx) started with " 1250 "a stolen token from %s [0x%08x] (%d, 0x%016llx)!\n",
1258 WORD maxNumberOfHeapVals = 0;
1259 DWORD detectedPage = 0, maxPageHeapVals = 0;
1261 LOG(
"[DPI] Process %s [0x%08x] (%d, 0x%016llx) started from %s " 1262 "[0x%08x] (%d, 0x%016llx) after it has been heap sprayed! (shell code flags: 0x%016llx)\n",
1275 DWORD checkedPage = ((val << 24) | (val << 16) | (val << 8) | val) &
PAGE_MASK;
1277 LOG(
"[DPI] For page 0x%08x, %s %s %s (offset 0x%03x), number of heap values: %d\n",
1280 "was mapped" :
"was not mapped",
1282 "was detected" :
"was not detected",
1284 "executable" :
"not executable",
1290 detectedPage = checkedPage;
1295 >= maxNumberOfHeapVals &&
1298 maxNumberOfHeapVals =
1300 maxPageHeapVals = checkedPage;
1304 LOG(
"[INFO] Page detected: 0x%08x, maximum number of heap values: 0x%08x (%d)\n",
1305 detectedPage, maxPageHeapVals, maxNumberOfHeapVals);
1309 if (0 != detectedPage)
1311 LOG(
"[INFO] Dumping page: 0x%08x...\n", detectedPage);
1316 if (detectedPage != maxPageHeapVals)
1318 LOG(
"[INFO] Dumping page: 0x%08x...\n", maxPageHeapVals);
1328 LOG(
"[DPI] Process %s [0x%08x] (%d, 0x%016llx) started from %s [0x%08x] (%d, 0x%016llx) " 1329 "after it didn't pass privileges checks!\n",
1339 LOG(
"[DPI] Privileges: Enabled: old: 0x%016llx, new: 0x%016llx, Present: old: 0x%016llx, new: 0x%016llx\n",
1350 LOG(
"[DPI] Process %s [0x%08x] (%d, 0x%016llx) started from %s " 1351 "[0x%08x] (%d, 0x%016llx) from a thread considered suspicious (start 0x%016llx, shellcode flags: 0x%016llx)!\n",
1369 ERROR(
"[ERROR] Victim has type introObjectTypeProcessCreationDpi but no known flag was given, " 1370 "flags: 0x%x\n", Originator->PcType);
1500 if (Victim->Injection.Gva >= Victim->Object.WinProc->Peb32Address &&
1501 Victim->Injection.Gva < Victim->Object.WinProc->Peb32Address +
WIN_UM_FIELD(Peb, 32Size))
1508 if (Victim->Injection.Gva >= Victim->Object.WinProc->Peb64Address &&
1509 Victim->Injection.Gva < Victim->Object.WinProc->Peb64Address +
WIN_UM_FIELD(Peb, 64Size))
1538 LOG(
"[ERROR] This is a corruption in the update/exception. Type = %d!\n", ZoneType);
1571 if (ExceptionFlags & EXCEPTION_FLG_32)
1574 match = !
gGuest.
Guest64 || Originator->WinProc->Wow64Process;
1576 else if (ExceptionFlags & EXCEPTION_FLG_64)
1579 match =
gGuest.
Guest64 && !Originator->WinProc->Wow64Process;
1585 if (ExceptionFlags & EXCEPTION_FLG_32)
1589 else if (ExceptionFlags & EXCEPTION_FLG_64)
1624 if (Victim->Object.WinProc->ParentEprocess != Originator->WinProc->EprocessAddress)
1631 if (Victim->Object.LixProc->ActualParent != Originator->LixProc->Gva)
1669 if (!Victim->Object.WinProc->SystemProcess)
1676 if (!Originator->WinProc->SystemProcess)
1685 if ((Victim->Object.WinProc->InjectedApphelpAddress != Victim->Injection.Gva) ||
1686 (Victim->Object.WinProc->InjectedAppHelpSize != Victim->Injection.Length))
1696 if (Originator->WinProc->OneTimeInjectionDone)
1702 Originator->WinProc->OneTimeInjectionDone =
TRUE;
1707 if (Victim->Object.WinProc->OneTimeInjectionDone)
1713 Victim->Object.WinProc->OneTimeInjectionDone =
TRUE;
1773 else if (Originator->LixProc->Path)
1798 Exception->Victim.NameHash == Victim->Object.NameHash);
1827 match = Exception->Victim.ProcessHash == Originator->WinProc->NameHash;
1831 match = Exception->Victim.ProcessHash == Originator->LixProc->CommHash;
1852 return ((Item ==
'*') || (Item ==
'?') || (Item ==
']') || (Item ==
'[') || (Item ==
'/'));
1903 if (Victim->Object.WinProc->Lsass && (Victim->ZoneFlags &
ZONE_READ))
1905 logInjection =
FALSE;
1909 if (logInjection && Originator->Process)
1915 cr3 = Originator->WinProc->Cr3;
1919 cr3 = Originator->LixProc->Cr3;
1923 if (Victim->Injection.Buffer &&
1924 Victim->Injection.BufferSize == Victim->Injection.Length)
1927 Originator->SourceVA,
1928 Victim->Injection.BufferSize,
1937 Victim->Injection.Length,
1961 Originator->Process = Process;
1962 Originator->Library = NULL;
1964 Originator->Execute =
TRUE;
1971 memzero(&stack,
sizeof(stack));
1972 stack.
Traces = stackElements;
1977 WARNING(
"[WARNING] IntWinStackTraceGetUser failed: %08x\n", status);
2027 #define MEMORY_FUNC_SIZE 0x400 2029 isUcrtbase = 0 ==
wstrcasecmp(Module->Path->Name, u
"ucrtbase.dll");
2033 DWORD rva = (
DWORD)(Originator->Rip - Module->VirtualBase);
2036 if (NULL == Module->Cache || !Module->Cache->MemoryFuncsRead)
2041 for (
DWORD i = 0; i <
ARRAYSIZE(Module->Cache->MemFuncs.FuncArray); i++)
2043 if (0 == Module->Cache->MemFuncs.FuncArray[i])
2048 if (rva > Module->Cache->MemFuncs.FuncArray[i] &&
2051 foundMemFunc =
TRUE;
2061 else if (((Module->Path->NameSize < 10 || 0 != memcmp(Module->Path->Name, u
"msvcr", 10)) &&
2062 (Module->Path->NameSize < 18 || 0 != memcmp(Module->Path->Name, u
"vcruntime", 18))) &&
2069 memzero(&stack,
sizeof(stack));
2070 stack.
Traces = stackElements;
2081 ERROR(
"[ERROR] IntWinStackTraceGetUser failed: %08x\n", status);
2087 if (stack.
Bits64 && !isUcrtbase && !Process->ExploitGuardEnabled)
2107 if (isUcrtbase && Process->ExploitGuardEnabled)
2124 Originator->Return.Library = pModule;
2126 Originator->Return.NameWide = pModule->
Path->
Name;
2150 #undef MEMORY_FUNC_SIZE 2176 if (NULL == Process)
2181 if (NULL == Originator)
2186 Originator->Process = Process;
2187 Originator->Library = NULL;
2188 Originator->Execute =
FALSE;
2195 Originator->Rip = Address;
2196 Originator->Instruction = Instrux;
2198 Originator->Library = pMod;
2199 if (NULL != Originator->Library)
2201 Originator->NameHash = Originator->WinLib->
Path->
NameHash;
2202 Originator->NameWide = Originator->WinLib->Path->Name;
2207 Originator->Name = NULL;
2213 WARNING(
"[WARNING] IntExceptUserHandleMemoryFunctions failed: %08x\n", status);
2218 Originator->Rip = Address;
2219 Originator->Instruction = Instrux;
2222 Originator->Name = NULL;
2224 else if (!ModuleWrite)
2226 Originator->SourceVA = Address;
2264 if (Process == NULL)
2279 Victim->Object.Type = ObjectType;
2280 Victim->Object.Process = Process;
2289 Victim->Object.BaseAddress = pProcess->
Cr3;
2290 Victim->Object.NameHash = pProcess->
NameHash;
2291 Victim->Object.Name = pProcess->
Name;
2297 Victim->Object.BaseAddress = pTask->
Cr3;
2298 Victim->Object.NameHash = pTask->
CommHash;
2299 Victim->Object.Name = pTask->
Comm;
2328 if (NULL == Process)
2340 Victim->ZoneFlags = ZoneFlags;
2342 Victim->Injection.Gva = DestinationGva;
2343 Victim->Injection.Length = Length;
2345 Victim->Object.Process = Process;
2351 Victim->Object.BaseAddress = pProc->
Cr3;
2352 Victim->Object.NameHash = pProc->
NameHash;
2353 Victim->Object.Name = pProc->
Name;
2363 Victim->Object.Library.Module = pMod;
2375 Victim->Object.BaseAddress = pTask->
Cr3;
2376 Victim->Object.NameHash = pTask->
CommHash;
2377 Victim->Object.Name = pTask->
Comm;
2448 _In_ void *Exception,
2473 switch (ExceptionType)
2489 ERROR(
"[ERROR] Shouldn't reach here. Exception Type is %d...\n", ExceptionType);
2493 switch (ExceptionType)
2510 ERROR(
"[ERROR] Shouldn't reach here. Exception Type is %d...\n", ExceptionType);
2517 switch (ExceptionType)
2534 ERROR(
"[ERROR] Shouldn't reach here. Exception Type is %d...\n", ExceptionType);
2538 switch (ExceptionType)
2555 ERROR(
"[ERROR] Shouldn't reach here. Exception Type is %d...\n", ExceptionType);
2559 switch (ExceptionType)
2576 ERROR(
"[ERROR] Shouldn't reach here. Exception Type is %d...\n", ExceptionType);
2580 switch (ExceptionType)
2597 ERROR(
"[ERROR] Shouldn't reach here. Exception Type is %d...\n", ExceptionType);
2601 switch (ExceptionType)
2618 ERROR(
"[ERROR] Shouldn't reach here. Exception Type is %d...\n", ExceptionType);
2662 if (NULL == Originator)
2679 if (showNotLoadedWarning)
2681 LOG(
"**************************************************\n");
2682 LOG(
"************Exceptions are not loaded*************\n");
2683 LOG(
"**************************************************\n");
2685 showNotLoadedWarning =
FALSE;
2705 goto _match_ex_alert;
2710 goto _match_ex_alert;
2713 if (pEx->OriginatorNameHash > Originator->NameHash)
2717 else if (pEx->OriginatorNameHash != Originator->NameHash)
2736 goto _match_ex_alert_process;
2740 if (pEx->OriginatorNameHash > Originator->NameHash)
2744 else if (pEx->OriginatorNameHash < Originator->NameHash)
2749 _match_ex_alert_process:
2761 goto _match_ex_process;
2765 if (pEx->OriginatorNameHash > Originator->NameHash)
2769 else if (pEx->OriginatorNameHash < Originator->NameHash)
2814 if (Originator->Name != NULL)
2820 if ((Originator->Name[0] < pEx->OriginatorNameGlob[0]) &&
2826 if ((Originator->Name[0] != pEx->OriginatorNameGlob[0]) &&
2832 if (Originator->Library == NULL && Originator->Name != NULL)
2839 else if (Originator->Library != NULL && Originator->NameWide != NULL)
2854 TRACE(
"[EXCEPTION] IntExceptMatchException (GLOB) returned INT_STATUS_EXCEPTION_ALLOW.");
2869 if (pEx->OriginatorNameHash > Originator->NameHash)
2873 else if (pEx->OriginatorNameHash < Originator->NameHash)
2891 if (Originator->Library && Originator->Return.Library &&
2892 (Originator->Rip == Originator->Return.Rip))
2894 goto _beta_exceptions;
2901 if (pEx->OriginatorNameHash > Originator->Return.NameHash)
2905 else if (pEx->OriginatorNameHash < Originator->Return.NameHash)
2937 if (pEx->OriginatorNameHash != Originator->Return.NameHash)
2944 if (pEx->OriginatorNameHash != Originator->NameHash)
2962 goto _match_process_beta_ex;
2967 goto _match_process_beta_ex;
2972 if (pEx->OriginatorNameHash != Originator->Return.NameHash)
2979 if (pEx->OriginatorNameHash != Originator->NameHash)
2985 _match_process_beta_ex:
WINUM_PATH * Path
Module path.
The object allows only dlls which are detected as suspicous (e.g. module loads before kernel32...
INTSTATUS IntExceptUserVerifyExtra(EXCEPTION_VICTIM_ZONE *Victim, EXCEPTION_UM_ORIGINATOR *Originator, UM_EXCEPTION *Exception)
This function is used as an extra step in exception mechanism that verify the initialization flags of...
BOOLEAN Bits64
TRUE if we got the stack frame in 64-bit mode (RBP) or 32 (EBP)
enum _INTRO_ACTION_REASON INTRO_ACTION_REASON
The reason for which an INTRO_ACTION was taken.
#define INT_STATUS_EXCEPTION_NOT_MATCHED
int IntExceptPrintWinProcInfo(WIN_PROCESS_OBJECT *Process, char *Header, char *Line, int MaxLength, DWORD NameAlignment)
Print the data from the provided WIN_PROCESS_OBJECT.
QWORD Cr3
The CR3 for this process.
#define HEAP_SPRAY_NR_PAGES
DWORD MonitorModules
TRUE if we need to monitor module load/unloads.
char * utf16toutf8(char *Destination, const WCHAR *Source, DWORD DestinationMaxLength)
INTSTATUS IntVirtMemUnmap(void **HostPtr)
Unmaps a memory range previously mapped with IntVirtMemMap.
INTSTATUS IntExceptUserGetOriginator(void *Process, BOOLEAN ModuleWrite, QWORD Address, INSTRUX *Instrux, EXCEPTION_UM_ORIGINATOR *Originator)
This function is used to get the information about the user-mode originator.
The creation of a process was attempted while the parent had its heap sprayed.
An internal error occurred (no memory, pages not present, etc.).
static __inline BOOLEAN IntExceptUserMatchProcessHash(EXCEPTION_UM_ORIGINATOR *Originator, UM_EXCEPTION *Exception)
Checks if the exception process name-hash of the current exception matches the process name-hash of t...
static void InsertHeadList(LIST_ENTRY *ListHead, LIST_ENTRY *Entry)
IG_ARCH_REGS Regs
The current state of the guest registers.
QWORD SystemCr3
The Cr3 used to map the kernel.
#define INT_STATUS_SUCCESS
BOOLEAN glob_match_utf8(char const *Pattern, char const *String, BOOLEAN IgnoreCase, BOOLEAN Truncated)
BOOLEAN glob_match_utf16(char const *Pattern, WCHAR const *String, BOOLEAN IgnoreCase, BOOLEAN Truncated)
#define ZONE_LIB_RESOURCES
Used for the resources section (usually .rsrc inside a driver or dll).
User-mode non executable zone.
LIST_HEAD GenericUserExceptions
Linked list used for user-mode exceptions that have a generic originator(*).
QWORD TrapFrameAddress
The address of the trap frame. Used for more information gathering when sending the alert...
Process creation violation.
The modified object is anything inside the structure CONTEXT (valid only for windows).
QWORD Wow64StackLimit
The known stack limit in WoW64 mode. Valid only if the process is WoW64.
LIST_HEAD ProcessCreationAlertExceptions
Linked list used for process-creation exceptions that are added from alert.
QWORD NewEnabled
The new value from parent's token Privileges.Enabled field, which was deemed malicious.
DWORD NumberOfOffsets
Number of symbols pointing to the exported RVA.
#define WIN_UM_FIELD(Structure, Field)
Macro used to access user mode fields inside the WIN_OPAQUE_FIELDS structure.
The exception will take into consideration the return driver/dll.
static __inline BOOLEAN IntExceptUserMatchChild(EXCEPTION_VICTIM_ZONE *Victim, EXCEPTION_UM_ORIGINATOR *Originator, DWORD ExceptionFlags)
Checks if the victim is a child of the originator.
#define INT_SUCCESS(Status)
void IntDumpWinTrapFrame32(KTRAP_FRAME32 *TrapFrame)
This function dumps a windows 64 guest trap frame.
#define EXCEPTION_NO_NAME
QWORD StartAddress
The address on which the parent's thread started execution.
#define INT_STATUS_EXCEPTION_CHECKS_OK
Describe a user-mode glob exception.
enum _UM_EXCEPTION_OBJECT UM_EXCEPTION_OBJECT
Object type of the user-mode exception.
Structure that describes a stack trace element.
The exception is valid only for read violation.
#define INT_STATUS_NOT_NEEDED_HINT
Process creation violation DPI.
DWORD NumberOfTraces
Number of elements inside Traces.
LIST_HEAD UserAlertExceptions
Linked list used for user-mode exceptions that are added from alert.
Describes a user-mode originator.
#define for_each_um_exception(_ex_head, _var_name)
INTSTATUS IntExceptUser(EXCEPTION_VICTIM_ZONE *Victim, EXCEPTION_UM_ORIGINATOR *Originator, INTRO_ACTION *Action, INTRO_ACTION_REASON *Reason)
This function iterates through exception lists and tries to find an exception that matches the origin...
The name can be any string.
QWORD StolenFromEprocess
The EPROCESS address from which the token was stolen.
LIST_HEAD UserExceptions[EXCEPTION_TABLE_SIZE]
Array of linked lists used for user-mode exceptions.
INTSTATUS IntExceptMatchException(void *Victim, void *Originator, void *Exception, EXCEPTION_TYPE ExceptionType, INTRO_ACTION *Action, INTRO_ACTION_REASON *Reason)
This function tries to find a exception for the current violation..
int INTSTATUS
The status data type.
BOOLEAN Loaded
True if the exceptions are loaded.
DWORD NameHash
Name hash, as used by the exceptions module.
The exception will match only for the init phase of a driver/process.
static __inline BOOLEAN IntExceptUserMatchZoneType(EXCEPTION_VICTIM_ZONE *Victim, UM_EXCEPTION_OBJECT ZoneType)
Checks if the zone-type of the current exception matches the zone-type of the victim.
The exception is valid only if the originator process is a system process.
QWORD DebuggerEprocess
This will keep the EPROCESS of the debugger process (if any).
#define MAX_PATH
The maximum size of a path (260 characters on windows).
struct _WIN_PROCESS_MODULE * PWIN_PROCESS_MODULE
User-mode exception that accepts glob content.
static __inline BOOLEAN IntExceptUserMatchProcessGlob(EXCEPTION_UM_ORIGINATOR *Originator, UM_EXCEPTION_GLOB *Exception)
Checks if the exception process glob-name of the current exception matches the process glob-name of t...
INTRO_GUEST_TYPE OSType
The type of the guest.
QWORD Wow64StackBase
The known stack base in WoW64 mode. Valid only if the process is WoW64.
INTSTATUS IntExceptUserGetExecOriginator(void *Process, EXCEPTION_UM_ORIGINATOR *Originator)
This function is used to get the originator for heap execution.
INSTRUX Instruction
The current instruction, pointed by the guest RIP.
INTSTATUS IntExceptGetVictimProcess(void *Process, QWORD DestinationGva, DWORD Length, QWORD ZoneFlags, EXCEPTION_VICTIM_ZONE *Victim)
This function is used to get the information about the victim process for injection violations...
The exception is valid only for write violation.
STACK_ELEMENT * Traces
Array describing the stack trace elements.
DWORD CommHash
The CRC32 checksum of the Comm field.
The modified object is only another process (injection basically).
void * ReturnModule
The module to which the function belongs.
PWIN_PROCESS_MODULE IntWinUmModFindByAddress(PWIN_PROCESS_OBJECT Process, QWORD Gva)
Searches for a user-mode module which contains the indicated guest virtual address.
static __inline BOOLEAN IntExceptUserMatchNameHash(EXCEPTION_VICTIM_ZONE *Victim, UM_EXCEPTION *Exception)
Checks if the exception name-hash of the current exception matches the name-hash of the victim...
QWORD Cr3
Process PDBR. Includes PCID.
struct _DPI_EXTRA_INFO::@202 DpiHeapSprayExtraInfo
enum _INTRO_OBJECT_TYPE INTRO_OBJECT_TYPE
The type of the object protected by an EPT hook.
struct _DPI_EXTRA_INFO::@200 DpiPivotedStackExtraInfo
#define ZONE_LIB_CODE
Used for a generic code zone.
#define INITIAL_CRC_VALUE
EXCEPTIONS * Exceptions
The exceptions that are currently loaded.
static INTSTATUS IntExceptUserHandleMemoryFunctions(WIN_PROCESS_OBJECT *Process, WIN_PROCESS_MODULE *Module, EXCEPTION_UM_ORIGINATOR *Originator)
This function is used to check if the write has been made using a function that write/read memory (eg...
static BOOLEAN RemoveEntryList(LIST_ENTRY *Entry)
#define ZONE_EXECUTE
Used for execute violation.
The parent of a process has a stolen access token when it created the child.
The exception is valid only for execute violation.
BOOLEAN Guest64
True if this is a 64-bit guest, False if it is a 32-bit guest.
#define ZONE_PROC_THREAD_APC
Used for the APC thread hijacking technique.
CHAR Name[IMAGE_BASE_NAME_LEN]
Process base name.
enum _EXCEPTION_TYPE EXCEPTION_TYPE
The type of an exception.
The creation of a process was attempted with token privileges altered in a malicious way...
static void IntExceptUserLogWindowsInformation(EXCEPTION_VICTIM_ZONE *Victim, EXCEPTION_UM_ORIGINATOR *Originator, INTRO_ACTION Action, INTRO_ACTION_REASON Reason)
Print the information about a violation (windows guest).
static __inline BOOLEAN IntExceptUserMatchNameGlob(EXCEPTION_VICTIM_ZONE *Victim, UM_EXCEPTION_GLOB *Exception)
Checks if the exception glob-name of the current exception matches the glob-name of the victim...
#define INT_STATUS_INVALID_PARAMETER_4
INTSTATUS IntExceptUserVerifyExtraGlobMatch(EXCEPTION_VICTIM_ZONE *Victim, EXCEPTION_UM_ORIGINATOR *Originator, UM_EXCEPTION_GLOB *Exception)
This function is used as an extra step in exception mechanism that verify the initialization flags of...
The parent of a process had a pivoted stack when it created the child.
QWORD CurrentWow64Stack
The current stack of the process in WoW64 mode. Valid only if the process is WoW64.
int IntExceptPrintWinModInfo(WIN_PROCESS_MODULE *Module, char *Header, char *Line, int MaxLength, DWORD NameAlignment)
Print the data from the provided WIN_PROCESS_MODULE.
Executions inside the SharedUserData region.
#define INT_STATUS_INVALID_PARAMETER_5
DPI_EXTRA_INFO DpiExtraInfo
Represents the gathered extra info while checking the DPI heuristics.
QWORD ReturnAddress
The address where the current stack frame will return (@ ret)
QWORD NewPresent
The new value from parent's token Privileges.Present field, which was deemed malicious.
struct _DPI_EXTRA_INFO::@204 DpiThreadStartExtraInfo
QWORD CurrentStack
The current stack of the process at the point of process creation.
void IntDumpWinTrapFrame64(KTRAP_FRAME64 *TrapFrame)
This function dumps a windows 64 guest trap frame.
BYTE WordSize
Guest word size. Will be 4 for 32-bit guests and 8 for 64-bit guests.
The modified object is anything inside of the PEB32 structure.
void IntExceptUserLogInformation(EXCEPTION_VICTIM_ZONE *Victim, EXCEPTION_UM_ORIGINATOR *Originator, INTRO_ACTION Action, INTRO_ACTION_REASON Reason)
Print the information about a user-mode violation, dumps the code-blocks and the injection buffer...
DWORD Pid
Process ID (the one used by Windows).
#define ZONE_LIB_EXPORTS
Used for the exports of a dll, driver, etc.
static __inline BOOLEAN IntExceptUserMatchZoneFlags(EXCEPTION_VICTIM_ZONE *Victim, DWORD ZoneFlags)
Checks if the zone-flags of the current exception match the zone flags of the victim.
The modified object is inside the process module's IAT.
Describes the modified zone.
DWORD NameHash
The CRC32 hash of the name. Used for fast matching.
Describe a user-mode exception.
DWORD Rva
The RVA of this export.
QWORD StackBase
The known stack base present in TIB at the moment of process creation.
LIST_HEAD GlobUserExceptions
Linked list used for user-mode exceptions that contains glob content.
#define EXCEPTION_NO_WNAME
struct _DPI_EXTRA_INFO::@202::@205 HeapPages[HEAP_SPRAY_NR_PAGES]
#define for_each_um_glob_exception(_ex_head, _var_name)
The exception file was not loaded (there are no exceptions).
enum _INTRO_ACTION INTRO_ACTION
Event actions.
LIST_HEAD ProcessCreationExceptions
Linked list used for process creations exceptions.
static __inline BOOLEAN IntExceptUserMatchArchitecture(EXCEPTION_UM_ORIGINATOR *Originator, DWORD ExceptionFlags)
Checks if the architecture-flags of the current exception match the architecture-flags of the origina...
struct _DPI_EXTRA_INFO::@201 DpiStolenTokenExtraInfo
struct _DPI_EXTRA_INFO::@203 DpiTokenPrivsExtraInfo
The exception is valid only if the modified process is a child of the originator process.
INTSTATUS IntWinUmCheckInitializationInjection(PEXCEPTION_VICTIM_ZONE Victim, PEXCEPTION_UM_ORIGINATOR Originator)
This function is used by the exception mechanism in order to verify the initialization state of a pro...
static BOOLEAN IntExceptUserIsGlobItem(char Item)
Checks if the provided char is a glob char.
int IntExceptPrintLixTaskInfo(const LIX_TASK_OBJECT *Task, char *Header, char *Line, int MaxLength, DWORD NameAlignment)
Print the information about the provided LIX_TASK_OBJECT.
Signals an execution inside SharedUserData.
The action was allowed, but it has the BETA flag (Introcore is in log-only mode). ...
static __inline BOOLEAN IntExceptUserMatchSystemProcess(EXCEPTION_VICTIM_ZONE *Victim, EXCEPTION_UM_ORIGINATOR *Originator, DWORD ExceptionFlags)
Checks if the originator is a system process; for process-creation violation this function checks if ...
WCHAR * Name
The name of the module contained in the path.
__must_check INTSTATUS IntVirtMemMap(QWORD Gva, DWORD Length, QWORD Cr3, DWORD Flags, void **HostPtr)
Maps a guest virtual memory range inside Introcore virtual address space.
INTSTATUS IntExceptUserMatchVictim(EXCEPTION_VICTIM_ZONE *Victim, EXCEPTION_UM_ORIGINATOR *Originator, void *Exception, EXCEPTION_TYPE ExceptionType)
This function checks if the exception matches the originator and the modified zone.
MM Mm
Guest memory information, such as paging mode, system Cr3 value, etc.
struct _WIN_PROCESS_OBJECT::@227 CreationInfo
static void IntExceptUserLogLinuxInformation(EXCEPTION_VICTIM_ZONE *Victim, EXCEPTION_UM_ORIGINATOR *Originator, INTRO_ACTION Action, INTRO_ACTION_REASON Reason)
Print the information about a violation (Linux guest).
QWORD EprocessAddress
This will be the address of the ActiveProcess field.
char Comm[LIX_COMM_SIZE]
The short name of the executable.
The parent of a process tried to obtain debug privileges over the child.
GUEST_STATE gGuest
The current guest state.
The modified object is inside a process.
char gExcLogLine[2 *ONE_KILOBYTE]
The exception log line.
VAD * IntWinVadFindAndUpdateIfNecessary(WIN_PROCESS_OBJECT *Process, QWORD StartHint, QWORD LengthHint)
Searches for a VAD in the Introcore VAD tree. If no VAD is found, or if the found one does not fully ...
The modified object is inside the process modules.
TIMER_FRIENDLY void IntDumpGva(QWORD Gva, DWORD Length, QWORD Cr3)
This function is a wrapper over IntDumpGvaEx (it uses RowLength = 16, ElementLength = 1...
LIST_HEAD ProcessCreationFeedbackExceptions
Linked list used for process-creation exceptions that have the feedback flag.
#define EXCEPTION_TABLE_ID(H)
PWIN_PROCESS_OBJECT IntWinProcFindObjectByEprocess(QWORD Eprocess)
Finds a process by the address of its _EPROCESS structure.
TIMER_FRIENDLY void IntDumpBuffer(void *Buffer, QWORD Gva, DWORD Length, DWORD RowLength, DWORD ElementLength, BOOLEAN LogHeader, BOOLEAN DumpAscii)
This function dumps a given buffer in a user friendly format.
LIST_HEAD UserFeedbackExceptions
Linked list used for user-mode exceptions that have the feedback flag.
The thread which created the process has started execution on some suspicious code.
Virtual SYSCALL (user-mode, Linux-only)
#define PROC_OPT_BETA
Process is monitored, but in log-only mode so no actions will be blocked.
int wstrcasecmp(const WCHAR *buf1, const WCHAR *buf2)
#define ZONE_READ
Used for read violation.
WINUM_CACHE_EXPORT * IntWinUmCacheGetExportFromRange(WIN_PROCESS_MODULE *Module, QWORD Gva, DWORD Length)
Tries to find an export in the range [Gva - Length, Gva].
DWORD MonitorVad
TRUE if we need to handle VAD events for this process.
The action was blocked because no exception signature matched.
PCHAR Names[MAX_OFFSETS_PER_NAME]
The names pointing to this RVA. Each name will point inside the Names structure inside WINUM_CACHE_EX...
void IntExceptDumpSignatures(void *Originator, EXCEPTION_VICTIM_ZONE *Victim, BOOLEAN KernelMode, BOOLEAN ReturnDrv)
Dump code blocks from the originator's RIP.
Virtual dynamic shared object (user-mode, Linux-only)
The modified object is any with the modified name.
char * utf16_for_log(const WCHAR *WString)
Converts a UTF-16 to a UTF-8 string to be used inside logging macros.
Exposes the function used to perform initialization checks on Windows processes.
LIX_TASK_OBJECT * IntLixTaskFindByGva(QWORD TaskStruct)
Finds Linux process with the provided "task_struct" guest virtual address.
#define INT_STATUS_INVALID_PARAMETER_1
#define INT_STATUS_NOT_SUPPORTED
VCPU_STATE * gVcpu
The state of the current VCPU.
The action was blocked because there was no exception for it.
The modified object is the thread which was performed an asynchronous procedure call on...
#define ZONE_PROC_THREAD_CTX
Used for the CONTEXT structure of a thread.
#define ZONE_LIB_IMPORTS
Used for the imports of a dll, driver, etc.
Structure that describes a stack trace.
The exception is valid only on 32 bit systems/process.
#define EXPORT_NAME_UNKNOWN
QWORD ShellcodeFlags
Contains the flags on the first page which was detected through shemu.
The exception is valid only for apphelp process.
INTSTATUS IntExceptGetVictimProcessCreation(void *Process, INTRO_OBJECT_TYPE ObjectType, EXCEPTION_VICTIM_ZONE *Victim)
This function is used to get the information about the victim for process-creation violation...
#define ZONE_MODULE_LOAD
Used for exceptions for double agent.
Measures glob-match exceptions.
#define ZONE_WRITE
Used for write violation.
#define INT_STATUS_INVALID_PARAMETER_2
The exception is valid only once.
LIST_HEAD NoNameUserExceptions
Linked list used for user-mode exceptions that don't have a valid originator (-). ...
INTSTATUS IntWinStackTraceGetUser(PIG_ARCH_REGS Registers, PWIN_PROCESS_OBJECT Process, DWORD MaxNumberOfTraces, STACK_TRACE *StackTrace)
Get the user stack trace of a windows process.
The process object creates another process using DPI flags.
The object that has a NX zone is executed.
#define INT_STATUS_EXCEPTION_ALLOW
This structure describes a running process inside the guest.
The exception (and signature, where's the case) matched, but the extra checks failed.
#define INT_STATUS_INVALID_PARAMETER_3