Vulnerabilities in pkg:gem/spree_api

PACKAGE
Advisory Identifier: GHSA-4825-p4xm-pcf2
Advisory Summary

CVE-2026-94462 is a HIGH (CVSS 7.1) broken access control vulnerability (CWE-639: Authorization Bypass Through User-Controlled Key) affecting Spree libraries in the RubyGems ecosystem. The issue involves broken access control in `patch /api/v3/store/carts/:id/associate` (idor). Remediation is available by upgrading affected packages to version 5.4.4, 5.5.4.

4 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:gem/spree_api

4 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:gem/spree_api. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-4825-p4xm-pcf2 CVE-2026-94462 HIGH Spree: Broken Access Control in `PATCH /api/v3/store/carts/:id/associate` (IDOR)
GHSA-87fh-rc96-6fr6 CVE-2026-25758 HIGH Unauthenticated Spree Commerce users can access all guest addresses
GHSA-g268-72p7-9j6j CVE-2026-22588 MODERATE Spree API has Authenticated Insecure Direct Object Reference (IDOR) via Order Modification
GHSA-m2jr-hmc3-qmpr CVE-2020-26223 HIGH Authorization bypass in Spree

CVE-2026-94462 at a Glance

CVE Identifier CVE-2026-94462
GHSA Identifier GHSA-4825-p4xm-pcf2
Severity HIGH
CVSS v3.1 Base Score 7.1
CWE Classification CWE-639: Authorization Bypass Through User-Controlled Key
Affected Product Spree
Package Ecosystem RubyGems
Published Date
Last Updated

Security Impact

CVSS: 7.1

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:L/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity Low (I:L)
Availability None (A:N)

How to Fix CVE-2026-94462

To remediate this vulnerability, upgrade all affected Spree dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

spree_api fixed: 5.4.4
Upgrade spree_api to 5.4.4
spree_api fixed: 5.5.4
Upgrade spree_api to 5.5.4
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for spree_api

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-94462, inspect your project dependencies for Spree:

inspect dependencies for spree_api

Analyze the terminal output to locate any version of Spree in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 5.4.4), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-639: Authorization Bypass Through User-Controlled Key, where the system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data. In Spree, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

## Summary The Store API v3 endpoint `PATCH /api/v3/store/carts/:id/associate` binds a guest cart to the authenticated caller without verifying possession of that cart. It locates the cart by prefixed ID only — `current_store.carts.where(user: [nil, current_user]).find_by_prefix_id!(params[:id])` — and omits the `authorize!(:update, @cart, cart_token)` check that every other action in the controller performs via `CartResolvable`. Because prefixed IDs are a reversible Sqids encoding of the auto-increment primary key (obfuscation, not a token), an authenticated customer can name arbitrary guest cart IDs, take them over, and read the checkout addresses stored on them. This is broken access control / IDOR, reachable by any low-privilege registered user. ## Severity Requires an authenticated store account and depends on target guest carts already carrying an address and not yet being associated, on a store not running in `login_required` mode. Confidentiality impact is the driver (guest checkout PII); integrity impact is limited and recoverable (cart reassignment + email overwrite on an in-progress cart). Not Critical: the action is gated behind authentication (`PR:L`, not `PR:N`) and constrained by cart state, so it is not anonymously exploitable. ## Details **Root cause:** `associate` skips the cart-possession check its sibling actions enforce and trusts a guessable identifier as the sole locator. **Entry point.** `Spree::Api::V3::Store::CartsController#associate` (`carts_controller.rb:88-96`), guarded only by `prepend_before_action :require_authentication!, only: [:index, :associate]`. That requires the *caller* be authenticated; it does not tie the request to a specific guest cart. ```ruby # spree/api/app/controllers/spree/api/v3/store/carts_controller.rb:88-96 # PATCH /api/v3/store/carts/:id/associate def associate @cart = find_cart_for_association result = Spree.cart_associate_service.call(guest_order: @cart, user: current_user, guest_only: true) if result.success? render_cart else render_service_error(result.error.to_s) end end ``` **Missing check.** `find_cart_for_association` (`carts_controller.rb:177-178`) resolves any guest cart (`user IS NULL`) in the store by ID with no `authorize!(..., cart_token)`. Contrast `CartResolvable#find_cart!`, which binds the token. ```ruby # spree/api/app/controllers/spree/api/v3/store/carts_controller.rb:177-178 def find_cart_for_association current_store.carts.where(user: [nil, current_user]).find_by_prefix_id!(params[:id]) end ``` **Identifier.** `prefixed_id` is `"cart_" + SQIDS.encode([id])` with `SQIDS = Sqids.new(min_length: 10)` (`prefixed_id.rb:17,56`) — default alphabet, no salt, no blocklist. Sqids is non-cryptographic and reversible, so candidate IDs are derivable offline from sequential primary keys. ```ruby # spree/core/app/models/concerns/spree/prefixed_id.rb:17-56 SQIDS = Sqids.new(min_length: 10) def prefixed_id return nil unless id.present? "#{self.class._prefix_id_prefix}_#{Spree::PrefixedId::SQIDS.encode([id])}" end ``` **Data flow.** `Spree.cart_associate_service.call(guest_order: @cart, user: current_user, guest_only: true)` reassigns the owner and overwrites email, preserving existing addresses via `bill_address ||= / ship_address ||=`. `render_cart` then serializes `billing_address`/`shipping_address` (first_name, last_name, address1, address2, city, postal_code, phone, company) back to the caller. ## PoC **Preconditions:** attacker holds an ordinary store account (self-service registration) and the store's publishable key (a front-end credential, present in any headless storefront bundle); one or more guest carts carry checkout addresses; store is not in `login_required` mode. 1. Authenticate: `POST /api/v3/store/auth/login` → attacker JWT. 2. Derive candidate IDs offline: `"cart_" + Sqids.encode([n])` for a range of `n`. 3. For each candidate: `PATCH /api/v3/store/carts/<id>/associate` with the attacker JWT. A hit returns `200` with the victim's `billing_address`/`shipping_address`; non-guest or missing carts return `404`/`422`. ## Impact **Confidentiality:** an authenticated attacker can enumerate guest cart IDs and read checkout PII (name, street, postal code, phone) on carts they don't own. **Integrity:** limited and recoverable — each call reassigns the guest cart and overwrites its email, disrupting the original guest's in-progress cart. Requires a registered account, so not anonymously exploitable. ## Remediation Update to Spree 5.4.4 or 5.5.4. Your storefront, based on https://github.com/spree/storefront, doesn't need any updates because it has always sent a cart token when associating carts; this is a backend issue.

