Skip to content
Access control Advisory Intermediate CVE-2021-41256

GHSL-2021-1033: Intent URI permission manipulation in Nextcloud News for Android - CVE-2021-41256

The Nextcloud News for Android app has an exported activity that reflects an incoming Intent back to the caller. A malicious app can include URI permission grant flags in the Intent, and when the activity returns it, the attacker gains read and write access to the app's non-exported FileProvider, which exposes external storage.

ghsecuritylab Follow

Originally disclosed on GitHub Security Lab

The Nextcloud News for Android app has a security issue by which a malicious application installed on the same device can send it an arbitrary Intent that gets reflected back, unintentionally giving read and write access to non-exported Content Providers in Nextcloud News for Android.

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

The exported SettingsActivity reflects the incoming Intent back to the caller via setResult without sanitising or removing URI permission grant flags, allowing the caller to obtain permissions on the app's FileProvider.

Impact

A malicious app could use Nextcloud News as a proxy to read and write the device's external storage without requesting the storage permission, and in a worst-case scenario could overwrite files used by Nextcloud News to alter its functionality.

What the attacker needed

Malicious app installed on same device; victim has Nextcloud News installed

The fix

The issue was fixed by updating the app, as indicated in the disclosure timeline.

How it was found

  1. Create an Intent targeting the exported SettingsActivity of Nextcloud News.
  2. Add the flags FLAG_GRANT_READ_URI_PERMISSION and FLAG_GRANT_WRITE_URI_PERMISSION to the Intent.
  3. Set the data URI to point to the FileProvider path for external storage.
  4. Start the activity for result.
  5. In onActivityResult, use the returned Intent's data URI to open an output stream and write to a file, then open an input stream to read it.

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.

In Android, apps can share access to their files through components called Content Providers. Normally, other apps cannot access a provider unless it is exported or the user grants permission. Here, a settings screen in the Nextcloud News app was set up to be opened by other apps, and it simply passed back whatever request it received. A malicious app could craft a request that asked for permission to read and write files, and when the settings screen returned it, the malicious app got that permission without the user ever approving it.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

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.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.