Skip to content
IDOR Disclosed report Intermediate CVE-2022-31131

Ownership check missing when updating or deleting attachments

The mail app did not verify that an attachment belonged to the requesting user when updating or deleting it. An attacker could change the local message reference or delete the database row, making the attachment unavailable in another user's outbox.

kesselb Follow

Originally disclosed on HackerOne

Medium 5.4 View original
  • Triaged in under an hour
  • Fixed in 43 days
  • Disclosed after 43 days

Summary by the program

https://github.com/nextcloud/security-advisories/security/advisories/GHSA-xhv7-5mhv-299j

The report

Summary:

Ownership check is missing for attachments.

Steps To Reproduce:

  1. Open mail app
  2. Compose a new message
  3. Attach some file
  4. Send message
  5. Copy the xhr request and modify the attachment ids
  6. See that local_message_id is changed for a different user

When you compose a message and put them into the outbox to send them later we keep a reference for the attachments in oc_mail_attachments. An attacker is able to overwrite the local_message_id for an existing attachment or delete the given row. Impact is that for the given message in the outbox the attachment is unavailable.

  • It's not possible to delete the actual attachment on file. Only the database reference.
  • It's not possible to send another person's attachment to you or someone else.

Supporting Material/References:

https://github.com/nextcloud/mail/blob/1752cbbba12285a4e93ec257d6e06ac1f790b171/lib/Db/LocalAttachmentMapper.php#L89-L118

Impact

For the given message in the outbox the attachment is unavailable.

The original report as published on HackerOne, by kesselb. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

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 attachment update and delete operations looked up records by identifier without confirming the record belonged to the authenticated user.

Impact

The attachment becomes unavailable for the affected message in the outbox, but the file itself cannot be deleted and the attachment cannot be sent to anyone else.

What the attacker needed

A mail account; ability to send crafted requests

How it was found

  1. Open the mail app and start composing a new message.
  2. Attach a file to the message.
  3. Send the message.
  4. Capture the request and change the attachment identifiers.
  5. Observe that the local message reference is changed for a different user.

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.

When you attach a file to an email, the app stores a link between that file and your draft message. The app failed to check that the link belonged to you before letting it be changed or removed. So someone else could break the link, and your draft would lose its attachment.

What is IDOR?

One user can read or change another user's data, usually by changing an identifier the server trusts without checking who is asking. One of the most paid bug classes on web programs.

More by kesselb

View all

3 more disclosed reports, best first.

More from Nextcloud

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Insecure direct object reference (IDOR)

The lesson behind this report.

One user can read or change another user's data, usually by changing an identifier the server trusts without checking who is asking. One of the most paid bug classes on web programs.