Windows C++ / Jump With Same Target
Author | Unprotect |
Platform | Windows |
Language | C++ |
Technique | Jump With Same Target |
Description:
This allows the code to demonstrate the intended behavior of the original instructions, which is to always call the my_function function, regardless of the value of the eax register. This technique can make it difficult for a disassembler to accurately reconstruct the original instructions of the program, as the disassembler will not be able to determine the intended behavior of the program without actually executing it.
Code
#include <stdio.h>
void my_function() {
printf("Hello, world!\n");
}
int main() {
int eax = 0x12345678;
// Original instructions
if (eax == 0) {
my_function();
}
if (eax != 0) {
my_function();
}
// Obfuscated instructions using back-to-back conditional jumps
if (eax == 0) {
my_function();
}
my_function();
return 0;
}
Created
December 6, 2022
Last Revised
April 22, 2024