HexBrain

Rocket.Chat · Report #1377105

Message ID Enumeration with Regular Expression in getReadReceipts Meteor method

Validstatus
mediumseverity
1upvotes
22 Sept 2022disclosed

Summary

Summary

The getReadReceipts Meteor server method does not properly filter user inputs that are passed to MongoDB queries, allowing $regex queries to enumerate arbitrary Message IDs.

Description

Authenticated users are able to query the getReadReceipts Meteor server method to enumerate existing Message IDs:

Meteor.call("getReadReceipts", {
  messageId: { $regex: ".*" }
}, (...args) => console.log(...args));

When guessing individual characters of a message in the $regex MongoDB query of the messageId parameter, the server will respond with an error in case a message does not exist and return an (empty) list in case it does.

Releases Affected:

  • 3.18.2
  • 4.0.3

Steps To Reproduce (from initial installation to vulnerability):

(Add details for how we can reproduce the issue)

  1. Login to Rocket.Chat as any authenticated user
  2. Query getReadReceipts with $regex
  3. Repeat step 2 until the full Message ID was found

Supporting Material/References:

Suggested mitigation

  • Filter messageId parameter of the Meteor method

Impact

An Adversary can enumerate existing Message IDs on the server with Regular Expression pattern matching.

Fix

Fixed in versions 4.7.5, 4.8.2 and 5.0.0

How it was found

The write-up for this report has not been downloaded yet, or the program disclosed it without one. Read it on HackerOne.

This report was disclosed publicly on HackerOne and belongs to its author and the program. See the original