If I have a C++ code containing strings, that can be password or anything, what’s the best way to obfuscate them to make very difficult the reverse engineering?
I’ve found some tools online, but all are not opensource.
If I have a C++ code containing strings, that can be password or anything,
Share
Let’s say your application uses a web service “www.example.com” and authenticates with the password, “letmein”. Compile the program and examine it with
strings,objdump, or whatever:This is pretty easy. If you obfuscate it, you still need to put the plain text somewhere in memory before you can use it, so instead the attacker does one of the following:
Note that the obfuscation tools make it harder only for attackers that are already doing it the hard way. What’s the sense in that? All you’ve done is make it take 15 minutes instead of say, 5 minutes for an attacker to get the password from your executable. Since that’s pretty much the best you can do, don’t work too hard on it. Just XOR the password with some easy pattern and hope that the attackers are very lazy or stupid.
(You will probably end up spending more time on this than your attacker will.)
On the other hand: If you are trying to prevent non-root users from accessing the password on a trusted system, you can do that with permissions & setuid binaries.
Footnote: The purpose of obfuscators in general is to hide program code, not data. For example, if your application uses an algorithm that is a trade secret, that is when you would want to use an obfuscator.