Bitdefender Hypervisor Memory Introspection
alert_exceptions.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020 Bitdefender
3  * SPDX-License-Identifier: Apache-2.0
4  */
9 
10 #ifndef _ALERT_EXCEPTIONS_H_
11 #define _ALERT_EXCEPTIONS_H_
12 
13 #include "exceptions.h"
14 
15 #pragma pack(push, 1)
16 
17 #define ALERT_HASH_COUNT 6u
18 
19 #define ALERT_CB_SIGNATURE_VERSION 1
20 
21 
22 typedef struct _ALERT_CB_SIGNATURE
23 {
25 
27 
32 
35 
36 
37 #define ALERT_IDT_SIGNATURE_VERSION 1
38 
42 typedef struct _ALERT_IDT_SIGNATURE
43 {
45 
47 
52 
53 
54 #define ALERT_EXPORT_SIGNATURE_VERSION 1
55 
57 {
59 
61 
64 
71 
72 
73 #define ALERT_PROCESS_CREATION_SIGNATURE_VERSION 1
74 
79 {
81 
83 
85 
89 
90 
91 #define ALERT_KM_EXCEPTION_VERSION 1
92 
96 typedef struct _ALERT_KM_EXCEPTION
97 {
99 
102 
104 
106 
110 
111 
112 #define ALERT_KUM_EXCEPTION_VERSION 1
113 
117 typedef struct _ALERT_KUM_EXCEPTION
118 {
120 
124 
126 
128 
131 
133  "The ALERT_KM_EXCEPTION structure exceeds ALERT_EXCEPTION_SIZE, possible buffer overflow!");
134 
135 #define ALERT_UM_EXCEPTION_VERSION 1
136 
140 typedef struct _ALERT_UM_EXCEPTION
141 {
143 
147 
149 
151 
156 
158  "The ALERT_UM_EXCEPTION structure exceeds ALERT_EXCEPTION_SIZE, possible buffer overflow!");
159 
160 #pragma pack(pop)
161 
162 
163 INTSTATUS
165  _In_ const void *Event,
166  _In_ INTRO_EVENT_TYPE Type,
167  _In_ BOOLEAN LogErrors,
168  _Inout_ void *Exception
169  );
170 
171 INTSTATUS
173  _Inout_ void *Event,
175  );
176 
180  )
181 {
182  // Whenever a new violation is created, one must add here the violation type
183  // in order to check when adding an exception from alert.
184  return !(introEventEptViolation != Type &&
185  introEventMsrViolation != Type &&
186  introEventCrViolation != Type &&
187  introEventDtrViolation != Type &&
192 }
193 
194 #endif // _ALERT_EXCEPTIONS_H_
STATIC_ASSERT(sizeof(ALERT_KM_EXCEPTION)<=ALERT_EXCEPTION_SIZE, "The ALERT_KM_EXCEPTION structure exceeds ALERT_EXCEPTION_SIZE, possible buffer overflow!")
BOOLEAN Valid
True if the alert-signature is valid, otherwise false.
_Bool BOOLEAN
Definition: intro_types.h:58
Sent for unauthorized process creation alerts. See EVENT_PROCESS_CREATION_VIOLATION.
Definition: intro_types.h:115
UM_EXCEPTION_OBJECT Type
The type of the exception; any type from _UM_EXCEPTION_OBJECT.
uint8_t BYTE
Definition: intro_types.h:47
#define _In_
Definition: intro_sal.h:21
KM_EXCEPTION_OBJECT Type
The type of the exception; any type from _KM_EXCEPTION_OBJECT.
DWORD Flags
Contains any flags from _SIGNATURE_FLG.
ALERT_IDT_SIGNATURE Idt
The idt alert-signature, if any.
INTRO_ALERT_EXCEPTION_HEADER Header
The header used by alert-signature.
uint16_t WORD
Definition: intro_types.h:48
Describes a kernel-mode alert-exception.
Sent when a DTR violation triggers an alert. See EVENT_DTR_VIOLATION.
Definition: intro_types.h:98
ALERT_CB_SIGNATURE CodeBlocks
The code-blocks alert-signature, if any.
BYTE WriteSize
The number of bytes that are modified.
struct _ALERT_KM_EXCEPTION ALERT_KM_EXCEPTION
Describes a kernel-mode alert-exception.
Sent when a CR violation triggers an alert. See EVENT_CR_VIOLATION.
Definition: intro_types.h:88
BOOLEAN Valid
True if the alert-signature is valid, otherwise false.
enum _UM_EXCEPTION_OBJECT UM_EXCEPTION_OBJECT
Object type of the user-mode exception.
WORD Delta
The number of modified bytes that will be excepted.
INTRO_ALERT_EXCEPTION_HEADER Header
The header used by alert-signature.
BOOLEAN IntAlertIsEventTypeViolation(INTRO_EVENT_TYPE Type)
int INTSTATUS
The status data type.
Definition: introstatus.h:24
enum _KM_EXCEPTION_OBJECT KM_EXCEPTION_OBJECT
Object type of the kernel-mode exception.
ALERT_EXPORT_SIGNATURE Export
The export alert-signature, if any.
Sent for code/data injection alerts. See EVENT_MEMCOPY_VIOLATION.
Definition: intro_types.h:96
INTSTATUS IntAlertCreateExceptionInEvent(void *Event, INTRO_EVENT_TYPE Type)
This function creates an alert-exception for each alert sent to the integrator.
DWORD Process
The name-hash of the process in which the modification takes place.
DWORD Flags
The flags of the exception; any flags from _EXCEPTION_FLG.
DWORD Flags
The flags of the exception; any flags from _EXCEPTION_FLG.
Describes a user-mode alert-exception.
DWORD Flags
Contains any flags from _SIGNATURE_FLG.
DWORD Originator
The name-hash of the originator.
#define _Inout_
Definition: intro_sal.h:20
Describe a process-creation alert-signature.
DWORD Originator
The name-hash of the originator.
INTRO_ALERT_EXCEPTION_HEADER Header
The header used by alert-signature.
DWORD Library
The name-hash of the modified library.
The common header used by exception information.
Definition: intro_types.h:1172
Describes an idt alert-signature.
Describes a kernel-mode alert-exception.
INTRO_ALERT_EXCEPTION_HEADER Header
The header used by alert-exception.
DWORD Flags
The flags of the exception; any flags from _EXCEPTION_FLG.
Sent for suspicious module loads alerts. See EVENT_MODULE_LOAD_VIOLATION.
Definition: intro_types.h:117
DWORD CreateMask
The deep-process-inspection creation bit-mask.
DWORD Function
The name-hash of the modified function.
struct _ALERT_CB_SIGNATURE ALERT_CB_SIGNATURE
Sent when an EPT violation triggers an alert. See EVENT_EPT_VIOLATION.
Definition: intro_types.h:84
BYTE Count
The number of the code-blocks.
INTSTATUS IntAlertCreateException(const void *Event, INTRO_EVENT_TYPE Type, BOOLEAN LogErrors, void *Exception)
This function will dispatch the exception creation to the appropriate function, depending on the even...
#define __forceinline
Definition: introtypes.h:61
uint32_t DWORD
Definition: intro_types.h:49
struct _ALERT_UM_EXCEPTION ALERT_UM_EXCEPTION
Describes a user-mode alert-exception.
INTRO_ALERT_EXCEPTION_HEADER Header
The header used by alert-exception.
struct _ALERT_IDT_SIGNATURE ALERT_IDT_SIGNATURE
Describes an idt alert-signature.
#define ALERT_HASH_COUNT
BYTE Score
The number of (minimum) hashes from a list that need to match.
DWORD Flags
Contains any flags from _SIGNATURE_FLG.
INTRO_ALERT_EXCEPTION_HEADER Header
The header used by alert-exception.
BOOLEAN Valid
True if the alert-signature is valid, otherwise false.
#define ALERT_EXCEPTION_SIZE
Definition: intro_types.h:707
ALERT_PROCESS_CREATION_SIGNATURE ProcessCreation
The process-creation alert-signature, if any.
KUM_EXCEPTION_OBJECT Type
The type of the exception; any type from _KUM_EXCEPTION_OBJECT.
DWORD Victim
The name-hash of the victim.
DWORD Process
The name-hash of the process.
DWORD Victim
The name-hash of the victim.
DWORD Victim
The name-hash of the victim.
struct _ALERT_EXPORT_SIGNATURE ALERT_EXPORT_SIGNATURE
enum _INTRO_EVENT_TYPE INTRO_EVENT_TYPE
Event classes.
Sent for integrity violation alerts. See EVENT_INTEGRITY_VIOLATION.
Definition: intro_types.h:92
DWORD CodeBlocks[ALERT_HASH_COUNT]
An array that contains the code-blocks.
struct _ALERT_KUM_EXCEPTION ALERT_KUM_EXCEPTION
Describes a kernel-mode alert-exception.
enum _KUM_EXCEPTION_OBJECT KUM_EXCEPTION_OBJECT
Object type of the kernel-user mode exception.
Sent when a MSR violation triggers an alert.See EVENT_MSR_VIOLATION.
Definition: intro_types.h:86
ALERT_CB_SIGNATURE CodeBlocks
The code-blocks alert-signature, if any.
BOOLEAN Valid
True if the alert-signature is valid, otherwise false.
INTRO_ALERT_EXCEPTION_HEADER Header
The header used by alert-signature.
ALERT_CB_SIGNATURE CodeBlocks
The code-blocks alert-signature, if any.
DWORD Flags
Contains any flags from _SIGNATURE_FLG.
struct _ALERT_PROCESS_CREATION_SIGNATURE ALERT_PROCESS_CREATION_SIGNATURE
Describe a process-creation alert-signature.
BYTE Entry
The number of the IDT entry.
DWORD Originator
The name-hash of the originator.