How to create a Data Segment in a DLL that can only be accessed by a valid trusted application
-
Hi there, I have an application which requires to read the credentials and login to the DB. Since my application runs on schedule, someone has to fed in the credentials. Storing the credentials in flat file with any encryption (including DPAPI) is not helping as the entropy will be stored in the same file and it can be easily retrieved. Thought of having the Salt for the entropy in-memory which will be key-ed in by the user through an application that will be written on a secured shared memory and the same will only be able to access by my own process (with validating the Digital signature thump print). The provision of creating the shared segment is done by a DLL and the Client process which sets the password and my process which reads the password is digitally signed and I can validate the same in the DLLMain - PROCESS_ATTACH. If the digital signature is invalid, I'm unloading the DLL by terminating the same. All worked well with LoadLibrary API and when we tried testing with LoadLibraryEx with the option: DONT_RESOLVE_DLL_REFERENCES, it was not hitting the DLLMain and was able to call all the exported functions. My query is that is there a way to securely share a data between two trusted application alone? The application is developed using C++. thanks in advance, Rajesh Iyer
-
Hi there, I have an application which requires to read the credentials and login to the DB. Since my application runs on schedule, someone has to fed in the credentials. Storing the credentials in flat file with any encryption (including DPAPI) is not helping as the entropy will be stored in the same file and it can be easily retrieved. Thought of having the Salt for the entropy in-memory which will be key-ed in by the user through an application that will be written on a secured shared memory and the same will only be able to access by my own process (with validating the Digital signature thump print). The provision of creating the shared segment is done by a DLL and the Client process which sets the password and my process which reads the password is digitally signed and I can validate the same in the DLLMain - PROCESS_ATTACH. If the digital signature is invalid, I'm unloading the DLL by terminating the same. All worked well with LoadLibrary API and when we tried testing with LoadLibraryEx with the option: DONT_RESOLVE_DLL_REFERENCES, it was not hitting the DLLMain and was able to call all the exported functions. My query is that is there a way to securely share a data between two trusted application alone? The application is developed using C++. thanks in advance, Rajesh Iyer
You can use a memory-mapped file with an obscure name. This won't prevent a hacker from being able to see the file but it will be far from obvious. You can obscure the data you place in the MMF by negating it or something simple like that. Another way is to use an interprocess communication mechanism. Some examples are pipes, sockets, the WM_COPYDATA message, and there are others. It is possible for a socket message to be intercepted but the other two are much more difficult to spoof.