Summary
A Stock module endpoint in Frappe ERPNext can return Item master records without verifying that the authenticated caller is authorized to read them. Portal users and users without assigned roles may be able to retrieve out-of-scope item data, including costing and purchase rates, by requesting the records.
Affected context
The issue concerns a Stock module endpoint in affected Frappe ERPNext releases that returns Item master records. It becomes risky when the endpoint is reachable by authenticated users but does not enforce record-level read permissions for the requested items. The affected release ranges are ERPNext 13.0.0 before 15.121.4 and 16.x before 16.36.0.
Exploit preconditions
- Attack surface: The Stock module endpoint that returns Item master records
- Required access: An authenticated account; portal users and users with no assigned roles may be able to make requests
- Trigger point: A request naming Item records the caller is not authorized to read
- Why exploitation is possible: The endpoint does not check whether the caller may read the requested records
Why this happens
The endpoint returns records without enforcing authorization against the caller and the requested Items. This is a missing authorization check, mapped to CWE-862: Missing Authorization. The insecure pattern is relying on authentication or endpoint availability without separately verifying permission to access each requested resource.
Potential impact
- Attackers may retrieve Item master records outside their authorized scope
- Exposed records could include costing and purchase rates
- Disclosure could reveal commercially sensitive pricing or inventory information
General mitigation guidance
Defensive patterns focus on enforcing authorization at the point where records are accessed.
- Check the caller's permission to read each requested record, including records named directly in a request
- Apply consistent access-control rules for portal users and users with no assigned roles
- Prefer secure-by-default data access methods that enforce permissions rather than returning records directly
- Minimize the data returned to only fields the caller is permitted to view
- Keep service accounts and application components limited to the privileges they require
How teams detect issues like this
- Review Stock endpoints that accept record identifiers or return Item master data for explicit record-level permission checks
- Use static analysis or code review rules to flag data retrieval paths that bypass authorization helpers
- Test access policies with authenticated users across role and portal-user configurations, including requests for out-of-scope records
- Enforce policy checks in CI and security reviews for endpoints that expose sensitive fields such as costing or purchase rates