CVE-2026-94462 Affected Spree Versions

2 component(s)
Fixed Versions:
5.4.45.5.4
Product / Package Ecosystem Affected Versions Fixed Version
spree_api
RubyGems
≥ 5.4.0
< 5.4.4
5.4.4
spree_api
RubyGems
≥ 5.5.0
< 5.5.4
5.5.4

References

Frequently Asked Questions

What is CVE-2026-94462?
CVE-2026-94462 is a security vulnerability in Spree involving Broken Access Control in `PATCH /api/v3/store/carts/:id/associate` (IDOR) under CWE-639: Authorization Bypass Through User-Controlled Key.
Which Spree versions are affected?
Affected versions include releases prior to 5.4.4, 5.5.4 across affected packages: spree_api.
What version fixes CVE-2026-94462?
Upgrading to 5.4.4, 5.5.4 (or the latest patched release for your respective branch) resolves the vulnerability.
Is spree_api affected?
Yes, spree_api is affected in releases prior to 5.4.4, 5.5.4. Upgrade your dependency to 5.4.4, 5.5.4 or later.
What is the CVSS score of CVE-2026-94462?
CVE-2026-94462 has a CVSS v3.1 base score of 7.1 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:L/A:N.
What CWE is associated with CVE-2026-94462?
CVE-2026-94462 is classified under CWE-639: Authorization Bypass Through User-Controlled Key (The system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data.).
How can I check RubyGems dependencies for CVE-2026-94462?
Run the dependency tree command: 'inspect dependencies for spree_api'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-4825-p4xm-pcf2",
  "modified" : "2026-09-22T20:40:30Z",
  "published" : "2026-09-22T20:40:30Z",
  "aliases" : [ "CVE-2026-94462" ],
  "summary" : "Spree: Broken Access Control in `PATCH /api/v3/store/carts/:id/associate` (IDOR)",
  "details" : "## Summary\n\nThe Store API v3 endpoint `PATCH /api/v3/store/carts/:id/associate` binds a guest cart to the authenticated caller without verifying possession of that cart. It locates the cart by prefixed ID only — `current_store.carts.where(user: [nil, current_user]).find_by_prefix_id!(params[:id])` — and omits the `authorize!(:update, @cart, cart_token)` check that every other action in the controller performs via `CartResolvable`. Because prefixed IDs are a reversible Sqids encoding of the auto-increment primary key (obfuscation, not a token), an authenticated customer can name arbitrary guest cart IDs, take them over, and read the checkout addresses stored on them. This is broken access control / IDOR, reachable by any low-privilege registered user.\n\n## Severity\n\nRequires an authenticated store account and depends on target guest carts already carrying an address and not yet being associated, on a store not running in `login_required` mode. Confidentiality impact is the driver (guest checkout PII); integrity impact is limited and recoverable (cart reassignment + email overwrite on an in-progress cart). Not Critical: the action is gated behind authentication (`PR:L`, not `PR:N`) and constrained by cart state, so it is not anonymously exploitable.\n\n## Details\n\n**Root cause:** `associate` skips the cart-possession check its sibling actions enforce and trusts a guessable identifier as the sole locator.\n\n**Entry point.** `Spree::Api::V3::Store::CartsController#associate` (`carts_controller.rb:88-96`), guarded only by `prepend_before_action :require_authentication!, only: [:index, :associate]`. That requires the *caller* be authenticated; it does not tie the request to a specific guest cart.\n\n```ruby\n# spree/api/app/controllers/spree/api/v3/store/carts_controller.rb:88-96\n# PATCH /api/v3/store/carts/:id/associate\ndef associate\n  @cart = find_cart_for_association\n\n  result = Spree.cart_associate_service.call(guest_order: @cart, user: current_user, guest_only: true)\n\n  if result.success?\n    render_cart\n  else\n    render_service_error(result.error.to_s)\n  end\nend\n```\n\n**Missing check.** `find_cart_for_association` (`carts_controller.rb:177-178`) resolves any guest cart (`user IS NULL`) in the store by ID with no `authorize!(..., cart_token)`. Contrast `CartResolvable#find_cart!`, which binds the token.\n\n```ruby\n# spree/api/app/controllers/spree/api/v3/store/carts_controller.rb:177-178\ndef find_cart_for_association\n  current_store.carts.where(user: [nil, current_user]).find_by_prefix_id!(params[:id])\nend\n```\n\n**Identifier.** `prefixed_id` is `\"cart_\" + SQIDS.encode([id])` with `SQIDS = Sqids.new(min_length: 10)` (`prefixed_id.rb:17,56`) — default alphabet, no salt, no blocklist. Sqids is non-cryptographic and reversible, so candidate IDs are derivable offline from sequential primary keys.\n\n```ruby\n# spree/core/app/models/concerns/spree/prefixed_id.rb:17-56\nSQIDS = Sqids.new(min_length: 10)\n\ndef prefixed_id\n  return nil unless id.present?\n\n  \"#{self.class._prefix_id_prefix}_#{Spree::PrefixedId::SQIDS.encode([id])}\"\nend\n```\n\n**Data flow.** `Spree.cart_associate_service.call(guest_order: @cart, user: current_user, guest_only: true)` reassigns the owner and overwrites email, preserving existing addresses via `bill_address ||= / ship_address ||=`. `render_cart` then serializes `billing_address`/`shipping_address` (first_name, last_name, address1, address2, city, postal_code, phone, company) back to the caller.\n\n## PoC\n\n**Preconditions:** attacker holds an ordinary store account (self-service registration) and the store's publishable key (a front-end credential, present in any headless storefront bundle); one or more guest carts carry checkout addresses; store is not in `login_required` mode.\n\n1. Authenticate: `POST /api/v3/store/auth/login` → attacker JWT.\n2. Derive candidate IDs offline: `\"cart_\" + Sqids.encode([n])` for a range of `n`.\n3. For each candidate: `PATCH /api/v3/store/carts/<id>/associate` with the attacker JWT. A hit returns `200` with the victim's `billing_address`/`shipping_address`; non-guest or missing carts return `404`/`422`.\n\n## Impact\n\n**Confidentiality:** an authenticated attacker can enumerate guest cart IDs and read checkout PII (name, street, postal code, phone) on carts they don't own. **Integrity:** limited and recoverable — each call reassigns the guest cart and overwrites its email, disrupting the original guest's in-progress cart. Requires a registered account, so not anonymously exploitable.\n\n## Remediation\n\nUpdate to Spree 5.4.4 or 5.5.4. Your storefront, based on https://github.com/spree/storefront, doesn't need any updates because it has always sent a cart token when associating carts; this is a backend issue.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "spree_api"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "5.4.0"
      }, {
        "fixed" : "5.4.4"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "spree_api"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "5.5.0"
      }, {
        "fixed" : "5.5.4"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/spree/spree/security/advisories/GHSA-4825-p4xm-pcf2"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/spree/spree/pull/14314"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/spree/spree/commit/8834230a1f47bb5988f23f45dbd162776cf592bd"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/spree/spree/commit/af0d1a2d582a60d179de65b7d3ea024cb26426a8"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/spree/spree"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/spree/spree/releases/tag/v5.4.4"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/spree/spree/releases/tag/v5.5.4"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-639" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-09-22T20:40:30Z",
    "nvd_published_at" : null
  }
}