Summary
A broken access control issue in Rocket.Chat Livechat allows unauthorized access to uploaded files via the /file-upload/:fileId/:name endpoint. Because room identifiers are not properly checked and file IDs are predictable, attackers can enumerate and download files without authentication.
This becomes particularly risky in deployments where Livechat is used to exchange sensitive documents, as any unauthenticated party can systematically discover and retrieve stored uploads.
Affected context
The vulnerability occurs in Rocket.Chat instances exposing the Livechat feature and its file upload functionality.
Specifically, the /file-upload/:fileId/:name route authorizes access using rc_room_type=l with rc_rid and rc_token, but does not confirm that the rc_rid associated with the token matches the room that owns the requested file.
Additionally, the :fileId path parameter is based on sequential MongoDB identifiers, and the :name segment is not validated against the stored filename.
In environments where Livechat is used for customer support or external interactions, this weak linkage between authorization and resource ownership can expose uploaded files to the internet.
Exploit preconditions
- Attack surface: Publicly accessible Rocket.Chat servers with Livechat enabled and
/file-upload/:fileId/:namereachable from untrusted networks. - Required access: No authenticated user session is strictly required if the endpoint accepts
rc_room_type=l,rc_rid, andrc_tokenwithout robust cross-checking; an attacker only needs network access to the service. - Trigger point: Direct HTTP requests to the file download endpoint using guessed or iterated
:fileIdvalues and arbitrary:namevalues. - Why exploitation is possible: The authorization path checks presence of Livechat-related parameters but does not ensure that the supplied
rc_ridcorresponds to the file's actual room ID. Combined with predictable, sequential MongoDB-based file IDs and a non-validated:name, this allows enumeration and access to files that should be bound to specific Livechat sessions.
Why this happens
This issue stems from incomplete enforcement of object-level access control on file resources, mapping to CWE-284: Improper Access Control.
The application authorizes file downloads based on generic Livechat parameters but fails to bind the authorization decision to the specific resource being accessed: there is no strict check that the rc_rid and rc_token belong to the room that owns the requested fileId.
At the same time, the design exposes a predictable identifier (:fileId as a sequential MongoDB ID) and treats the :name path parameter as cosmetic, which further weakens security by enabling enumeration.
Conceptually, this reflects a pattern where resource identifiers are guessable and the authorization layer validates session or room presence but not resource ownership, leaving files effectively unprotected against systematic probing.
Potential impact
- Unauthorized download of all Livechat-uploaded files, including potentially sensitive documents.
- Exposure of customer support transcripts, attachments, IDs, or confidential business materials.
- Privacy violations affecting users who shared personal or regulated data via Livechat.
- Facilitation of social engineering or further attacks using leaked internal information.
- Reputational damage and potential regulatory impact due to uncontrolled data disclosure.
General mitigation guidance
Effective mitigation focuses on strengthening object-level access control and reducing the exposure of predictable identifiers.
Recommended defensive patterns include:
- Ensuring that file download handlers always validate that the requesting principal (user, room, or token) is authorized for the specific file resource, not just for any Livechat context.
- Binding file metadata to a specific room or session and enforcing that the
rc_ridandrc_tokenmatch the owning room before returning content. - Avoiding sequential or easily guessable identifiers for externally exposed file IDs; using opaque, high-entropy tokens or UUIDs instead.
- Treating URL components like
:nameas untrusted, validating them against stored metadata, or making them non-authoritative for resource selection. - Applying least-privilege principles so that publicly accessible endpoints are restricted to the minimal data required for their function and are not reused as generic file gateways.
How teams detect issues like this
Detection efforts can focus on both code-level and runtime signals:
- Static analysis and review: Look for file download routes that:
- Accept resource identifiers via URL path parameters without coupling them to strong authorization checks.
- Use predictable identifiers (e.g., raw database IDs) in public URLs.
- Rely on generic checks (such as presence of a room token) rather than validating that the identifier belongs to the caller's context.
- Code review heuristics: Flag endpoints under patterns like
/file-upload/:fileId/:namewhere: - Authorization logic is implemented separately from resource lookups.
- There is no explicit comparison between a room/session ID and the file's stored room/session ID.
- Runtime monitoring: Analyze access logs for:
- Sequential or wide-range iteration of
fileIdvalues from a single IP or user agent. - High volumes of 404 or 403 responses followed by successful file downloads, indicating probing.
- Automated tooling: Use API security scanners or custom scripts to test file endpoints for ID enumeration and missing object-level authorization, integrating results into CI/CD security gates where possible.

