Summary
LibreChat 0.8.1-rc2 exposes improper access control on file uploads tied to agent contexts and file search, allowing authenticated users to influence agents they do not own.
If an attacker knows or can obtain an agent ID, they can upload files into that agent's file context or search index and thereby change the agent's behavior without having direct permissions on that agent.
Affected context
This vulnerability affects LibreChat instances where multiple users share a deployment and use agents with file-backed contexts or file search capabilities.
The issue arises when access control checks for file uploads are tied only to authentication and knowledge of an agent ID, rather than verifying ownership or explicit permissions for that specific agent.
In such setups, any authenticated user who can guess, enumerate, or otherwise obtain an agent ID may be able to upload files into that agent's context and indirectly influence its outputs.
Exploit preconditions
- Attack surface: Web/API endpoints handling file uploads for agent file contexts and file search.
- Required access: Valid authenticated LibreChat account on the target deployment.
- Additional knowledge: The target agent's identifier (ID) or a way to discover it (e.g., through UI visibility, API responses, or guessable IDs).
- Trigger point: Submitting a file upload request that references an agent ID the attacker does not control.
- Why exploitation is possible: The backend permits file uploads based on authentication and agent ID alone, without enforcing fine-grained authorization to confirm that the acting user is allowed to modify that specific agent's context.
Why this happens
The core issue is missing or insufficient authorization checks on operations that modify an agent's file context and file search index.
While the application authenticates users, it fails to consistently verify that the requesting user has the right to alter a given agent, mapping to CWE-284: Improper Access Control and CWE-862: Missing Authorization.
At a design level, the system treats knowledge of an agent ID as a de facto permission, rather than enforcing a clear ownership or role-based permission model before accepting file uploads that affect agent behavior.
Potential impact
- Unauthorized modification of another user's or team's agent behavior by injecting new files into its context.
- Data poisoning of AI agents, leading to misleading, biased, or harmful responses.
- Indirect access to sensitive operational patterns or workflows by manipulating agents that drive automation.
- Reputational damage if agents controlled by one tenant are corrupted by another tenant's uploads in multi-user or multi-tenant deployments.
- Increased risk of follow-on social engineering or data exfiltration if compromised agents are used to interact with end users.
General mitigation guidance
Effective mitigation focuses on enforcing strict, per-agent authorization and strengthening the trust boundary around file-based context:
- Introduce explicit ownership and permission models for agents, ensuring only authorized users or roles can modify an agent's file context or file search.
- Apply server-side authorization checks on every file upload endpoint, validating that the caller is allowed to act on the referenced agent ID.
- Treat agent identifiers as non-authoritative: do not grant access based solely on the presence of an ID in a request.
- Segment tenants logically so that agents and their file contexts are scoped to specific users, groups, or organizations, minimizing cross-tenant impact.
- Use least-privilege defaults: new agents should be private or minimally shared until explicitly configured otherwise.
- Log and monitor file upload actions per agent, so unauthorized or anomalous changes can be detected and rolled back where feasible.
How teams detect issues like this
Detection efforts can combine code-level and operational approaches:
- Static analysis & code review:
- Look for handlers that accept an
agent_idparameter for file uploads or search indexing without accompanying authorization checks. - Flag API endpoints where authentication is performed but there are no checks to confirm ownership, role, or permission scopes on the agent resource.
- Review access control middleware usage to ensure it is consistently applied to file-related routes and controllers.
- Policy & configuration review:
- Define and enforce policies requiring resource-level authorization (e.g., per-agent access rules) for all state-changing operations.
- Use security checklists in pull requests to confirm that new endpoints touching agents or files are covered by authorization logic.
- Runtime monitoring:
- Log agent ID, acting user ID, and action type (e.g., file upload) and set alerts for suspicious patterns such as a single user modifying many agents.
- Periodically audit logs for uploads to agents owned by different users or organizations to spot cross-boundary access.
- Automated security testing tools or SAST/DAST platforms can be configured to identify endpoints that rely on weak or missing authorization around resource identifiers.

