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.
- 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:
- Open mail app
- Compose a new message
- Attach some file
- Send message
- Copy the xhr request and modify the attachment ids
- 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:
Impact
For the given message in the outbox the attachment is unavailable.
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
- Open the mail app and start composing a new message.
- Attach a file to the message.
- Send the message.
- Capture the request and change the attachment identifiers.
- 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.