Skip to content
SQL injection Advisory Intermediate CVE-2023-24804CVE-2023-23948

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.

ghsecuritylab Follow

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.

ghsecuritylab, on GitHub Security Lab

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

  1. A malicious app on the same device sends a crafted query to the exported FileContentProvider.
  2. The app uses the query method with a malicious selection to perform a blind SQL injection against the owncloud_database.
  3. The attacker extracts data from tables like room_master_table that are not otherwise accessible.
  4. For the file path issue, the attacker sends an intent to ReceiveExternalFilesActivity with a crafted STREAM extra pointing to an internal file.
  5. The app uploads the internal file, disclosing its contents.
  6. 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.

More by ghsecuritylab

View all

132 more disclosed reports, best first.

More from GitHub Security Lab

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

SQL injection

The lesson behind this report.

Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.