Skip to content
This repository was archived by the owner on Mar 30, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions techniques/IN/IN.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#include <stdio.h>
#include <stdint.h>
#include <excpt.h>

int isRunningInVMware(void)
{
uint32_t ebx_magic = 0;

__try {
__asm {
pushad

mov eax, 564D5868h
mov ecx, 0Ah
mov dx, 5658h
in eax, dx

mov ebx_magic, ebx

popad
}
} __except (EXCEPTION_EXECUTE_HANDLER) {
return 0;
}

return (ebx_magic == 0x564D5868);
}

int main(void)
{
if (isRunningInVMware()) {
printf("Running in VMware!\n");
} else {
printf("Not running in VMware.\n");
}

return 0;
}
15 changes: 15 additions & 0 deletions techniques/IN/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# *IN instruction*

## Authorship information
* Name or nickname: *omer872*
* Linkedin: *https://www.linkedin.com/in/omer-kahlon/*
* Email: *omerka189@gmail.com*

## Technique Information
* Technique title: IN
* Technique category: Sandbox Evasion
* Technique description: The IN instruction is a type of machine code instruction that is used to read data from an input port. This instruction can only be executed in privileged mode, such as in kernel mode, and an attempt to execute it in user mode will generate an exception. However, some virtual machine monitors, such as VMWare, use a special port called the VX port as an interface between the virtual machine monitor (VMM) and the virtual machine. If a malware executes the IN instruction in user mode on a VMWare virtual machine, it will not generate an exception, since the VX port allows the instruction to be executed without triggering an exception. This behavior can be used by the malware to detect the presence of a VMWare virtual machine.


## Additional resources
* https://www.kea.nu/files/textbooks/humblesec/practicalmalwareanalysis.pdf (Chapter 17)