GHSL-2022-059_GHSL-2022-060: SQL injection vulnerabilities in Owncloud Android app - CVE-2023-24804, CVE-2023-23948
The Owncloud Android app's exported FileContentProvider is vulnerable to SQL injection through its delete, insert, query and update methods, allowing a malicious app to read data from the owncloud_database tables not otherwise exposed. Additionally, ReceiveExternalFilesActivity fails to properly validate file paths, enabling an attacker to upload internal files or write arbitrary .txt files to the app's internal storage.
Originally disclosed on GitHub Security Lab
The Owncloud Android app uses content providers to manage its data. The provider FileContentProvider has SQL injection vulnerabilities that allow malicious applications or users in the same device to obtain internal information of the app.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the app passed user-controlled parameters directly into SQL queries without sanitisation and used insufficient path validation when handling external file URIs.
Impact
These issues may lead to information disclosure when uploading the app’s internal files, and to arbitrary file write when uploading plain text files (although limited by the `.txt` extension).
What the attacker needed
Malicious app installed on the same device; no special permissions required
The fix
The SQL injection in the filelist database was mitigated by deprecating that database, but the owncloud_database injection remained unfixed at the time of disclosure; the path validation issues should be fixed by properly canonicalising and restricting file paths.
How it was found
- A malicious app on the same device sends a crafted query to the exported FileContentProvider.
- The app uses the query method with a malicious selection to perform a blind SQL injection against the owncloud_database.
- The attacker extracts data from tables like room_master_table that are not otherwise accessible.
- For the file path issue, the attacker sends an intent to ReceiveExternalFilesActivity with a crafted STREAM extra pointing to an internal file.
- The app uploads the internal file, disclosing its contents.
- Alternatively, the attacker provides a path traversal in the filename when uploading plain text, writing a .txt file to internal storage.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A content provider is a way for Android apps to share data with other apps. Here, the app's provider was exported, meaning any other app on the phone could talk to it. The app also failed to check file paths properly when receiving files from other apps, so a malicious app could trick it into reading or writing files it shouldn't.
What is SQL injection?
Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.