Summary
LibreChat versions up to and including 0.8.3 allow a shared-agent editor to delete file records that are reused by the agent owner across multiple agents via the DELETE /api/files endpoint.
Because deletions are applied globally instead of being scoped to the shared agent, an editor can unintentionally or maliciously break the owner's private agents, which retain stale file_id references to now-missing files.
Affected context
This vulnerability appears in LibreChat deployments where:
- Users can collaborate on "shared agents" and assign editor roles to other users.
- Files can be uploaded once and reused across multiple agents by reference (
file_id). - The
/api/filesdeletion endpoint acts on a globally stored file record rather than a per-agent association.
In these conditions, a collaborator editing one shared agent can remove a file that is also used by unrelated private agents owned by the same user, even though the editor has no access to those private agents.
Exploit preconditions
- Attack surface: Application HTTP API, specifically
DELETE /api/files. - Required access: Valid authenticated account with editor-level access to at least one shared agent that references a target file.
- Trigger point: Issuing a file deletion request for a
file_idthat is reused across multiple agents, including private agents owned by the file owner. - Why exploitation is possible: Authorization checks focus on the shared agent/editor relationship but do not scope the file deletion to that agent. The backend treats files as globally owned resources and physically deletes them rather than removing only the association between the file and the shared agent.
Why this happens
The underlying issue is an improper authorization design around shared resources.
Instead of enforcing access control at the level of each agent–file relationship, the system exposes a global file deletion operation (DELETE /api/files) to shared-agent editors.
This aligns with CWE-863: Incorrect Authorization, where the system correctly authenticates the caller but fails to verify whether they are authorized to perform a state-changing operation that impacts other, unrelated resources (the owner's private agents).
Conceptually, the data model conflates "ownership of the file object" with "permission to use the file in a specific agent," allowing a user who can modify one agent to perform destructive operations on a shared underlying resource.
Potential impact
- A shared-agent editor may delete files that the owner also uses in private agents.
- The owner's private agents can stop functioning correctly or return errors due to stale
file_idreferences. - Silent breakage of workflows and automation that depend on affected agents and files.
- Denial of service against specific agent configurations without needing direct access to those agents.
- Loss of important user-uploaded content if no backups or versioning are available.
General mitigation guidance
Effective mitigation centers on scoping destructive actions to the correct authorization boundary and separating global resources from per-agent relationships:
- Model file usage as per-agent associations (e.g., a link table), and treat deletion from an agent as removal of that association rather than deletion of the global file.
- Enforce authorization checks that verify both: (1) the caller's rights on the agent, and (2) the limited scope of the action (only that agent's link to the file).
- Introduce resource-level ownership semantics so only file owners—or appropriately privileged roles—can perform global destructive operations on shared files.
- Apply the principle of least privilege to collaborator roles: editor access should not imply the ability to modify or destroy shared assets outside the specific agent.
- Provide non-destructive operations where possible (e.g., "detach from agent" instead of "delete file"), and only expose hard deletion to narrowly scoped, highly trusted roles.
How teams detect issues like this
Teams can identify and monitor this class of issue by:
- Reviewing access-control logic around shared resources to ensure checks consider both the resource owner and the scope of the operation (agent-level vs global).
- Using static analysis or code search to find endpoints where destructive operations (DELETE, hard delete, purge) are authorized only by one dimension (e.g., "can edit agent") but operate on multi-tenant or shared objects (e.g., global files table).
- Adding tests and policy checks that simulate collaborative scenarios, verifying that actions on a shared agent do not alter unrelated agents or resources.
- Instrumenting audit logs to capture which user deleted or detached which
file_idand which agents were affected, then alerting on patterns where a non-owner causes global resource deletion. - Incorporating automated review tools or policy-as-code frameworks to flag mismatches between intended privilege boundaries (documented roles) and implemented endpoint behavior.

