c++assemblyg++obfuscationreverse-engineering

Obfuscation of variable and function names in C++ to prevent basic reverse engineering


On my spare time, I am doing some reverse engineering games with some friends of mine and I would like to know how to prevent as much as possible asm readability. I do not want to "prevent" reverse engineering (after all it will always be possible), I just want to prevent easy understanding of functions/variables by obfuscating them in the assembly code.

For example, if I have declared a function like that in C++:

void thisFunctionReverseAString(std::string& mystring);

I would like to be sure that it will not be possible to get the names thisFunctionReverseAString and mystring from the assembly. Is there any compilation option to do that in g++ or clang++ ?


Solution

  • Obfuscation will only help for the source code. The executable, with no debugging information, does not contain variable names or function names.

    The process of reverse engineering would involve:

    1. Converting the executable to assembly language code.
    2. Converting the assembly code to a high level language code.
    3. Making sense of the sequentially named functions and variables.

    For example, take an executable in FORTRAN (or compiled BASIC) and reverse engineer into C++ source code.

    As others have said, there are functions to remove symbols from the Debugging version of an executable. You could start at the beginning and build an executable without symbols, often called a Release version.