Skip to content
Info disclosure Disclosed report Intermediate CVE-2022-32228

Message ID Enumeration with Regular Expression in getReadReceipts Meteor method

The getReadReceipts Meteor method passed user-supplied messageId values directly into MongoDB queries, allowing $regex operators. An authenticated attacker could use regular expressions to enumerate existing Message IDs character by character.

gronke Follow

Originally disclosed on HackerOne

Medium 4.3 View original
  • Triaged in 5 months
  • Fixed in 9 months
  • Disclosed after 11 months

Summary by the program

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:

JavaScript
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

The original report as published on HackerOne, by gronke. 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

The method did not validate or sanitise the messageId parameter, so MongoDB operators such as $regex were accepted and executed.

Impact

An authenticated attacker could enumerate existing Message IDs on the server using regular expression pattern matching.

What the attacker needed

Authenticated user account

The fix

The messageId parameter of the Meteor method should be filtered to reject query operators; the report states it was fixed in versions 4.7.5, 4.8.2 and 5.0.0.

How it was found

  1. Log in to Rocket.Chat as any authenticated user.
  2. Call the getReadReceipts method with a $regex pattern in the messageId parameter.
  3. Repeat the call with refined patterns until the full Message ID is discovered.

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 server method that fetches read receipts accepted a message identifier from the user and put it straight into a database query. Because the database query language supports pattern matching, an attacker could send a pattern instead of a real identifier and learn which messages exist by watching whether the server returned an error or a list. This is a form of injection where user input is treated as query logic rather than plain data.

What is Info disclosure?

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.

More by gronke

View all

27 more disclosed reports, best first.

More from Rocket.Chat

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Information disclosure

The lesson behind this report.

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.