4

I've been asked to expose the database of a web app publicly so that an external service can connect directly to the database (via username/password) to read information. This database is currently behind a firewall, with the web app connecting locally to it.

This immediately rings alarm bells in my head as being a security threat, butt I'd like to be able to summarize why this isn't a good idea. So what actually are the threats?

I would immediately think of the exposure to potential DDOSing of the database as well as any exploits and vulnerabilities that exist for the particular database server itself? Simple reconfiguration of the database server, exposing data? Not using SSL connections?

2

The bells ringing in your head are correct and I would be right there with you. This is a bad practice and I am afraid I have seen it done many times.

Here are some vulnerabilities and threats that come to mind with exposing a database to a third party and the public:

  • Authentication via username/password is weak and subject to brute force attacks and password spraying. It will be tough to implement MFA.
  • Some database support TLS/SSL, some don't. Better make sure end-to-end encryption is enabled.
  • Depending on if you store PHI, you are most definitely not compliant with HIPPA.
  • Lacking a clipping level, or the ability to lock someone out after they have failed to authenticate a number of times.
  • Database software can be very complex, you better keep up to date on all patches. If you are late or miss one, good luck.
  • I hope you trust this third party 1000%, any compromise and your database is gone.
  • DOS attacks are low hanging fruit
  • Any attacker that scans your externally facing network and finds a open port that is known for running databases will likely know you are a easy target in other areas
  • Management. Are you going to make a username and password for each user?
  • It is very difficult if you have 30 users to make sure they have the correct database and table views and access. Least privilege is very hard here.

Think about possibly the correct way of doing this (there are other ways):

  • Exposing a API to the public. The API connects, preferably through a WAF, back to the database. The API can grant tokens that have particular rights (database views) and access time. These are easily revoked and your database is much more secure, if you do it right*. The API can be easily secured with TLS, whitelisting, MFA and other controls such as locking someone out after a number of failed attempts

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.