0

I need to store bank details of users in our system's database.

I'm thinking of encrypting the account number in case somebody gains access to our database or backups thereof.

We are using Heroku and our database is running on a separate server to the webserver. My idea is to store the encryption key on the web server as an environmental variable so that at least it is not stored on the same machine as the DB.

Is this a good approach to follow? Any other suggestions?

  • 6
    Hi Johan, Dealing with bank details means you are probably in the financial industry. If this is going to be a production system I hope you will also seek out professional advice/guidance. You can't build such a system from advice you get on stackoverflow. The design should be made by a team of experts who can answer these questions themselves. Please be responsible with the peoples data. They trust you. – Silver Jul 27 '17 at 14:08
  • 1
    Thanks, very good point and agree 100%. Just wanted to get my 'own' opinions before engaging with others. – Johan Jul 27 '17 at 14:11
  • A second opinion is indeed very wise to ask. If you don't master the subject it will still allow you to challenge your consultants/designers/architects/devs. So +1 Also think about monitoring for attacks since you can never be 100% certain about the robustness of your application. – Silver Jul 27 '17 at 14:14
  • You shouldn't just be 'thinking' of encryption, it's essential here. If you are storing financial data, you need to look at properly storing encryption keys using something like a tpm. Just storing your key on another server is not going to be sufficient. Regulatory frameworks like pci-dss may apply to you, also GDPR if you operate in Europe and lose any of that financial data could cause you serious problems – iainpb Jul 27 '17 at 15:47
4

A full answer would be far beyond a post on this site, so I will only give hints here.

You problem a real security question. The answer will not be (only) technical, but you should first wonder about your real security requirements. In security, I want a safe solution just means nothing, a solution can only be safe according to a system of security requirements.

So you should ask yourself the following questions - I do not know your use case, so I cannot answer them

  • what are the already known weaknesses (known vulnerabilities in used libraries or frameworks, pen testing reports...)
  • what are the threats to consider (information theft, unwanted modifications, denial of service, physical attack...)
  • what are the possible attackers you want to be protected against (script kiddies, NSA, russian mafia...)
  • what could be the possible consequences of data compromission

You will end with a number of risks. You then will have to say how you can mitigate the risk itself or its consequences, and whether the remaining risk is acceptable or not.

What you propose is a mere obfuscation of data requiring first an attack of the web server and then access to the database. You can say whether it is acceptable for your security requirements after doing your risk analysis, I cannot.

  • There might also be laws to comply with in your country, that we cannot know about. – Tom K. Jul 27 '17 at 14:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.