Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug for Trap Flag simulation #69

Closed
Maladiy opened this issue Dec 17, 2024 · 2 comments
Closed

Bug for Trap Flag simulation #69

Maladiy opened this issue Dec 17, 2024 · 2 comments

Comments

@Maladiy
Copy link

Maladiy commented Dec 17, 2024

When I added debugger and VM protection with vmprotect
2024-12-17 211823
and set EMULATE_SINGLE_STEP=True

ANTIDEBUG=1
ANTIVM=0
EMULATE_HYPERV=False
EMULATE_SINGLE_STEP=True

I found that a VM was detected.
2024-12-17 211059

It was strange because I was not running in a VM. To figure out why this happened, I looked at the leak source code of vmprotect and found a detection as shown below. https://github.com/jmpoep/vmprotect-3.5.1/blob/master/runtime/loader.cc#L2514
image

This is a common VM detection. https://howtohypervise.blogspot.com/2019/01/a-common-missight-in-most-hypervisors.html
I wrote code to verify whether tiny_tracer passed this test.

	uint8_t mem_val;
	__try 
	{
		// set T flag
		__writeeflags(__readeflags() | 0x100);
		__nop();
		__nop();
		
		printf("Debugger Found\n");
	}
	__except (mem_val = *static_cast<uint16_t*>((GetExceptionInformation())->ExceptionRecord->ExceptionAddress), EXCEPTION_EXECUTE_HANDLER) 
	{
		if (mem_val != 0x90)
		{
			printf("Virtual Machine Found\n");
			printf("mem_val:0x%x\n", mem_val);
		}
	}

	printf("Check done\n");

Unfortunately tiny_tracer had an error when simulating the Trap Flag.
image

@hasherezade
Copy link
Owner

Hi @Maladiy ! Thank you for your report. Please check the latest patch, it should help.

check1

Let me know if everything is ok.

@Maladiy
Copy link
Author

Maladiy commented Dec 30, 2024

Thanks a lot. I tested tiny_tracer and it works well.

@Maladiy Maladiy closed this as completed Dec 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants