├── Imgs
├── Tracer.gif
├── readme.jpg
├── custom-qemu-1.jpg
├── custom-qemu-2.jpg
├── custom-qemu-3.PNG
└── custom-qemu-4.png
├── Message Tracing
├── exe
│ ├── event.vcxproj.user
│ ├── event.vcxproj.Filters
│ ├── event.vcxproj
│ ├── eventtest.c
│ └── install.c
├── wdm
│ ├── event.rc
│ ├── RCa02068
│ ├── public.h
│ ├── event.h
│ ├── event.vcxproj.Filters
│ ├── event.vcxproj
│ └── event.c
├── eventsample.sln
└── README.md
├── ObRegisterCallbacks
├── ObRegisterCallbacks
│ ├── ObRegisterCallbacks.vcxproj.user
│ ├── ObRegisterCallbacks.vcxproj.filters
│ ├── Driver.h
│ ├── Driver.c
│ ├── ObRegisterCallbacks.inf
│ ├── Handlers.c
│ └── ObRegisterCallbacks.vcxproj
└── ObRegisterCallbacks.sln
├── HypervisorBypassWithNMI
├── README.md
├── HypervisorBypassWithNMI
│ ├── Driver.c
│ ├── HypervisorBypassWithNMI.vcxproj.filters
│ ├── ReadMe.txt
│ ├── HypervisorBypass.c
│ ├── HypervisorBypassWithNMI.inf
│ ├── HypervisorBypass.h
│ ├── Queue.c
│ └── HypervisorBypassWithNMI.vcxproj
└── HypervisorBypassWithNMI.sln
├── TypeInfoCallbacksHooker
├── Driver.h
├── Header.h
├── TypeInfoCallbacksHooker.vcxproj.filters
├── TypeInfoCallbacksHooker.inf
├── TypeInfoCallbacksHooker.vcxproj
└── Driver.c
├── README.md
├── TypeInfoCallbacksHooker.sln
├── custom-qemu-for-instrumentation
└── readme.md
└── .gitignore
/Imgs/Tracer.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SinaKarvandi/Misc/HEAD/Imgs/Tracer.gif
--------------------------------------------------------------------------------
/Imgs/readme.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SinaKarvandi/Misc/HEAD/Imgs/readme.jpg
--------------------------------------------------------------------------------
/Imgs/custom-qemu-1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SinaKarvandi/Misc/HEAD/Imgs/custom-qemu-1.jpg
--------------------------------------------------------------------------------
/Imgs/custom-qemu-2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SinaKarvandi/Misc/HEAD/Imgs/custom-qemu-2.jpg
--------------------------------------------------------------------------------
/Imgs/custom-qemu-3.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SinaKarvandi/Misc/HEAD/Imgs/custom-qemu-3.PNG
--------------------------------------------------------------------------------
/Imgs/custom-qemu-4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SinaKarvandi/Misc/HEAD/Imgs/custom-qemu-4.png
--------------------------------------------------------------------------------
/Message Tracing/exe/event.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/ObRegisterCallbacks/ObRegisterCallbacks/ObRegisterCallbacks.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Message Tracing/wdm/event.rc:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include
4 |
5 | #define VER_FILETYPE VFT_DRV
6 | #define VER_FILESUBTYPE VFT2_DRV_SYSTEM
7 | #define VER_FILEDESCRIPTION_STR "Sample Event Driver"
8 | #define VER_INTERNALNAME_STR "event.sys"
9 |
10 | #include "common.ver"
11 |
12 |
--------------------------------------------------------------------------------
/HypervisorBypassWithNMI/README.md:
--------------------------------------------------------------------------------
1 | This file contains a possible bypass to Hypervisors that virtualize an already running system using NMI.
2 |
3 | The POC is derived from : https://www.unknowncheats.me/forum/c-and-c-/390593-vm-escape-via-nmi.html#post2772568
4 |
5 | When you're in VMX Root, an attacker can send an NMI and that NMI will be serviced in VMX ROOT. If you use a same IDT for vmx root and vmx non root then you probably have this problem.
6 |
--------------------------------------------------------------------------------
/HypervisorBypassWithNMI/HypervisorBypassWithNMI/Driver.c:
--------------------------------------------------------------------------------
1 |
2 |
3 | #include
4 |
5 | BOOLEAN LoadNmiCallback();
6 |
7 | VOID DrvUnload(PDRIVER_OBJECT DriverObject) { return STATUS_SUCCESS; }
8 | NTSTATUS
9 | DriverEntry(_In_ PDRIVER_OBJECT DriverObject,
10 | _In_ PUNICODE_STRING RegistryPath) {
11 | NTSTATUS status = STATUS_SUCCESS;
12 |
13 | DriverObject->DriverUnload = DrvUnload;
14 |
15 |
16 | //
17 | // Test in kernel
18 | //
19 | LoadNmiCallback();
20 |
21 | return status;
22 | }
23 |
--------------------------------------------------------------------------------
/TypeInfoCallbacksHooker/Driver.h:
--------------------------------------------------------------------------------
1 | /*++
2 |
3 | Module Name:
4 |
5 | driver.h
6 |
7 | Abstract:
8 |
9 | This file contains the driver definitions.
10 |
11 | Environment:
12 |
13 | Kernel-mode Driver Framework
14 |
15 | --*/
16 |
17 | #include
18 | #include
19 | #include
20 |
21 |
22 |
23 | EXTERN_C_START
24 |
25 | //
26 | // WDFDRIVER Events
27 | //
28 |
29 | DRIVER_INITIALIZE DriverEntry;
30 | EVT_WDF_DRIVER_DEVICE_ADD TypeInfoCallbacksHookerEvtDeviceAdd;
31 | EVT_WDF_OBJECT_CONTEXT_CLEANUP TypeInfoCallbacksHookerEvtDriverContextCleanup;
32 |
33 | EXTERN_C_END
34 |
--------------------------------------------------------------------------------
/TypeInfoCallbacksHooker/Header.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 |
4 |
5 | typedef struct _OBJECT_DUMP_CONTROL
6 | {
7 | /* 0x0000 */ void* Stream;
8 | /* 0x0008 */ unsigned long Detail;
9 | /* 0x000c */ long __PADDING__[1];
10 | } OBJECT_DUMP_CONTROL, * POBJECT_DUMP_CONTROL; /* size: 0x0010 */
11 |
12 | typedef enum _OB_OPEN_REASON
13 | {
14 | ObCreateHandle = 0,
15 | ObOpenHandle = 1,
16 | ObDuplicateHandle = 2,
17 | ObInheritHandle = 3,
18 | ObMaxOpenReason = 4,
19 | } OB_OPEN_REASON, * POB_OPEN_REASON;
20 |
21 |
22 | typedef struct _OB_EXTENDED_PARSE_PARAMETERS
23 | {
24 | /* 0x0000 */ unsigned short Length;
25 | /* 0x0002 */ char Padding_0[2];
26 | /* 0x0004 */ unsigned long RestrictedAccessMask;
27 | /* 0x0008 */ struct _EJOB* Silo;
28 | } OB_EXTENDED_PARSE_PARAMETERS, * POB_EXTENDED_PARSE_PARAMETERS; /* size: 0x0010 */
29 |
30 |
--------------------------------------------------------------------------------
/Message Tracing/wdm/RCa02068:
--------------------------------------------------------------------------------
1 | # l i n e 1 " C : \ \ U s e r s \ \ s i n a \ \ D e s k t o p \ \ W i n d o w s - d r i v e r - s a m p l e s - m a s t e r \ \ W i n d o w s - d r i v e r - s a m p l e s - m a s t e r \ \ g e n e r a l \ \ e v e n t \ \ w d m \ \ e v e n t . r c "
2 | # l i n e 1
3 | # i n c l u d e <