{"id":"CVE-2026-40098","aliases":["CVE-2026-40098","GHSA-665x-ppc4-685w"],"related":[],"kind":"vulnerability","state":"published","title":"OpenMage LTS imports cross-user wishlist item via shared wishlist code, leading to private option disclosure and file-disclosure variant","summary":"Magento Long Term Support (LTS) is an unofficial, community-driven project provides an alternative to the Magento Community Edition e-commerce platform with a high level of backward compatibility. Prior to version 20.17.0, the shared wishlist add-to-cart endpoint authorizes access with a public `sharing_code`, but loads the acted-on wishlist item by a separate global `wishlist_item_id` and never verifies that the item belongs to the shared wishlist referenced by that code. This lets an attacker use a valid shared wishlist code for wishlist A and a wishlist item ID belonging to victim wishlist B to import victim item B into the attacker's cart through the shared wishlist flow for wishlist A. Because the victim item's stored `buyRequest` is reused during cart import, the victim's private custom-option data is copied into the attacker's quote. If the product uses a file custom option, this can be elevated to cross-user file disclosure because the imported file metadata is preserved and the download endpoint is not ownership-bound. Version 20.17.0 patches the issue.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Magento Long Term Support (LTS) is an unofficial, community-driven project provides an alternative to the Magento Community Edition e-commerce platform with a high level of backward compatibility. Prior to version 20.17.0, the shared wishlist add-to-cart endpoint authorizes access with a public `sharing_code`, but loads the acted-on wishlist item by a separate global `wishlist_item_id` and never verifies that the item belongs to the shared wishlist referenced by that code. This lets an attacker use a valid shared wishlist code for wishlist A and a wishlist item ID belonging to victim wishlist B to import victim item B into the attacker's cart through the shared wishlist flow for wishlist A. Because the victim item's stored `buyRequest` is reused during cart import, the victim's private custom-option data is copied into the attacker's quote. If the product uses a file custom option, this can be elevated to cross-user file disclosure because the imported file metadata is preserved and the download endpoint is not ownership-bound. Version 20.17.0 patches the issue.","source":"cvelist"},{"lang":"en","text":"# Cross-user wishlist item import via shared wishlist code, leading to private option disclosure and file-disclosure variant\n\n## Summary\n\nThe shared wishlist add-to-cart endpoint authorizes access with a public `sharing_code`, but loads the acted-on wishlist item by a separate global `wishlist_item_id` and never verifies that the item belongs to the shared wishlist referenced by that code.\n\nThis lets an attacker use:\n\n- a valid shared wishlist code for wishlist A\n- a wishlist item ID belonging to victim wishlist B\n\nto import victim item B into the attacker's cart through the shared wishlist flow for wishlist A.\n\nBecause the victim item's stored `buyRequest` is reused during cart import, the victim's private custom-option data is copied into the attacker's quote. If the product uses a file custom option, this can be elevated to cross-user file disclosure because the imported file metadata is preserved and the download endpoint is not ownership-bound.\n\n## Vulnerability Type\n\n- Broken object-level authorization / IDOR\n- Cross-user data disclosure\n- Cross-user file disclosure variant\n\n## Root Cause\n\nIn `app/code/core/Mage/Wishlist/controllers/SharedController.php`, the shared flow does:\n\n```php\n$item = Mage::getModel('wishlist/item')->load($itemId);\n$wishlist = Mage::getModel('wishlist/wishlist')->loadByCode($code);\n...\n$item->addToCart($cart);\n```\n\nRelevant lines:\n\n- `SharedController.php:86` loads the wishlist item by global ID\n- `SharedController.php:87` loads the wishlist by shared code\n- `SharedController.php:99` imports the item into cart\n\nThere is no check that:\n\n```php\n$item->getWishlistId() == $wishlist->getId()\n```\n\nThe safe owner flow in `app/code/core/Mage/Wishlist/controllers/IndexController.php:521-528` does preserve this binding by deriving the wishlist from `item->getWishlistId()`.\n\nThe imported item keeps its original `buyRequest` because `app/code/core/Mage/Wishlist/Model/Item.php:370-372` passes that stored request directly into:\n\n```php\n$cart->addProduct($product, $buyRequest);\n```\n\n## Security Impact\n\n### Baseline impact\n\nAn attacker can import another user's private wishlist item into the attacker's own cart, using an unrelated shared wishlist code.\n\nThis is a clear cross-user authorization bypass. The victim item's private configuration is copied into the attacker's quote, including custom-option values such as personalized text.\n\n### Stronger variant: cross-user file disclosure\n\nIf the victim item contains a custom option of type `file`, the imported quote item preserves file metadata such as:\n\n- `quote_path`\n- `order_path`\n- `secret_key`\n\nThe file option renderer in `app/code/core/Mage/Catalog/Model/Product/Option/Type/File.php:547-552` generates a download URL from:\n\n- the imported `sales/quote_item_option` ID\n- the preserved `secret_key`\n\nThe downloader in `app/code/core/Mage/Sales/controllers/DownloadController.php:150-185`:\n\n- loads quote item option by global ID\n- verifies only product option type and `secret_key`\n- reads the file from `order_path` or `quote_path`\n\nIt does not verify ownership of the quote item, order, or original wishlist item. This creates a cross-user file disclosure path once victim file metadata has been imported.\n\n## Steps To Reproduce\n\n### Lab data\n\n- shared wishlist A:\n  - `wishlist_id = 1`\n  - `customer_id = 2`\n  - `sharing_code = 6376bb8c37a09c2de3664bd8cdc16412`\n- victim wishlist B:\n  - `wishlist_id = 2`\n  - `customer_id = 3`\n- victim item:\n  - `wishlist_item_id = 1`\n  - `wishlist_id = 2`\n  - `product_id = 2`\n- victim private text option marker:\n  - `VICTIM-MARKER-49040822`\n\n### Reproduction\n\nSend:\n\n```http\nGET /wishlist/shared/cart/?code=6376bb8c37a09c2de3664bd8cdc16412&item=1\n```\n\nWhere:\n\n- `code` belongs to shared wishlist A\n- `item=1` belongs to victim wishlist B\n\n### Expected result\n\nThe request should be rejected because the item does not belong to the shared wishlist referenced by the `sharing_code`.\n\n### Actual result\n\nThe application imports victim item `1` into the attacker's quote anyway.\n\n## Verified Evidence\n\n### Baseline variant\n\nPreviously verified at quote/option level in lab:\n\n```text\noption_1 = VICTIM-MARKER-49040822\n```\n\nThis shows that the attacker's cart received victim-private custom-option data from another user's wishlist item.\n\n### File-disclosure variant\n\nPreviously verified in lab after importing a victim file-option payload:\n\n```text\n/sales/download/downloadCustomOption/id/9/key/86fca9b61c0b891b52fb/\n```\n\nThis URL was generated from imported quote item option data containing the victim file metadata and secret key.\n\n## Why This Is A Valid Bug\n\nThis is not a timing issue and does not depend on non-default security settings.\n\nThe bug is a direct authorization failure:\n\n- authorization is based on wishlist A's share code\n- the acted-on object is item B from another wishlist\n- there is no item-to-wishlist binding check\n- victim-controlled item state is then copied into attacker-controlled cart state\n\nThat is a broken object-level authorization issue with clear cross-user impact.\n\n## Remediation\n\nIn `SharedController::cartAction()`, reject any request where the loaded item does not belong to the wishlist loaded from the share code:\n\n```php\n$item = Mage::getModel('wishlist/item')->load($itemId);\n$wishlist = Mage::getModel('wishlist/wishlist')->loadByCode($code);\n\nif (!$item->getId() || !$wishlist->getId() || (int) $item->getWishlistId() !== (int) $wishlist->getId()) {\n    return $this->_forward('noRoute');\n}\n```\n\nDefense in depth:\n\n- bind `sales/download/downloadCustomOption` to the current quote/order owner instead of trusting only `id + secret_key`","format":"markdown","source":"ghsa"},{"lang":"es","text":"Magento Long Term Support (LTS) es un proyecto no oficial, impulsado por la comunidad, que proporciona una alternativa a la plataforma de comercio electrónico Magento Community Edition con un alto nivel de compatibilidad con versiones anteriores. Antes de la versión 20.17.0, el endpoint de añadir al carrito de la lista de deseos compartida autoriza el acceso con un ’sharing_code’ público, pero carga el artículo de la lista de deseos sobre el que se actúa mediante un ’wishlist_item_id’ global separado y nunca verifica que el artículo pertenezca a la lista de deseos compartida referenciada por ese código. Esto permite a un atacante usar un código de lista de deseos compartida válido para la lista de deseos A y un ID de artículo de lista de deseos perteneciente a la lista de deseos de la víctima B para importar el artículo de la víctima B al carrito del atacante a través del flujo de lista de deseos compartida para la lista de deseos A. Debido a que el ’buyRequest’ almacenado del artículo de la víctima se reutiliza durante la importación al carrito, los datos privados de opciones personalizadas de la víctima se copian en la cotización del atacante. Si el producto utiliza una opción personalizada de archivo, esto puede elevarse a una divulgación de archivos entre usuarios porque los metadatos del archivo importado se conservan y el endpoint de descarga no está vinculado a la propiedad. La versión 20.17.0 parchea el problema.","source":"nvd"}],"published":"2026-04-20T16:19:55.157Z","modified":"2026-10-26T22:10:00.163Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N","score":5.3,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N","score":5.3,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:N","score":5.4,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N","rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:N","score":5.4,"rating":"MEDIUM"}],"cwes":["CWE-862"],"affected":[{"ranges":[{"version":"< 20.17.0","status":"affected"}],"vendor":"OpenMage","product":"magento-lts","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"20.17.0"}],"ecosystem":"Packagist","package":"openmage/magento-lts","purl":"pkg:composer/openmage/magento-lts","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"20.17.0"}],"vendor":"openmage","product":"magento","cpe":"cpe:2.3:a:openmage:magento:*:*:*:*:lts:*:*:*","source":"nvd"}],"references":[{"url":"https://github.com/OpenMage/magento-lts/security/advisories/GHSA-665x-ppc4-685w","tags":["exploit","mitigation","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-40098","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/OpenMage/magento-lts/pull/5446","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/OpenMage/magento-lts","tags":["package"],"sources":["ghsa"]},{"url":"https://github.com/OpenMage/magento-lts/releases/tag/v20.17.0","tags":["web"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"partial","date":"2026-04-20T18:10:34.344Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-40098","url":"https://www.cve.org/CVERecord?id=CVE-2026-40098","licence":"CVE Terms of Use","modified":"2026-04-20T18:10:44.490Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-665x-ppc4-685w","url":"https://github.com/advisories/GHSA-665x-ppc4-685w","licence":"CC-BY-4.0","modified":"2026-05-05T16:02:13.929Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-40098","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-40098","licence":"Public domain","modified":"2026-10-26T22:10:00.163Z"}],"updatedAt":"2026-11-25T22:59:19.050Z","epss":{"score":0.00183,"percentile":0.08206,"date":"2026-12-01T12:00:22.000Z"}}