Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to hide a password defined within C++ code

... so that browsing the disassembly won't immediately expose the password (declared as a static variable). As an example, imagine a program that has a zip file attached that it must open for assets but is not easily accessible to prying eyes.

I know that it is impossible to completely hide or protect that zip but I'm curious what means are available to at least hold off a casual snooper.

Thanks!

like image 279
SilentDirge Avatar asked Mar 15 '11 18:03

SilentDirge


3 Answers

If your program is a Windows program, just use "This program cannot be run in DOS mode." as the password. That string is in nearly every Windows executable.

I'm only half kidding, since it's probably nearly as secure as XOR-ing the password with a key that's elsewhere in the program and there will be pretty much zero headaches maintaining it.

like image 50
Michael Burr Avatar answered Nov 10 '22 01:11

Michael Burr


In short, no, Any cracker would just set a breakpoint on the function that opens the zip file, and get the password from RAM there.

like image 29
ninjalj Avatar answered Nov 10 '22 01:11

ninjalj


No but there are things you can do to make it harder.

Store the password as a series of numbers, do some calcualtions on them to generate the actual password, store parts of the password in resources such as icons etc.

like image 12
Martin Beckett Avatar answered Nov 10 '22 00:11

Martin Beckett