Closed icyfox168168 closed 2 years ago
I run the simulation function for a long time without any return, it seems like an infinite loop
SHEMU_ABORT_GLA_OUTSIDE no return
I take the image size of the whole exe as the shellcode size, my doubt is that the stack obviously exceeds the size I set but does not return
Clang compiles strange code, and uses stack consumption to trigger exceptions. The bdd simulation function cannot detect stack exhaustion. If it can detect stack exhaustion, and then judge whether there is abnormal function processing, it should be possible to simulate successfully this function.
STATUS_STACK_OVERFLOW
div:
00000001400618D0 | 90 | nop |
00000001400618D1 | 662E:0F1F8400 00000000 | nop word ptr cs:[rax+rax],ax |
00000001400618DB | 0F1F4400 00 | nop dword ptr ds:[rax+rax],eax |
00000001400618E0 | 55 | push rbp | relocapi.cpp:5592
00000001400618E1 | 48:83EC 30 | sub rsp,30 |
00000001400618E5 | 48:8D6C24 30 | lea rbp,qword ptr ss:[rsp+30] |
00000001400618EA | E8 E1FFFFFF | call <yasm.void cdecl div(void)> | relocapi.cpp:5595
00000001400618EF | EB 18 | jmp yasm.140061909 |
00000001400618F1 | EB 00 | jmp yasm.1400618F3 | relocapi.cpp:5596
00000001400618F3 | 8945 FC | mov dword ptr ss:[rbp-4],eax |
00000001400618F6 | 48:8D0D 70C02000 | lea rcx,qword ptr ds:[<"Exception caught...\n">] | relocapi.cpp:5599, 000000014026D96D:"Exception caught...\n"
00000001400618FD | E8 7E2BFAFF | call
_Pragma("clang optimize off") void __div() { (int)(0) = 69; } void x_seh(void) { try { div(); } __except(1) { printf("Exception caught...\n"); } } _Pragma("clang optimize on")
Hello,
There is no particular error to indicate that the stack has been exhausted. The SHEMU_ABORT_GLA_OUTSIDE error can be used to determine whether an access has been made outside the shellcode/stack memory, but it does not indicate explicitly that the stack has been exhausted.