Skip to main content
Menu
Advisories

Stored cross-site scripting in Solidus admin customer purchased items

GHSA-G9C8-3MXQ-RPGHPublished Updated GitHub

Description

Impact

Stored cross-site scripting (XSS) in the admin customer "Items Purchased" page. SolidusAdmin::Users::Items::Component (in solidus_admin) builds each row's description from the product name, the variant's option type and option value presentations, and the SKU, then marks the joined string html_safe without escaping any of them. HTML stored in any of those fields, such as <img src=x onerror=...>, executes in the browser of every administrator who opens the Items tab of a customer who has ordered the affected product. No interaction beyond loading the page is needed.

Planting a payload requires a back-office account with product-management or superuser permissions (customers cannot). But the script then runs in the session of whoever views the page, which only requires the read-only UserDisplay permission set and is routine work for senior staff: a product manager with no access to users or orders can run script as a superuser, and from there create admin accounts, change roles or export customer data. Only stores using the new solidus_admin interface are affected; the legacy solidus_backend admin does not have this page.

Patches

Fixed in solidus_admin 0.4.1. All releases from 0.3.0 through 0.4.0 are affected. The component now builds the description with safe_join, so the product name, option text and SKU are escaped and only the <br> and <strong> tags the component generates itself are trusted. The rendered layout is unchanged, and upgrading the gem remediates every affected store with no other changes.

Workarounds

If you cannot upgrade, override the component method to escape its output:

# config/initializers/solidus_admin_user_items_escape.rb
Rails.application.config.to_prepare do
  SolidusAdmin::Users::Items::Component.prepend(
    Module.new do
      private

      def item_name_with_variant_and_sku(item)
        content = []
        content << item.product.name
        content << "(#{item.variant.options_text})" if item.variant.option_values.any?
        content << safe_join([tag.strong("#{t("spree.sku")}:"), " ", item.variant.sku]) if item.variant.sku.present?

        content_tag(:div, safe_join(content, tag.br), class: "text-sm")
      end
    end
  )
end

This stops payloads from executing but does not clean existing data — audit spree_products.name, spree_variants.sku, spree_option_types.presentation and spree_option_values.presentation for injected markup and remove it, and limit product-management access to trusted staff.

Credits

TRAORE BADIA JEAN STEPHEN

Affected versions

References

GitHub · solidusio/solidus