I'm looking for some advise on designing a secure web app for storing passwords. Why reinvent the wheel? Because I don't trust a 3rd party with all of my passwords.
Here are my thoughts:
- There are 3 main components: Client, Application Server, Database Server. Ideally, I would like the system to be robust enough, so that if either the Application Server or the Database Server is compromised, the attacker doesn't get all the data (if the client is compromised, I can't see any way to protect the data).
- To accomplish this, I would think doing all encryption on the Client makes sense. So, if the Database Server is compromised, they would only get encrypted data, and if the Application Server is compromised, they wouldn't get the encryption keys because the Client keeps those.
That creates at least 2 problems:
- No good CSPRNG. Only use browsers with getRandomValues() and use a js crypto library that supports it.
- Man in the middle. Force TLS for all connections (doens't help if App Server is compromised, of course).
- XSS vulnerabiliy. Write a companion user script (Greasemonkey) that calculates hashes of each page on the app, and alerts the user when any page content has changed. Obviously, this will lead to false positives when you make updates, but it should allow you to detect if anyone has modified your code on the App Server or successfully injected any content into the page.
Searching on encrypted data is complicated.
- I don't have a concrete solutions for this yet, but if the general plan seems feasible, there are good options out there.
I realize this question is a bit broad, so feel free to close it if it's not a good fit for the site. I'm just hoping to get some general guidance on what I might be missing or where the holes in my plan are.
Update: Thank you all for the very helpful feedback. In light of some of the issues brought up, my new plan is to make everything much simpler. Keep a single, compressed and encrypted JSON file on the server. Write a JS app that runs locally. All it does is grab the file, decrypt it locally, and then reupload it when changes are made. Thoughts?
Also, I do see your point about using a well vetted and proven system. Call me tinfoil-hat paranoid, but I just can't trust someone else with that much access. All it takes is one disgruntled employee/contributor or one security hole for you to have a really bad day.