Summary
The /member/orderList API in xmall v1.1 performs insufficient access control on the userId query parameter, allowing attackers to request order data for arbitrary users.
By manipulating this parameter, an attacker can access other customers' order details whenever the API trusts the client-supplied user identifier without proper authorization checks.
Affected context
This vulnerability occurs in xmall v1.1 within the authenticated order management functionality exposed at /member/orderList.
The API appears to rely on a userId value supplied by the client to determine which orders to return, rather than deriving the user identity purely from the authenticated session or token.
In environments where session handling or API authentication is present but not tightly coupled to authorization checks, this design can allow one user to pull order information belonging to others.
Exploit preconditions
- Attack surface: HTTP(S) API endpoint
/member/orderList - Required access: Network access to the xmall application and the ability to invoke the order list API (typically as any logged-in or, in weaker deployments, even unauthenticated user)
- Trigger point: Supplying a crafted or modified
userIdquery parameter when calling/member/orderList - Why exploitation is possible: The backend logic appears to trust the client-provided
userIdwithout performing a robust authorization check that ties requested resources to the caller's authenticated identity, leading to an Insecure Direct Object Reference (IDOR) condition.
Why this happens
At its core, this issue stems from relying on user-controlled identifiers to make authorization decisions.
Instead of using the identity derived from the authenticated session or token, the API reads a userId from the request and uses it directly to query the order store.
This matches CWE-639: Authorization Bypass Through User-Controlled Key, where the application uses a key from the client to access data without confirming that the caller is entitled to that resource.
The insecure pattern is: select orders where user_id = request.userId without checking that request.userId matches the authenticated principal.
Potential impact
- Attackers can view other users' order histories and details.
- Exposure of personal information embedded in order records (names, addresses, contact details, or partial payment data depending on implementation).
- Aggregation of business intelligence, such as customer behavior, purchase frequency, and product popularity, by scraping multiple user IDs.
- Potential regulatory or compliance violations due to leakage of customer data.
General mitigation guidance
Effective mitigation focuses on enforcing server-side authorization tied to the authenticated user, rather than trusting client-supplied identifiers.
Recommended patterns include:
- Derive the effective user identity from the session, token, or API key, and use that identity exclusively for order lookups (e.g., ignore or remove the
userIdparameter for end-user flows). - Implement object-level authorization checks that verify the requesting principal is permitted to access each order record before returning it.
- Centralize authorization logic in reusable middlewares or service layers so resource ownership checks are applied consistently across endpoints.
- Minimize the number of endpoints that accept arbitrary user or account identifiers directly from clients; where necessary (e.g., admin tooling), clearly separate them from normal user APIs and guard them with stronger authorization policies and roles.
- Apply the principle of least privilege by ensuring that non-admin accounts can only ever access their own resources, regardless of request parameters.
How teams detect issues like this
Organizations can identify this class of vulnerability using a combination of review and testing:
- Static analysis and code review:
- Search for controller or service methods that accept user IDs or account IDs as parameters and directly use them in queries (e.g.,
where user_id = param_user_id). - Check that for each such usage, there is an explicit comparison between the requested ID and the authenticated user, or a central authorization call.
- Flag endpoints that expose list or detail operations on sensitive entities (orders, invoices, profiles) without clear authorization logic.
- Dynamic testing:
- During QA or security testing, log in as one user and systematically change IDs in query parameters to see if resources from other users are returned.
- Use automated API testing tools or scripts to iterate over likely userId ranges and observe whether cross-account data is exposed.
- Policy and tooling:
- Enforce patterns where controllers do not directly consume userId from request parameters for end-user operations.
- Integrate security linters or SAST tools that understand authorization frameworks and can flag missing ownership checks around sensitive models.

