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 Crashlytics .so Library Not RELRO Enabled #6598

Open
beastgamingx99 opened this issue Dec 12, 2024 · 3 comments
Open

Firebase Crashlytics .so Library Not RELRO Enabled #6598

beastgamingx99 opened this issue Dec 12, 2024 · 3 comments
Labels

Comments

@beastgamingx99
Copy link

#Details
While analyzing the Firebase Crashlytics library for security, I discovered that its shared object (.so) library is not compiled with RELRO (Relocation Read-Only) enabled. This omission weakens the security posture of the library by leaving the Global Offset Table (GOT) writable, potentially allowing an attacker to overwrite critical entries and hijack the control flow of the application.

Attack scenario

#Who Can Exploit the Vulnerability?

*Malicious App Developers: Apps using the Crashlytics library may be targeted by malicious apps installed on the same device.

*Advanced Attackers: Attackers who can exploit existing vulnerabilities in the app (e.g., buffer overflows, memory corruption) to achieve control over writable sections like the GOT.

#What They Gain When Doing So?

*Hijack Control Flow: By overwriting GOT entries, attackers can redirect function calls to their payloads (e.g., custom shellcode or ROP chains).

*Escalated Privileges: Exploiting the library in system apps or privileged processes could allow attackers to escalate privileges or execute arbitrary code.

*Sensitive Data Theft: Control over the application could allow attackers to access sensitive user data or bypass app security mechanisms.

*Device Compromise: In severe cases, it could lead to full device compromise, particularly if the library is used in system-critical apps or services.

#Steps to Reproduce:

*Download and integrate the Firebase Crashlytics library into an Android project.
*Extract the .so files (e.g., using apktool or similar).
*Run the following command to analyze the presence of RELRO:
readelf -l libcrashlytics.so | grep GNU_RELRO

*Observe that no RELRO protection is applied.

#Version Tested:
Crashlytics Version: 19.3.0 (part of Firebase BOM 33.7.0)
Operating System: Windows 11 using MSYS2 MINGW64

#Impact:
Without RELRO, writable sections such as the GOT are vulnerable to attacks, including GOT overwrites. This could allow an attacker to redirect program execution to malicious code or exploit other vulnerabilities in the application or system.

#Suggested Fix:
Enable RELRO during compilation by passing the appropriate linker flags:

For partial RELRO: -Wl,-z,relro
For full RELRO: -Wl,-z,relro,-z,now

#Enabling full RELRO provides additional protection by resolving all relocations at program startup and marking the GOT as read-only for the program's lifetime.

Affected Files

armeabi-v7a:

-libcrashlytics-common.so

arm64-v8a:

-libcrashlytics-trampoline.so

-libcrashlytics-handler.so

-libcrashlytics.so

-ibcrashlytics-common.so

x86_64:

-libcrashlytics-trampoline.so

-libcrashlytics-handler.so

-libcrashlytics.so

-libcrashlytics-common.so

x86:

-libcrashlytics-trampoline.so

-libcrashlytics-handler.so

-libcrashlytics.so

-libcrashlytics-common.so

@google-oss-bot
Copy link
Contributor

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

@lehcar09
Copy link
Contributor

Hi @beastgamingx99, thank you for reaching out. I tried reproducing the steps you shared, however, I’m having a trouble in checking for RELRO to the .so files.

I understand your concern and that RELRO can help prevent attackers from manipulating the program's code and data. It looks to me that this is more of an improvement to our SDK. I'll go ahead and mark this as a feature request. While we are unable to promise any timeline for this, we'll definitely keep this under our radar. Thank you for raising this. We really appreciate developers who are sharing their feedback since this helps us improve our SDK.

P.S. For folks who find this useful, adding an emoji thumbs up on the original post can help us prioritize adding this to the roadmap.

@lehcar09 lehcar09 added the type: feature request New feature or request label Dec 17, 2024
@lehcar09
Copy link
Contributor

Hey @beastgamingx99, according to our engineer, we have filed a ticket (b/379498315) to have this reviewed by a security team.

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

No branches or pull requests

3 participants