Summary
An authorization flaw in a Frappe ERPNext CRM and Support endpoint can expose email communications associated with documents the caller is not permitted to read. An authenticated attacker with a common operational role may also be able to relink those communications away from their original documents by sending crafted requests.
Affected context
The issue affects the CRM and Support module endpoint that returns document Communications in Frappe ERPNext before 15.121.4 and in 16.x before 16.36.0. It becomes relevant where an authenticated user can reach the endpoint but the endpoint does not verify read permission for each requested record.
Exploit preconditions
- Attack surface: The CRM and Support module endpoint that returns document Communications
- Required access: An authenticated account with a common operational role
- Trigger point: A request that names records outside the caller's authorized scope
- Why exploitation is possible: The endpoint returns Communications without checking whether the caller may read the associated documents; crafted requests may also cause communications to be relinked
Why this happens
The endpoint does not enforce authorization checks for the requested documents before returning their associated Communications. This is a missing access control pattern mapped to CWE-862: Missing Authorization: authentication establishes the caller's identity, but the application fails to verify that the caller is allowed to access or change the specific records involved.
Potential impact
- An attacker could read email communications associated with out-of-scope documents.
- Sensitive business information in those communications may be disclosed.
- Communications could be detached from their original documents, affecting record integrity and context.
- The resulting changes may complicate auditing or business workflows.
General mitigation guidance
Defensive patterns focus on enforcing authorization at the resource level for every request.
- Check the caller's permission to read each document before returning associated communications.
- Apply the same authorization checks to operations that change communication-to-document relationships.
- Derive accessible records from the caller's permissions rather than trusting record identifiers supplied by the client.
- Use centralized authorization policies and deny access by default when permission cannot be established.
- Keep service roles and user privileges limited to the records and actions required for their tasks.
How teams detect issues like this
- Review endpoint code for record lookups or relationship changes that occur without resource-level permission checks.
- Use static analysis or code review rules to flag data access paths that accept client-supplied identifiers without authorization enforcement.
- Test access policies with users of different roles and verify that out-of-scope records are denied for both reads and relationship changes.
- Monitor audit logs for requests that reference records outside a user's usual access scope or unexpectedly alter communication associations.
- Enforce review policies requiring authorization checks for every exposed operation on protected records.

