44 ERROR(
"[ERROR] IntGuestPreReturnCallback failed: 0x%08x\n", status);
82 _In_ void *GuestHandle,
117 if (GuestHandle == NULL)
126 WARNING(
"[WARNING] Introspection is already active, ignoring activation request\n");
128 goto release_and_exit;
133 TRACE(
"[INTRO-INIT] New guest notification, handle = %p\n",
gIntHandle);
135 LOG(
"[INTRO-INIT] Will use options: 0x%016llx\n", Options);
139 TRACE(
"[INTRO-INIT] INTRO_OPT_ENABLE_KM_BETA_DETECTIONS flag set, everything will be allowed in KM.\n");
147 ERROR(
"[ERROR] IntCamiSetUpdateBuffer failed: 0x%08x\n", status);
151 goto release_and_exit;
157 ERROR(
"[ERROR] Failed initializing guest state: 0x%08x\n", status);
158 goto release_and_exit;
177 _In_ void *GuestHandle,
207 goto resume_and_exit;
215 ERROR(
"[ERROR] IntGetGprs failed: 0x%08x\n", status);
216 goto resume_and_exit;
232 _In_ void *GuestHandle,
292 ERROR(
"[ERROR] Invalid power state: %d\n", PowerState);
300 _In_ void *GuestHandle,
317 if (NULL == GuestHandle)
322 if (NULL == FullPath)
331 ERROR(
"[ERROR] Introspection is not initialized!\n");
333 goto release_and_exit;
339 goto release_and_exit;
346 WARNING(
"[WARNING] The uninit has been called, cannot modify the protected process list!\n");
348 goto release_and_exit;
357 len = strlen(FullPath);
362 goto resume_and_exit;
370 goto resume_and_exit;
374 for (i = 0; i < len; i++)
376 wPath[i] = (
WCHAR)FullPath[i];
386 ERROR(
"[ERROR] IntWinProcAddProtectedProcess failed: 0x%08x\n", status);
394 ERROR(
"[ERROR] IntWinProcRemoveProtectedProcess failed: 0x%08x\n", status);
407 ERROR(
"[ERROR] IntLixTaskAddProtected failed: 0x%08x\n", status);
415 ERROR(
"[ERROR] IntLixTaskRemoveProtected failed: 0x%08x\n", status);
436 _In_ void *GuestHandle,
452 if (NULL == GuestHandle)
457 if (NULL == FullPath)
466 ERROR(
"[ERROR] Introspection is not initialized!\n");
468 goto release_and_exit;
474 goto release_and_exit;
481 ERROR(
"[ERROR] The uninit has been called, cannot modify the protected process list!\n");
483 goto release_and_exit;
495 ERROR(
"[ERROR] IntWinProcAddProtectedProcess failed: 0x%08x\n", status);
503 ERROR(
"[ERROR] IntWinProcRemoveProtectedProcess failed: 0x%08x\n", status);
523 _In_ void *GuestHandle
535 if (NULL == GuestHandle)
544 ERROR(
"[ERROR] Introspection is not initialized!\n");
546 goto release_and_exit;
552 goto release_and_exit;
559 ERROR(
"[ERROR] The uninit has been called, cannot modify the protected process list!\n");
561 goto release_and_exit;
569 ERROR(
"[ERROR] IntWinProcRemoveAllProtectedProcesses failed: 0x%08x\n", status);
586 _In_ void *GuestHandle,
610 goto release_and_exit;
615 ERROR(
"[ERROR] Agent injection called when guest has bugcheck in progress!\n");
617 goto release_and_exit;
622 WARNING(
"[WARNING] Agent %s will not be deployed as the guest is NOT initialized!\n", Name);
624 goto cleanup_and_exit;
629 WARNING(
"[WARNING] The uninit has been called, cannot inject agents anymore!\n");
631 goto cleanup_and_exit;
642 WARNING(
"[WARNING] Requested to inject agents but INTRO_OPT_AGENT_INJECTION is not set!\n");
659 _In_ void *GuestHandle,
680 ERROR(
"[ERROR] Introspection is not initialized!\n");
682 goto release_and_exit;
688 goto release_and_exit;
693 ERROR(
"[ERROR] Agent injection called when guest has bugcheck in progress!\n");
695 goto release_and_exit;
702 ERROR(
"[ERROR] The uninit has been called, cannot inject agents anymore!\n");
704 goto cleanup_and_exit;
713 WARNING(
"[WARNING] Requested to inject a file but INTRO_OPT_AGENT_INJECTION is not set!\n");
730 _In_ void *GuestHandle,
745 if (NULL == GuestHandle)
759 ERROR(
"[ERROR] Introspection is not initialized!\n");
761 goto release_and_exit;
767 goto release_and_exit;
777 ERROR(
"[ERROR] IntGetGprs failed: 0x%08x\n", status);
778 goto cleanup_and_exit;
786 ERROR(
"[ERROR] IntDecDecodeInstructionAtRipWithCache failed: 0x%08x\n", status);
787 goto cleanup_and_exit;
792 *Length = instrux.Length;
807 _In_ void *GuestHandle,
822 if (NULL == GuestHandle)
827 if (NULL == Mnemonic)
836 ERROR(
"[ERROR] Introspection is not initialized!\n");
838 goto release_and_exit;
844 goto release_and_exit;
852 ERROR(
"[ERROR] IntGetGprs failed: 0x%08x\n", status);
853 goto cleanup_and_exit;
861 ERROR(
"[ERROR] IntDecDecodeInstructionAtRipWithCache failed: 0x%08x\n", status);
862 goto cleanup_and_exit;
867 strlcpy(Mnemonic, instrux.Mnemonic, ND_MAX_MNEMONIC_LENGTH);
882 _In_ void *GuestHandle,
896 if (NULL == GuestHandle)
901 if (NULL == Callback)
911 goto release_and_exit;
919 ERROR(
"[ERROR] IntIterateVirtualAddressSpace failed: 0x%x\n", status);
931 _In_ void *GuestHandle,
944 if (NULL == GuestHandle)
949 if (NULL == GuestInfo)
959 goto release_and_exit;
965 goto release_and_exit;
981 _In_ void *GuestHandle,
994 if (NULL == GuestHandle)
1003 ERROR(
"[ERROR] Introspection is not initialized!\n");
1005 goto release_and_exit;
1011 goto release_and_exit;
1027 _In_ void *GuestHandle
1039 if (NULL == GuestHandle)
1048 ERROR(
"[ERROR] Introspection is not initialized!\n");
1050 goto release_and_exit;
1056 goto release_and_exit;
1062 goto release_and_exit;
1078 _In_ void *GuestHandle,
1091 if (NULL == GuestHandle)
1096 if (NULL == IntroOptions)
1105 ERROR(
"[ERROR] Introspection is not initialized!\n");
1107 goto release_and_exit;
1113 goto release_and_exit;
1129 _In_ void *GuestHandle,
1146 if (NULL == GuestHandle)
1155 ERROR(
"[ERROR] Introspection is not initialized!\n");
1157 goto release_and_exit;
1163 goto release_and_exit;
1168 ERROR(
"[ERROR] The uninit has been called, won't load the update buffer!\n");
1170 goto release_and_exit;
1181 ERROR(
"[ERROR] IntCamiSetUpdateBuffer failed: %08x\n", status);
1182 goto release_and_exit;
1199 ERROR(
"[ERROR] IntCamiLoadSection failed: %08x\n", status);
1200 goto release_and_exit;
1213 _In_ void *GuestHandle,
1228 if (NULL == GuestHandle)
1237 ERROR(
"[ERROR] Introspection is not initialized!\n");
1239 goto release_and_exit;
1245 goto release_and_exit;
1261 _In_ void *GuestHandle,
1285 if (NULL == GuestHandle)
1304 _In_ void *GuestHandle,
1320 if (NULL == GuestHandle)
1329 ERROR(
"[ERROR] Introspection is not initialized!\n");
1331 goto release_and_exit;
1337 goto release_and_exit;
1353 _In_ void *GuestHandle,
1369 if (NULL == GuestHandle)
1381 ERROR(
"[ERROR] Introspection is not initialized!\n");
1383 goto release_and_exit;
1389 goto release_and_exit;
1403 _In_ void *GuestHandle,
1404 _In_ const void *Event,
1420 if (NULL == GuestHandle)
1429 ERROR(
"[ERROR] Introspection is not initialized!\n");
1431 goto release_and_exit;
1437 goto release_and_exit;
1453 _In_ void *GuestHandle,
1467 if (NULL == GuestHandle)
1476 ERROR(
"[ERROR] Introspection is not initialized!\n");
1478 goto release_and_exit;
1484 goto release_and_exit;
1500 _In_ void *GuestHandle
1513 if (NULL == GuestHandle)
1522 ERROR(
"[ERROR] Introspection is not initialized!\n");
1524 goto release_and_exit;
1530 goto release_and_exit;
1546 _In_ void *GuestHandle,
1572 _In_ void *GuestHandle,
1583 if (NULL == GuestHandle)
1615 if (NULL == FullString)
1620 if (NULL == VersionString)
1629 WARNING(
"[WARNING] Introspection is not initialized!\n");
1631 goto release_and_exit;
1637 goto release_and_exit;
1646 WARNING(
"[WARNING] The uninit has been called, cannot send version strings!\n");
1648 goto release_and_exit;
1656 LOG(
"[ERROR] Could not get Linux version string: 0x%08x\n", status);
1664 LOG(
"[ERROR] Could not get Windows version string: 0x%08x\n", status);
#define INT_STATUS_PAGE_NOT_PRESENT
Indicates that a virtual address is not present.
#define DEC_OPT_NO_CACHE
Flag used to hint the instruction decoder to not use the instruction cache.
void IntCamiClearUpdateBuffer(void)
Uninitialize the update buffer and notify the integrator that we don't need it anymore.
void * gLock
A lock that ensures that all the events are serialized inside introcore.
INTSTATUS IntUpdateSupport(void *GuestHandle, PBYTE Buffer, DWORD Length)
Loads a new CAMI version.
INTSTATUS IntGetVersionStringLinux(DWORD FullStringSize, DWORD VersionStringSize, CHAR *FullString, CHAR *VersionString)
Gets the version string for a Linux guest.
#define INTRO_OPT_AGENT_INJECTION
Enable agent injections.
IG_ARCH_REGS Regs
The current state of the guest registers.
INTSTATUS IntGuestDisableIntro(QWORD Flags)
Disables and unloads the introspection engine.
#define INT_STATUS_SUCCESS
INTSTATUS IntWinProcRemoveAllProtectedProcesses(void)
This function removed all the processes from the protected process list.
INTSTATUS IntGetGprs(DWORD CpuNumber, PIG_ARCH_REGS Regs)
Get the current guest GPR state.
INTSTATUS IntModifyDynamicOptions(void *GuestHandle, QWORD NewOptions)
Modifies the introcore options.
INTSTATUS IntGetExceptionsVersion(void *GuestHandle, WORD *MajorVersion, WORD *MinorVersion, DWORD *BuildNumber)
Get the current exceptions version.See PFUNC_IntGetExceptionsVersion for details. ...
INTSTATUS IntAbortEnableIntro(void *GuestHandle, BOOLEAN Abort)
Abort the introcore loading process.
void IntSpinLockRelease(void *SpinLock)
INTSTATUS(* PFUNC_VirtualAddressSpaceCallback)(QWORD Cr3, QWORD VirtualAddress, QWORD Entry, QWORD PageSize)
The type of callback invoked by PFUNC_IntIterateVaSpace while iterating the guest virtual address spa...
DWORD IntGetCurrentCpu(void)
Returns the current CPU number.
BOOLEAN Initialized
True if this structure was initialized and can be used.
BOOLEAN ShutDown
True if the system process protection is in beta (log-only) mode.
#define INT_SUCCESS(Status)
enum _IG_GUEST_POWER_STATE IG_GUEST_POWER_STATE
The guest power state.
INTSTATUS IntResumeVcpus(void)
Resumes the VCPUs previously paused with IntPauseVcpus.
INTSTATUS IntUpdateLoadExceptions(void *Buffer, DWORD Length, DWORD Flags)
Handles the exceptions coming from the integrator.
INTSTATUS IntDepInjectFile(BYTE *FileContent, DWORD FileSize, const CHAR *Name)
Inject a file inside the guest.
INTSTATUS IntNewGuestNotification(void *GuestHandle, QWORD Options, PBYTE UpdateBuffer, DWORD BufferLength)
Handles a new guest. It is essentially the Introcore entry point.
IG_LOG_LEVEL gLogLevel
The currently used log level.
BOOLEAN SafeToApplyOptions
True if the current options can be changed dynamically.
INTSTATUS IntAddExceptionFromAlert(void *GuestHandle, const void *Event, INTRO_EVENT_TYPE Type, BOOLEAN Exception, QWORD Context)
Adds an exception for an alert reported by introcore.See PFUNC_IntAddExceptionFromAlert for details...
void IntGuestPrepareUninit(void)
Prepares introcore to be unloaded.
#define INT_STATUS_NOT_NEEDED_HINT
Section will contain linux related information.
#define HpAllocWithTag(Len, Tag)
int INTSTATUS
The status data type.
INTSTATUS IntSetLogLevel(void *GuestHandle, IG_LOG_LEVEL LogLevel)
Sets the log level.
QWORD gEventId
The ID of the current event.
INTSTATUS IntCamiGetVersion(DWORD *MajorVersion, DWORD *MinorVersion, DWORD *BuildNumber)
Get the version of the loaded CAMI support file.
PVCPU_STATE VcpuArray
Array of the VCPUs assigned to this guest. The index in this array matches the VCPU number...
INTSTATUS IntProcessDebugCommand(void *GuestHandle, DWORD CpuNumber, DWORD Argc, CHAR *Argv[])
Executes a debugger command.
INTSTATUS IntRemoveAllProtectedProcesses(void *GuestHandle)
Removes the protection policies for all processes.
INTSTATUS IntPauseVcpus(void)
Pauses all the guest VCPUs.
INTSTATUS IntIterateVaSpace(void *GuestHandle, QWORD Cr3, PFUNC_VirtualAddressSpaceCallback Callback)
Iterates over the guest virtual address space.
INTRO_GUEST_TYPE OSType
The type of the guest.
Commit all the memory hooks.
#define INT_STATUS_OPERATION_NOT_IMPLEMENTED
void * gIntHandle
The guest handle provided by the integrator at initialization.
INTSTATUS IntAddRemoveProtectedProcessUtf8(void *GuestHandle, const CHAR *FullPath, DWORD ProtectionMask, BOOLEAN Add, QWORD Context)
Toggles protection options for a process.
INTSTATUS IntIterateVirtualAddressSpace(QWORD Cr3, PFUNC_VirtualAddressSpaceCallback Callback)
Iterate an entire virtual address space.
INTSTATUS IntFlushGpaCache(void *GuestHandle)
Flushed the introcore GPA cache.
INTSTATUS IntCamiSetUpdateBuffer(const BYTE *UpdateBuffer, DWORD BufferLength)
Initialize the update buffer with the one from the integrator.
void IntVeHandleGuestResumeFromSleep(void)
Simply set the VeAgentWaiting variable to true if VE is enabled.
BOOLEAN gAbortLoad
Set to True if introcore should abort the initialization process.
INTSTATUS IntGpaCacheFlush(PGPA_CACHE Cache)
Flush the entire GPA cache.
INTSTATUS IntGetCurrentInstructionLength(void *GuestHandle, DWORD CpuNumber, BYTE *Length)
Returns the length of the instruction at which the current guest RIP points.
The guest is shutting down by force.
The guest is resuming from hibernate or sleep.
INTSTATUS IntUpdateExceptions(void *GuestHandle, PBYTE Buffer, DWORD Length, DWORD Flags)
Loads a new exceptions version.See PFUNC_IntUpdateExceptions for details.
INTSTATUS IntGetCurrentInstructionMnemonic(void *GuestHandle, DWORD CpuNumber, CHAR *Mnemonic)
Returns the mnemonic of the instruction at which the current guest RIP points.
INTSTATUS IntWinGetVersionString(DWORD FullStringSize, DWORD VersionStringSize, CHAR *FullString, CHAR *VersionString)
Gets the version string for a Windows guest.
INTSTATUS IntRemoveException(void *GuestHandle, QWORD Context)
Removes a custom exception added with GLUE_IFACE.AddExceptionFromAlert.See PFUNC_IntRemoveException f...
#define INT_STATUS_NOT_INITIALIZED
INTSTATUS IntGuestPreReturnCallback(DWORD Options)
Handles all the operations that must be done before returning from a VMEXIT event handler...
#define IG_CURRENT_VCPU
For APIs that take a VCPU number as a parameter, this can be used to specify that the current VCPU sh...
INTSTATUS IntWinProcAddProtectedProcess(const WCHAR *Path, DWORD ProtectionMask, QWORD Context)
This function adds the provided process to the protected process list.
INTSTATUS IntDisableIntro(void *GuestHandle, QWORD Flags)
Disables and unloads the introspection engine.
QWORD Current
The currently used options.
Section will contain protection flags.
INTSTATUS IntFlushAlertExceptions(void *GuestHandle)
Removes all the custom exceptions added with GLUE_IFACE.AddExceptionFromAlert.See PFUNC_IntFlushAlert...
INTSTATUS IntLixTaskAddProtected(const char *ProcessName, QWORD ProtectionMask, QWORD Context)
Adds a protected process name pattern.
void * GpaCache
The currently used GPA cache.
#define INT_STATUS_INVALID_PARAMETER_4
BOOLEAN GuestInitialized
True if the OS-specific portion has been initialized.
INTSTATUS IntDepInjectProcess(DWORD AgentTag, BYTE *AgentContent, DWORD AgentSize, const CHAR *Name, const CHAR *Args)
Injects a process inside the guest.
#define HpFreeAndNullWithTag(Add, Tag)
INTSTATUS IntGetCurrentIntroOptions(void *GuestHandle, QWORD *IntroOptions)
Get the currently used introcore options.
INTSTATUS IntDbgProcessCommand(DWORD Argc, const char *Argv[])
INTSTATUS IntGetSupportVersion(void *GuestHandle, DWORD *MajorVersion, DWORD *MinorVersion, DWORD *BuildNumber)
Get the current version of CAMI.
size_t strlcpy(char *dst, const char *src, size_t dest_size)
#define INT_STATUS_ALREADY_INITIALIZED_HINT
#define INT_STATUS_UNINIT_BUGCHECK
Indicates that the guest crashed and Introcore must be deactivated.
INTSTATUS IntLixTaskRemoveProtected(const char *ProcessName)
Removes a pattern of processes to be protected.
The guest is entering sleep.
void IntSpinLockAcquire(void *SpinLock)
#define UNREFERENCED_PARAMETER(P)
void * InstructionCache
The currently used instructions cache.
void IntGuestUninit(void)
Completely unloads the introspection engine.
static void IntApiEnter(DWORD CpuNumber)
Common API handler.
#define _In_reads_bytes_(expr)
BOOLEAN EnterHibernate
True if the guest is entering into hibernate.
#define IntDbgEnterDebugger()
void IntPtiHandleGuestResumeFromSleep(void)
Sets PtFilterWaiting to true if PT filtering was enabled, or to false otherwise.
GUEST_STATE gGuest
The current guest state.
enum _IG_LOG_LEVEL IG_LOG_LEVEL
Controls the verbosity of the logs.
INTSTATUS IntInjectProcessAgentInGuest(void *GuestHandle, DWORD AgentTag, PBYTE AgentContent, DWORD AgentSize, const CHAR *Name, const CHAR *Args)
Requests a process agent injection inside the guest.
Section will contain windows related information.
#define INT_STATUS_NO_MAPPING_STRUCTURES
Indicates that not all mapping structures of a virtual address are present.
INTSTATUS IntUpdateFlushAlertExceptions(void)
This function removes all exceptions that were added from alerts.
INTSTATUS IntNotifyGuestPowerStateChange(void *GuestHandle, IG_GUEST_POWER_STATE PowerState)
Handles guest power state transitions.
INTSTATUS IntGetVersionString(DWORD FullStringSize, DWORD VersionStringSize, CHAR *FullString, CHAR *VersionString)
Get the version string information for the current guest.
The guest is shutting down.
INTSTATUS IntInjectFileAgentInGuest(void *GuestHandle, PBYTE AgentContent, DWORD AgentSize, const CHAR *Name)
Drops a file on the guest hard disk.
#define INT_STATUS_INVALID_PARAMETER_1
#define INT_STATUS_NOT_SUPPORTED
VCPU_STATE * gVcpu
The state of the current VCPU.
INTSTATUS IntNotifyIntroErrorState(INTRO_ERROR_STATE State, INTRO_ERROR_CONTEXT *Context)
enum _INTRO_EVENT_TYPE INTRO_EVENT_TYPE
Event classes.
void IntGuestUpdateCoreOptions(QWORD NewOptions)
Updates Introcore options.
INTSTATUS IntDecDecodeInstructionAtRipWithCache(void *Cache, DWORD CpuNumber, PIG_ARCH_REGS Registers, PINSTRUX Instrux, DWORD Options, BOOLEAN *CacheHit, BOOLEAN *Added)
Decode an instruction using the cache.
INTSTATUS IntUpdateGetVersion(WORD *MajorVersion, WORD *MinorVersion, DWORD *BuildNumber)
Get the version of the loaded exceptions binary file.
#define INT_STATUS_POWER_STATE_BLOCK
BOOLEAN BugCheckInProgress
The version of the provided CAMI file is not supported.
INTSTATUS IntGuestGetInfo(PGUEST_INFO GuestInfo)
Get basic information about the guest.
INTSTATUS IntUpdateAddExceptionFromAlert(const void *Event, INTRO_EVENT_TYPE Type, BOOLEAN Exception, QWORD Context)
Handles all types of supported exceptions that can be added from alerts.
#define INTRO_OPT_ENABLE_KM_BETA_DETECTIONS
Aggregates all the kernel log-only detection flags.
#define INT_STATUS_INVALID_PARAMETER_2
INTRO_PROT_OPTIONS CoreOptions
The activation and protection options for this guest.
INTSTATUS IntGetGuestInfo(void *GuestHandle, GUEST_INFO *GuestInfo)
Get a description of the introspected guest.
INTSTATUS IntWinProcRemoveProtectedProcess(const WCHAR *Path)
This function removed the provided process from the protected process list.
INTSTATUS IntUpdateRemoveException(QWORD Context)
This function removes an exception for a given context.
INTSTATUS IntAddRemoveProtectedProcessUtf16(void *GuestHandle, const WCHAR *FullPath, DWORD ProtectionMask, BOOLEAN Add, QWORD Context)
Toggles protection options for a process.
Inject pending page faults.
INTSTATUS IntCamiLoadSection(DWORD CamiSectionHint)
Load CAMI objects from section with given hint.
static void IntApiLeave(BOOLEAN Async)
Handles API exists.
INTSTATUS IntGuestInit(QWORD Options)
Initialize the given guest state.
#define INT_STATUS_INSUFFICIENT_RESOURCES
#define INT_STATUS_INVALID_PARAMETER_3