Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Firebase Admin SDK - Potential Security Issue #4

Open
johndarsena opened this issue Jul 26, 2019 · 3 comments
Open

Firebase Admin SDK - Potential Security Issue #4

johndarsena opened this issue Jul 26, 2019 · 3 comments

Comments

@johndarsena
Copy link

I was reviewing your blogpost and the source code for this project because I am currently interested in implementing something similar.

From my understanding, the reason for implementing this project in this way is to make it so 2 different google accounts would need to be compromised in order for any individual's user data to be accessible. However, if someone got Admin access to just the firebase account, couldn't they then just use the firebase admin SDK to create a custom auth token for the user, submit that to google app engine and grab the decrypted encryption key plus any of the encrypted data on firebase?

Just want to see if I am missing something?

@andygeers
Copy link
Owner

Thanks so much for raising this.
I have played around with this to try and see if it's a genuine vulnerability. As far as I can tell, it's OK, because even a Custom JWT will be have to be signed by a private certificate that belongs to Account 1 (the one that owns the Firebase RTDB) whereas this Keysafe is checking for JWTs issued by Google itself using their own private key (see _GOOGLE_APIS_CERTS_URL here) - it is "verifying ID tokens issued by Firebase and the Google APIs infrastructure".

I tried issuing a custom JWT using the Firebase Admin SDK but it requires you to supply your own key and so the Keysafe couldn't verify it since it didn't know about that key.

@johndarsena
Copy link
Author

Ok, that is good to know, I was planning on using a different 3rd party authentication provider like auth0, which is considerably more expensive. Perhaps I will do some testing on this as well in the next few days and see what I find.

@johndarsena
Copy link
Author

From my investigation, it appears as though the custom JWTs verified with _GOOGLE_APIS_CERTS_URL will fail as you've stated, which is good.

1 other potential security vulnerability, unless I am missing something again. If the owner of the google account running the google app engine code gets compromised by a rogue employee or otherwise, all the ID tokens for firebase users are still getting sent to the server for verification purposes. That server could then take the auth tokens as they come in and use them to grab the encrypted encryption key from firebase for that user as well as any of the encrypted data it wants to decrypt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants