Summary
ERPNext print and portal views may fail to enforce desk users' User Permissions when retrieving customer documents. An authenticated user with an ordinary job role could use crafted requests to read records outside their permitted scope.
Affected context
The issue occurs in ERPNext print and portal views when they retrieve customer documents without applying the requesting desk user's User Permissions. It affects the described ERPNext versions when a user can reach these views and request records that their permissions should exclude.
Exploit preconditions
- Attack surface: ERPNext print and portal views
- Required access: An authenticated desk user; the description indicates an ordinary job role can be sufficient
- Trigger point: A request to view a customer document by record
- Why exploitation is possible: The views do not consistently check the user's permissions against the requested document
Why this happens
The underlying issue is a missing or ineffective authorization check on document access. The views can return customer records without verifying that the requesting user is permitted to access them, which maps to CWE-863: Incorrect Authorization. Authentication alone does not establish authorization for every record.
Potential impact
- Users may read customer documents outside their permitted scope
- Confidential customer or business information could be exposed
- Access-control boundaries between users or customer records may be weakened
General mitigation guidance
Defensive patterns include enforcing authorization at the point where each document is retrieved, including in print and portal views. Apply User Permissions consistently across all access paths, use secure-by-default deny behavior when authorization cannot be confirmed, and minimize the trust placed in record identifiers supplied by requests. Keep application roles and service privileges limited to the access each workflow requires.
How teams detect issues like this
- Review print and portal handlers for document lookups that do not apply the current user's permissions
- Use static analysis or code review checks to flag record retrieval paths without corresponding authorization checks
- Add policy and integration tests confirming users cannot access records excluded by their User Permissions
- Monitor access logs for repeated requests involving records outside a user's expected scope

