"But let’s look at what happens if an attacker discovers a blind SQL injection vulnerability anywhere else in the application. The attacker doesn’t need to read the database or invert any hashes. An attacker can simply register a legitimate account and generate his own valid API key." No they can't, The given scenario has not pushed the auth into the database at all. if your accounts are also database accounts why do…
Why We Don't Trust the Database with Authentication
11–20 of 24 posts
Re: Why We Don't Trust the Database with Authentication
#12Why can’t the attacker with db access drop the trigger?
Re: Why We Don't Trust the Database with Authentication
#13For most monolithic applications I think the whole issue is be a bit moot; if the rest of the application state is in the primary database, then an attacker with database access could presumably accomplish anything without the need to spoof another user at the authentication layer.
Lastly, this scheme doesn't provide any mechanism for rotating the pepper.
Re: Why We Don't Trust the Database with Authentication
#14If I have full access to your database I would instead update my org-id and read data from other orgs.
Re: Why We Don't Trust the Database with Authentication
#15This premise is weird at best.
"the database is the ultimate source of truth" is not a "dangerous, implicit assumption", is the best rule you can get (and the rest of the post say so: all useful data comes from it!)
Instead the rest of the article is interesting on how to choose what to use for the hash, but not follow with this first paragraph :shrug:
Re: Why We Don't Trust the Database with Authentication
#16RBAC and proper prepared statements completely defeat all these scenarios.
Re: Why We Don't Trust the Database with Authentication
#17Why can’t the attacker with db access drop the trigger?
You could (and should) run with minimal permissions which would exclude DDL.
Re: Why We Don't Trust the Database with Authentication
#18"But let’s look at what happens if an attacker discovers a blind SQL injection vulnerability anywhere else in the application. The attacker doesn’t need to read the database or invert any hashes. An attacker can simply register a legitimate account and generate his own valid API key." No they can't, The given scenario has not pushed the auth into the database at all. if your accounts are also database accounts why do…
I recall the moaning long ago that one should never construct sql queries client side.
But it seems you get a luxorious api for free?
I recall people wanting access to order history.
With a bit of code the user could even create their own order process?
It seems if a user has 12 company accounts they could also have an overview db account with read access.
Maybe you can even get rid of the front end entirely :)
Re: Why We Don't Trust the Database with Authentication
#19Re: Why We Don't Trust the Database with Authentication
#20If I have full access to your database I would instead update my org-id and read data from other orgs.
As explained in the article this wouldn't work, because changing your org means your stored hash is no longer valid (as the org is incorporated in the hmac), and you can't generated your own hashes because you're missing the pepper. So after changing your org all subsequent requests would fail.