digitalmars.D - Obfuscating function names and the like inside exe file
- bobef (3/3) Mar 20 2010 Hello all,
- Bane (2/7) Mar 20 2010 Compress/encode sensitive data and give meaningless names to function/cl...
- Steve Teale (5/7) Mar 20 2010 Bane,
- Robert Jacques (8/15) Mar 20 2010 Regarding function names/etc. I'd expect any industry standard obfuscato...
- Ellery Newcomer (3/20) Mar 20 2010 Doesn't that just put "important name" in the mangled name of ct_encrypt...
- BCS (5/30) Mar 20 2010 Use a CTFE compression function and that problem should go away (as long...
- Walter Bright (9/14) Mar 20 2010 1. make sure you're not compiling with debug info (-g) on.
- Nick Sabalausky (3/20) Mar 20 2010 Wouldn't compiler errors still refer to the obfuscated name?
- Walter Bright (2/9) Mar 20 2010 Sometimes.
- Mike James (2/12) Mar 21 2010 Ah... An obfuscated answer to an obfuscation question.
- Bane (3/13) Mar 20 2010 Lol :))))
- Daniel Keep (29/34) Mar 20 2010 module seakrit;
- bobef (5/17) Mar 21 2010 Too much manual work. Any clues how I can automate this? At least where ...
- Walter Bright (4/11) Mar 21 2010 You can write a simple D program that contains a list of strings to patc...
- BCS (10/33) Mar 21 2010 If you know what to look for, some kind of find/replace might work.
Hello all, I was wondering if someone know of way to obfuscate all the strings and function names and class names inside DMD Windows generated exe file. Opening the file with notepad shows all kinds of strings and names in clear text and since my application handles some sensitive data it gives me an extra feeling of insecurity. Any suggestions? Thanks
Mar 20 2010
bobef Wrote:Hello all, I was wondering if someone know of way to obfuscate all the strings and function names and class names inside DMD Windows generated exe file. Opening the file with notepad shows all kinds of strings and names in clear text and since my application handles some sensitive data it gives me an extra feeling of insecurity. Any suggestions? ThanksCompress/encode sensitive data and give meaningless names to function/classes ? :)
Mar 20 2010
On Sat, 20 Mar 2010 09:53:17 -0400, Bane wrote:Bane, You have become a changed person - these days you are tolerant to a fault. Do try to keep a balance! SteveCompress/encode sensitive data and give meaningless names tofunction/classes ? :)
Mar 20 2010
On Sat, 20 Mar 2010 10:12:14 -0300, bobef <_asd_ASd_ASD_Asdasd_ASd asdasda___dasd.com> wrote:Hello all, I was wondering if someone know of way to obfuscate all the strings and function names and class names inside DMD Windows generated exe file. Opening the file with notepad shows all kinds of strings and names in clear text and since my application handles some sensitive data it gives me an extra feeling of insecurity. Any suggestions? ThanksRegarding function names/etc. I'd expect any industry standard obfuscator would scramble them for you. A bigger problem is the data segment which stores any constant strings, etc. If you really have to include them in your program, I'd recommend writing a compile time encrypt and runtime decrypt function pair. i.e. string name = rt_decrypt(ct_encrypt!"important name");
Mar 20 2010
On 03/20/2010 11:24 AM, Robert Jacques wrote:On Sat, 20 Mar 2010 10:12:14 -0300, bobef <_asd_ASd_ASD_Asdasd_ASd asdasda___dasd.com> wrote:Doesn't that just put "important name" in the mangled name of ct_encrypt (albeit in hex)?Hello all, I was wondering if someone know of way to obfuscate all the strings and function names and class names inside DMD Windows generated exe file. Opening the file with notepad shows all kinds of strings and names in clear text and since my application handles some sensitive data it gives me an extra feeling of insecurity. Any suggestions? ThanksRegarding function names/etc. I'd expect any industry standard obfuscator would scramble them for you. A bigger problem is the data segment which stores any constant strings, etc. If you really have to include them in your program, I'd recommend writing a compile time encrypt and runtime decrypt function pair. i.e. string name = rt_decrypt(ct_encrypt!"important name");
Mar 20 2010
Hello Ellery,On 03/20/2010 11:24 AM, Robert Jacques wrote:Use a CTFE compression function and that problem should go away (as long as you can force CTFE). -- ... <IXOYE><On Sat, 20 Mar 2010 10:12:14 -0300, bobef <_asd_ASd_ASD_Asdasd_ASd asdasda___dasd.com> wrote:Doesn't that just put "important name" in the mangled name of ct_encrypt (albeit in hex)?Hello all, I was wondering if someone know of way to obfuscate all the strings and function names and class names inside DMD Windows generated exe file. Opening the file with notepad shows all kinds of strings and names in clear text and since my application handles some sensitive data it gives me an extra feeling of insecurity. Any suggestions? ThanksRegarding function names/etc. I'd expect any industry standard obfuscator would scramble them for you. A bigger problem is the data segment which stores any constant strings, etc. If you really have to include them in your program, I'd recommend writing a compile time encrypt and runtime decrypt function pair. i.e. string name = rt_decrypt(ct_encrypt!"important name");
Mar 20 2010
bobef wrote:I was wondering if someone know of way to obfuscate all the strings and function names and class names inside DMD Windows generated exe file. Opening the file with notepad shows all kinds of strings and names in clear text and since my application handles some sensitive data it gives me an extra feeling of insecurity. Any suggestions?1. make sure you're not compiling with debug info (-g) on. 2. you can just use a bit editor to stomp on those names in the executable (replace them with XXXXX or whatever). The exe files are not checksummed, so this should be straightforward. 3. rename your sensitive classes to obscure names, then alias them to a readable name. The alias name shouldn't appear in the executable: class CXX97ASDFXX { } alias CXX97ASDFXX mySensitiveName;
Mar 20 2010
"Walter Bright" <newshound1 digitalmars.com> wrote in message news:ho34du$2lij$1 digitalmars.com...bobef wrote:Wouldn't compiler errors still refer to the obfuscated name?I was wondering if someone know of way to obfuscate all the strings and function names and class names inside DMD Windows generated exe file. Opening the file with notepad shows all kinds of strings and names in clear text and since my application handles some sensitive data it gives me an extra feeling of insecurity. Any suggestions?1. make sure you're not compiling with debug info (-g) on. 2. you can just use a bit editor to stomp on those names in the executable (replace them with XXXXX or whatever). The exe files are not checksummed, so this should be straightforward. 3. rename your sensitive classes to obscure names, then alias them to a readable name. The alias name shouldn't appear in the executable: class CXX97ASDFXX { } alias CXX97ASDFXX mySensitiveName;
Mar 20 2010
Nick Sabalausky wrote:Sometimes.3. rename your sensitive classes to obscure names, then alias them to a readable name. The alias name shouldn't appear in the executable: class CXX97ASDFXX { } alias CXX97ASDFXX mySensitiveName;Wouldn't compiler errors still refer to the obfuscated name?
Mar 20 2010
Walter Bright Wrote:Nick Sabalausky wrote:Ah... An obfuscated answer to an obfuscation question.Sometimes.3. rename your sensitive classes to obscure names, then alias them to a readable name. The alias name shouldn't appear in the executable: class CXX97ASDFXX { } alias CXX97ASDFXX mySensitiveName;Wouldn't compiler errors still refer to the obfuscated name?
Mar 21 2010
Walter Bright Wrote:Nick Sabalausky wrote:Lol :)))) There goes determinism down the drain.Sometimes.3. rename your sensitive classes to obscure names, then alias them to a readable name. The alias name shouldn't appear in the executable: class CXX97ASDFXX { } alias CXX97ASDFXX mySensitiveName;Wouldn't compiler errors still refer to the obfuscated name?
Mar 20 2010
bobef wrote:Hello all, I was wondering if someone know of way to obfuscate all the strings and function names and class names inside DMD Windows generated exe file. Opening the file with notepad shows all kinds of strings and names in clear text and since my application handles some sensitive data it gives me an extra feeling of insecurity. Any suggestions? Thanksmodule seakrit; char[] supar_enkript(char[] mah_secret) { char[] result = mah_secret.dup; for( size_t i=0; i<result.length; ++i ) result[i] = ~result[i]; return result; } alias supar_enkript supar_dekript; const supar_seakrit_password = supar_enkript("O HAI THAR"); import tango.io.Stdout; void main() { Stdout("Tha supar seakrit password is: ") (supar_dekript(supar_seakrit_password)).newline; } Note that simply using supar_enkript("O HAI THAR") isn't sufficient; you have to make sure you trigger compile-time evaluation or you'll end up with the seakrit in the object file. For extra sekuritee, put supar_enkript in another module that you never link to. Of course, the reason for all the bad spelling is to indicate that this isn't really something I can imagine helping. If your program handles sensitive data, protect the data, not your program. If your program *contains* sensitive information, don't give it to the wrong people. If someone is really, seriously determined to get at that information, there's nothing you can do to stop them.
Mar 20 2010
Walter Bright Wrote:1. make sure you're not compiling with debug info (-g) on.Bye bye stack traces... :(2. you can just use a bit editor to stomp on those names in the executable (replace them with XXXXX or whatever). The exe files are not checksummed, so this should be straightforward.Too much manual work. Any clues how I can automate this? At least where I should look for info?3. rename your sensitive classes to obscure names, then alias them to a readable name. The alias name shouldn't appear in the executable: class CXX97ASDFXX { } alias CXX97ASDFXX mySensitiveName;Nice idea. Didn't thought about it. But it won't work for external libraries. For example if I'm using dcrypt it will be obvious I'm using one of its supported ciphers for my encrypted data. I wouldn't wish this to be so obvious, at least not for people without reverse-engineering skills. Thanks.
Mar 21 2010
bobef wrote:Walter Bright Wrote:>> 2. you can just use a bit editor to stomp on those names in the executableYou can write a simple D program that contains a list of strings to patch. It reads the exe file, patches it, and writes it back out.(replace them with XXXXX or whatever). The exe files are not checksummed, so this should be straightforward.Too much manual work. Any clues how I can automate this? At least where I should look for info?
Mar 21 2010
Hello bobef,Walter Bright Wrote:Only for release builds.1. make sure you're not compiling with debug info (-g) on.Bye bye stack traces... :(If you know what to look for, some kind of find/replace might work.2. you can just use a bit editor to stomp on those names in the executable (replace them with XXXXX or whatever). The exe files are not checksummed, so this should be straightforward.Too much manual work. Any clues how I can automate this? At least where I should look for info?I'd assume anyone who can identify the cypher from function names and apply it to strings in the file already has reverse-engineering skills. And if you are considering the attacker knowing what cypher you are using to be a security issue, don't bother I anyone able to think about cracking any real cypher can get that from the binary no matter what you do. -- ... <IXOYE><3. rename your sensitive classes to obscure names, then alias them to a readable name. The alias name shouldn't appear in the executable: class CXX97ASDFXX { } alias CXX97ASDFXX mySensitiveName;Nice idea. Didn't thought about it. But it won't work for external libraries. For example if I'm using dcrypt it will be obvious I'm using one of its supported ciphers for my encrypted data. I wouldn't wish this to be so obvious, at least not for people without reverse-engineering skills.
Mar 21 2010