Summary
A missing authorization check in the respond_request() handler of parisneo/lollms allows any authenticated user to accept or reject friend requests that belong to other users.
By abusing the /api/friends/requests/{friendship_id} endpoint, an attacker can perform Insecure Direct Object Reference (IDOR) actions on arbitrary friendship records, leading to unauthorized changes in social relationships and exposure of private interactions.
Affected context
This vulnerability appears in the backend friendship management logic of Lollms, specifically in the friends API router handling request responses.
It manifests when:
- The application relies solely on authentication (logged-in status) without verifying that the caller owns or is part of the targeted friendship record.
- The endpoint
/api/friends/requests/{friendship_id}directly uses thefriendship_idfrom the path to select and update friendship state. - There is no additional check to ensure that the authenticated user is either the requester or the recipient associated with that friendship.
Under these conditions, any authenticated user who can guess or enumerate valid friendship_id values may tamper with relationships between other users.
Exploit preconditions
- Attack surface: HTTP API exposed by the Lollms backend, specifically the
/api/friends/requests/{friendship_id}endpoint. - Required access: Valid authenticated account on the application (no special roles required).
- Trigger point: Sending a crafted request (e.g., POST/PUT/PATCH, depending on implementation) to
respond_request()with afriendship_idthat does not belong to the attacker. - Why exploitation is possible: The handler updates the friendship record based solely on the provided
friendship_idand does not verify that the authenticated user is the requester or intended recipient, enabling Insecure Direct Object Reference (IDOR) behavior.
Why this happens
The root cause is a classic broken access control pattern where authorization is not enforced at the object level.
The respond_request() function accepts a friendship_id identifier and performs state changes—such as accepting or rejecting a friend request—without confirming that the current user is associated with that specific friendship record.
This maps to CWE-863: Incorrect Authorization, where the application validates that a user is authenticated but fails to verify that they are authorized to act on the targeted resource.
At a design level, the backend couples business actions directly to identifiers provided by clients, assuming those identifiers always refer to objects owned by the caller, instead of deriving or validating ownership based on the authenticated user context.
Potential impact
- Unauthorized acceptance or rejection of friend requests between other users.
- Manipulation of social graphs, including forcing unintended connections or blocking legitimate ones.
- Privacy violations by exposing relationship status or interaction patterns between users.
- Facilitation of social engineering attacks by creating or removing relationships to increase trust or reduce suspicion.
- Undermining of audit trails and trust in account activity, as actions appear to originate from legitimate recipients.
General mitigation guidance
Effective mitigation centers on enforcing strict, user-centric authorization for all object-level operations in the friendship system:
- Implement ownership/participation checks in the
respond_request()handler so that only the requester or intended recipient of a friendship can modify its state. - Derive target objects through the authenticated user context (e.g., "select friendship where id = X AND user is participant") instead of trusting raw identifiers from the client.
- Apply a consistent authorization layer or middleware that validates access to domain entities (friendships, messages, profiles) before performing updates.
- Use clear authorization models (e.g., role- and relationship-based access control) to specify who can perform which action on which object.
- Fail securely by default: when ownership or participation cannot be proven, deny the operation and avoid leaking details about the resource.
- Minimize exposure of internal identifiers where possible, or pair them with unguessable tokens to reduce enumeration risk—while still enforcing full authorization checks.
How teams detect issues like this
Detecting similar issues involves both preventive and detective controls:
- Static analysis and code scanning: Flag endpoints that:
- Update or delete records based solely on client-supplied identifiers.
- Lack explicit authorization checks tying resources to the current user or role.
- Code review practices: During review of controller/router logic:
- Verify that every handler touching user-linked resources includes ownership or relationship checks.
- Look for direct ORM calls like
get(id=...)immediately followed by updates, without additional filters on the authenticated user. - Security testing: Use targeted access control tests and automated API fuzzing to:
- Attempt cross-user actions by reusing identifiers from one account in another.
- Confirm that operations on friendships fail when initiated by non-participants.
- Policy enforcement: Incorporate security guidelines into development standards and CI checks, requiring explicit authorization steps for any endpoint that accepts resource identifiers from clients.

