firebase / firebase-ios-sdk

Firebase SDK for Apple App Development
https://firebase.google.com
Apache License 2.0
5.55k stars 1.45k forks source link

App Security issues found in Firebase iOS SDK #5447

Closed Nookaraju closed 4 years ago

Nookaraju commented 4 years ago

Step 0: Are you in the right place?

[REQUIRED] Step 1: Describe your environment

[REQUIRED] Step 2: Describe the problem

We are using Firebase Analytics in our apps and there are a couple of security vulnerability issues found by our App Security Scanner (Data Theorem).

Steps to reproduce:

  1. App Embeds SQL Query with Dynamic Input References: SELECT rowid, FROM %@ WHERE %@ CREATE TABLE IF NOT EXISTS %@ ( SELECT rowid, FROM %@ WHERE %@ = ? INSERT INTO %@ SELECT * FROM %@ UPDATE %@ SET %@ WHERE %@=? About 12 more findings with dynamic queries

  2. Hash Generated Using Broken Cryptography API (SHA1) References: -[FIRInstallationsIIDStore sha1WithData:] calls _CC_SHA1()

  3. Message Digest Generated Using Broken Cryptography API [$_Unknown_Class (MD5) apm_MD5Data] calls _CC_MD5()

Relevant Code:

// TODO(you): code here to reproduce the problem
google-oss-bot commented 4 years ago

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

morganchen12 commented 4 years ago

Action items for the Analytics team:

paulb777 commented 4 years ago

Actually it's Installations, not Analytics - reassigned.

maksymmalyhin commented 4 years ago

@Nookaraju Thank you for the report.

-[FIRInstallationsIIDStore sha1WithData:] method is used only once per application installation to migrate data from legacy Firebase Instance ID storage. I can confirm that SHA1 hash function was never used for encryption in either the legacy Firebase Instance ID SDK or Firebase Installations SDK. So feel free to ignore this particular warning.

maksymmalyhin commented 4 years ago

apm_MD5Data method defined in Analytics SDK.

@allenktv, @htcgh Could you confirm if it is an actual security issue?

allenktv commented 4 years ago

For Analytics: apm_MD5Data method is used only to calculate fingerprints for uniqueness. User inputs are also sanitized for the SQL database.

Nookaraju commented 4 years ago

@allenktv you are saying issue (App Embeds SQL Query with Dynamic Input References) does not issue?

maksymmalyhin commented 4 years ago

@Nookaraju I'm afraid the SQL issue slipped from our attention. Sorry about that and thank you for bringing this up again. Let us evaluate the potential issue again.

baolocdo commented 4 years ago

@Nookaraju Thanks for the report. Due to the closed source, we can't show you where and how the code sanitize. To clarify for @allenktv 's comment, the %@ is only for hard coded strings (table names, column names) so that we can reuse the code internally. All user inputs are validated, sanitized and bound appropriately for each query. We have been through security audit of the source code before releasing.

morganchen12 commented 4 years ago

Closing this based on @baolocdo's comment. Please let us know if you find any more security warnings.