0

I am developing a C# application that connects to a proprietary system. The proprietary system's API includes a call to connect to its servers that requires a username and password.

public bool ConnectToServer(string UserName, string Password)
{
    // ...
}

My concern is that hackers may obtain the application’s binaries, open up the code and steal the username and password.

How do I protect myself from such an attempt?

Ry-
  • 218,210
  • 55
  • 464
  • 476
user1034912
  • 2,153
  • 7
  • 38
  • 60
  • You can’t, really. Are the users of this binary not trusted to make calls to the API? If they aren’t and the purpose of the application is to limit access to certain calls, consider writing a proxy to do that job and deploying it alongside the *proprietary system*. If they are and you just don’t want to share credentials, implement revocable API keys. (API keys are a good idea in the first case, too.) – Ry- Feb 05 '17 at 05:50
  • @Alexei Levenkov, I don't see how this is an exact duplicate of that other question, especially since too little information is given about the scenario. If the user of the application is a good guy, then it certainly isn't a duplicate case. – Bent Tranberg Feb 05 '17 at 07:21
  • @BentTranberg your definition of "good guy" is somewhat interesting :) - according to the question "hackers may obtain the application’s binaries". If OP would specify that binaries only need to be protected from casual user it may be considered different question, but OP clearly concerned about malicious users - so the duplicate's "No, you can't" covers this particular case. – Alexei Levenkov Feb 05 '17 at 07:33
  • One scenario is that any legitimate user of the application can be trusted with the API password, but it is not desirable that same user be asked for the API password, but rather contributes to unlocking the API password in some other way. This is often the case, for practical reasons. That's why I am curious about the scenario. – Bent Tranberg Feb 05 '17 at 07:42
  • I think hiding means there's still the password to be stolen. I'm not sure of the architecture of your application. What about authentification with the credentials when connecting to proprietary system and grant permissions to the Server. And the asymmetric encoded password held only by WCF and only authentified users of your application communicate with the WCF. It's just basic idea. – Kay Lee Feb 05 '17 at 08:33
  • Typically, you'd want to separate the runtime executables from the credential storage. Use the OS that you're running on - in Windows, for example, there is a raft of mechanisms for storing credentials. Ideally, you'd have the creds encrypted in the db on one server, and your code with the decryption key (locally protected) - on another. This way an attacker needs to compromise both systems. Of course, if they do, then chances are you got bigger problems anyway. – zaitsman Feb 05 '17 at 09:05
  • You *could* put it in the app.config and use the configuration manager to encrypt the section holding the value. Then you get seamless access to the value without needing to manually decrypt. – pinkfloydx33 Feb 05 '17 at 09:37

0 Answers0