kgbfbi Newbie cheater
Reputation: 0
Joined: 07 Dec 2016 Posts: 10
|
Posted: Tue Jul 21, 2026 12:20 am Post subject: A bug in the {$try}/{$except} exception handling |
|
|
When using {$try}/{$except}, a breakpoint cannot be set on the first line of code after {$except}; it can only break on the second line.
The demo program is CE 7.6, Tutorial-x86_64.exe. The demo code is as follows: | Code: |
push rax
{$try}
mov rax,[base]
mov rax,[rax]
mov rax,[rax] //Because the address is incorrect, an error will definitely occur here, then jump to {$except}
pop rax
jmp originalcode
{$except}
nop //The debugger cannot interrupt the first line of code after {$except}, and the same applies to any other instruction
pop rax//Interruption can only be performed on the second line |
Furthermore, if the interruption occurs at the address to be hooked before the hook is injected, CE will freeze and become unusable. For example, the address injected in the demo program is: | Code: |
"Tutorial-x86_64.exe"+89F36 - 66 90 - nop 2 //The address to be hooked. If the interruption occurs before the hook is performed, and then the hook is clicked, the entire CE program will freeze and become unusable.
"Tutorial-x86_64.exe"+89F38 - 90 - nop
"Tutorial-x86_64.exe"+89F39 - 48 8D 65 00 - lea rsp,[rbp+00] |
The complete demo code is as follows: | Code: |
[ENABLE]
//code from here to '[DISABLE]' will be used to enable the cheat
alloc(newmem,2048,"Tutorial-x86_64.exe"+89F36)
label(returnhere)
label(originalcode)
label(exit)
newmem: //this is allocated memory, you have read,write,execute access
//place your code here
push rax
{$try}
mov rax,[base]
mov rax,[rax]
mov rax,[rax] //Because the address is incorrect, an error will definitely occur here, then jump to {$except}
pop rax
jmp originalcode
{$except}
nop //The debugger cannot interrupt the first line of code after {$except}, and it's the same with any other command
pop rax //It can only interrupt on the second line
originalcode:
nop 2
nop
lea rsp,[rbp+00]
exit:
jmp returnhere
base:
dd 12345 //Incorrect address used for demonstration
"Tutorial-x86_64.exe"+89F36:
jmp newmem
nop 2
returnhere:
[DISABLE]
//code from here till the end of the code will be used to disable the cheat
dealloc(newmem)
"Tutorial-x86_64.exe"+89F36:
db 66 90 90 48 8D 65 00
//nop 2
//nop
//lea rsp,[rbp+00] |
|
|