RocketChat / RocketChat/Rocket.Chat
Cross-Room Data Exposure via Query Parameter Injection
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 46.1k
- Forks
- 13.9k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 130
Description
Issue: P0 - Cross-Room Data Exposure via Query Parameter Injection
Severity: Critical (P0)
Description
When the legacy unsafe query mode is enabled (ALLOW_UNSAFE_QUERY_AND_FIELDS_API_PARAMS=TRUE), user-supplied query parameters can override enforced room ID (rid) filters in API endpoints. This allows any authenticated user to access messages and files from rooms they don't have access to.
Vulnerable Code Locations
apps/meteor/app/api/server/v1/im.ts- Lines 337, 508, 562apps/meteor/app/api/server/v1/channels.ts- Lines 307, 825apps/meteor/app/api/server/v1/groups.ts- Lines 405, 791
Attack Vector
- Attacker enables ALLOW_UNSAFE_QUERY_AND_FIELDS_API_PARAMS (admin setting)
- Makes API request to /im.messages, /channels.messages, etc.
- Provides custom query:
{"rid": "target-room-id", "otherFilter": "value"} - Server merges query with server constraints:
{...query, rid: allowed_room_id} - Due to JavaScript spread order, user's rid OVERRIDES server's rid
- Attacker gains access to target room's data
Expected Behavior
Server-enforced room constraints (rid) should ALWAYS take precedence and cannot be overridden by user-supplied query parameters.
Fix Applied
- Filter out protected keys (rid) from user query before merging
- Apply consistently across all affected endpoints
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the query handling at the listed lines in im.ts, channels.ts, and groups.ts, focusing on how user parameters are merged with enforced room constraints. Verify the affected message and file endpoints reject a user-supplied rid and preserve the server-enforced room ID consistently across all six locations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, backend, security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100