A lot of programs like runas
on Windows and su
on *nix take measures to ensure that users won't do dumb things like write passwords in batch files by ensuring that the password can't be piped to it or supplied as an argument.
At work there is a task that is repeatedly required to be done by another employee which requires logging in as the domain's administrator account. I am writing a stub application that calls CreateProcessWithLogonW
to get this done without the possibility of them seeing a plain-text password and without having to give them the Administrator password.
My concern is, the password will likely show up as plain text in the executable if it's opened with a hex editor (or even a plain text editor). Should I take measures to ensure that the password is generated in an obfuscated manner in this application?
E.g., start with a structure like this:
typedef struct _MYPASS
{
unsigned int first4;
unsigned int next4;
unsigned short next2;
unsigned char last1;
} MYPASS;
Then perform arithmetic on the bits to generate the ASCII that corresponds to the login password.
Is this overkill for an in-house application?
How about separating exe and password using the Password Vault? -> How do I store and retrieve credentials from the Windows Vault credential manager?
Does not help against an inside job, but in case the exe gets into the wild.