Summary
An Insecure Direct Object Reference vulnerability in Bagisto's customer order reorder feature allows an authenticated user to access and reuse another customer's order data by manipulating the order ID parameter.
Under these conditions, an attacker can add items from another customer's order to their own shopping cart, exposing sensitive purchase information and enabling potential fraud.
Affected context
This issue occurs in Bagisto's customer-facing eCommerce flows, specifically in the reorder functionality exposed to authenticated shoppers.
The vulnerability is present when:
- The reorder endpoint accepts an order identifier as input from the client
- Authorization checks verify that the user is logged in, but do not verify ownership of the referenced order
- The server logic relies on the client-supplied order ID for identifying which order to reorder
In such environments, any authenticated customer may be able to reference order records belonging to other customers.
Exploit preconditions
- Attack surface: Web application layer, within the authenticated customer portal.
- Required access: Valid customer account with standard login; no elevated roles needed.
- Trigger point: Invoking the reorder action while modifying the order ID parameter (e.g., in a URL, form field, or API request) to refer to another customer's order.
- Why exploitation is possible: The backend action processes the supplied order ID without enforcing strict ownership checks, leading to a direct reference from user-controlled input to internal order records (an IDOR condition).
Why this happens
The root cause is a missing or incomplete authorization check on a sensitive object—the customer order—after authentication succeeds.
The reorder endpoint appears to:
- Accept an order ID provided by the client
- Look up that order in persistence
- Proceed to copy items from that order into the caller's cart
Without an explicit check that the order belongs to the currently authenticated customer, the system exhibits the core pattern of CWE-639: Authorization Bypass Through User-Controlled Key and relates to CWE-284: Improper Access Control.
Conceptually, the implementation treats knowledge or control of an identifier as proof of authorization, rather than binding access to the authenticated user's own resources.
Potential impact
- Exposure of other customers' purchase details through items and metadata visible in the attacker's cart.
- Ability for an attacker to add products from another customer's order to their own cart, simulating or replaying another user's purchasing choices.
- Facilitation of fraudulent behavior, such as unauthorized use of promotional configurations tied to past orders or misrepresentation of customer activity.
- Erosion of customer trust and potential regulatory or contractual issues due to unauthorized access to order-related data.
General mitigation guidance
Effective mitigation centers on enforcing object-level authorization and reducing reliance on client-controlled identifiers:
- Implement strict ownership checks whenever accessing or mutating order records, binding operations to the authenticated customer's identity.
- Avoid treating the presence or format of an order ID as sufficient for access; always verify that the order belongs to the requesting user.
- Encapsulate authorization logic in reusable server-side policies (e.g., "customer can access this order") instead of duplicating ad-hoc checks.
- Use indirect references where appropriate, such as deriving accessible orders based on the logged-in customer's session rather than arbitrary IDs provided by the client.
- Design endpoints so that they operate on "current user's resources by default" (e.g., fetching the current user's orders from the session context) to minimize exposure of ID-based access patterns.
- Apply the principle of least privilege to customer actions, ensuring features like reorder only work on resources clearly owned by the invoking account.
How teams detect issues like this
Identifying similar access control weaknesses benefits from a combination of review techniques:
- Static analysis and code scanning:
- Flag controller or route handlers that accept identifiers for sensitive objects (orders, invoices, profiles) and access them without associated ownership checks.
- Look for direct ORM calls (e.g.,
Order::find($id)) that are not scoped by the authenticated user (e.g., lack ofwhere('customer_id', auth()->id())or equivalent). - Code review practices:
- Highlight any endpoint where access control is "assumed" due to authentication, but object-level authorization is not explicitly enforced.
- Review all "reorder," "view order," "download invoice," and similar flows for consistent use of centralized authorization policies or guards.
- Security testing and QA workflows:
- Incorporate test cases that change resource IDs in authenticated requests to verify that cross-user access is denied.
- Use automated API testing tools or DAST to systematically fuzz identifiers in authenticated contexts, looking for IDOR patterns.
- Policy enforcement:
- Establish development guidelines requiring an explicit authorization policy for every endpoint dealing with user-specific resources.
- Integrate automated checks in CI/CD that search for known anti-patterns (e.g., raw identifier usage without accompanying authorization calls).

