Summary
Rocket.Chat contains an unauthenticated file deletion flaw where the deleteFileMessage Meteor method can be invoked without a valid user session.
An attacker who can connect over DDP WebSocket and guess or discover file IDs may permanently delete arbitrary uploaded files from storage and the database.
Affected context
The vulnerability occurs in Rocket.Chat deployments exposing the Meteor DDP WebSocket interface where the deleteFileMessage method is available.
It manifests when the application relies on Meteor.userId() to gate access, but the method continues execution even when this value is null for unauthenticated callers.
Public channels and file-sharing features that expose file identifiers through message payloads or download URLs further increase the practical risk surface, as they make file IDs discoverable without special privileges.
Exploit preconditions
- Attack surface: Rocket.Chat DDP WebSocket endpoint exposing the
deleteFileMessageMeteor method. - Required access: Network access to the Rocket.Chat server; no authenticated session is required.
- Trigger point: An unauthenticated DDP method call to
deleteFileMessagecontaining a targeted file ID. - Why exploitation is possible: The authorization logic relies on
Meteor.userId()but does not enforce an early return or denial when it isnull, allowing execution to fall through toFileUpload.getStore('Uploads').deleteById(fileID)without verifying ownership or permissions.
Why this happens
The root cause is an incomplete authentication and authorization check for a sensitive server-side method responsible for deleting uploaded files.
The implementation assumes that Meteor.userId() will be non-null and effectively trusted for permission checks, but it does not explicitly handle the unauthenticated (null) case, resulting in a fall-through path where the delete operation is executed unconditionally.
This aligns with CWE-287: Improper Authentication, as the system fails to properly verify that requests to delete files originate from an authenticated and authorized user, exposing privileged functionality to anonymous callers.
Potential impact
- Attackers may permanently delete arbitrary uploaded files from Rocket.Chat storage.
- Critical business records, shared documents, and media assets can be removed, affecting availability.
- Disruption of team communications due to missing attachments in historical conversations.
- Potential regulatory or compliance issues if required records are erased without trace.
General mitigation guidance
Mitigation efforts should focus on enforcing strict authentication and authorization checks for all state-changing server methods, especially those affecting file storage.
Patterns that help include:
- Ensuring server-side methods explicitly reject requests when no authenticated user context is present, with early returns on
nullor invalid identities. - Applying consistent access control policies that verify both authentication and ownership/role-based permissions before performing file operations.
- Centralizing authorization logic for file management APIs to avoid ad hoc checks and fall-through paths.
- Limiting exposure of internal identifiers where possible and treating file IDs as sensitive references rather than public tokens.
How teams detect issues like this
Detection can rely on both preventive and retrospective techniques:
- Static analysis or code review rules that flag Meteor methods and other RPC endpoints performing destructive actions without explicit authentication and authorization checks.
- Policy enforcement in CI/CD pipelines requiring that all file manipulation paths call standardized authorization helpers.
- Runtime monitoring and logging of delete operations, including user identity (or lack thereof), IP, and file ID, to identify anomalous unauthenticated deletions.
- Periodic security reviews of WebSocket/DDP-exposed methods to ensure they adhere to the same access control standards as HTTP REST endpoints.

