Skip to content

Possible SQL Injection in FIRMessagingRmqManager.m #14846

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

Closed
titze opened this issue May 13, 2025 · 2 comments · Fixed by #14856
Closed

Possible SQL Injection in FIRMessagingRmqManager.m #14846

titze opened this issue May 13, 2025 · 2 comments · Fixed by #14856
Assignees

Comments

@titze
Copy link

titze commented May 13, 2025

Description

FirebaseMessaging/Sources/FIRMessagingRmqManager.m contains a possible SQL injection:

querySyncMessageWithRmqID constructs a query with a rmqID String, which is supplied from the calling method. Following a possible call stack backwards, this can be an arbitrary message in the call to FirMessaging.appDidReceiveMessage. If input from the user of the app, or other external input is used as message here, this can lead to arbitrary SQL Injection.

The code suggests that this uses a prepared statement via sqlite3_prepare_v2, but this is not the case, as the query with the SQLi is constructed in the stringWithFormat in the preceding line.

Reproducing the issue

No response

Firebase SDK Version

10.9

Xcode Version

15.3

Installation Method

Swift Package Manager

Firebase Product(s)

All

Targeted Platforms

All

Relevant Log Output

If using Swift Package Manager, the project's Package.resolved

Expand Package.resolved snippet
Replace this line with the contents of your Package.resolved.

If using CocoaPods, the project's Podfile.lock

Expand Podfile.lock snippet
Replace this line with the contents of your Podfile.lock!
@google-oss-bot
Copy link

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

@leojaygoogle
Copy link
Contributor

I don't think this is actually a vulnerability because the rmqID is not a user input. It's generated by Google. But still, I will create a PR to bind the rmqID, instead of using stringWithFormat.

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

Successfully merging a pull request may close this issue.

4 participants