-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
wontfixThis will not be worked onThis will not be worked on
Description
Vulnerability: Stored Cross-Site Scripting (XSS)
Location: Receipt generation (Web and Email)
Source: Link.custom_receipt field (controllable by product sellers).
Sink:
/app/app/presenters/receipt_presenter/item_info.rb#custom_receipt_noteretrievespurchase.link.custom_receiptand processes it withsimple_formatandRinku.auto_link. Neither sanitizes HTML./app/app/views/customer_mailer/receipt/_item.html.erb:23renders this processed value using<%= raw item_props[:custom_receipt_note] %>.- This partial is included in the receipt email generated by
CustomerMailer.receipt. - The same email content is rendered directly to the browser via
render html: message.html_part.body.raw_source.html_safein/app/app/controllers/purchases_controller.rb:343(thereceiptaction).
Exploitation:
- A seller creates or edits a product.
- In the "Custom Receipt" field for the product, the seller enters an XSS payload, e.g.,
<img src=x onerror=alert('XSS-Receipt')>. - A user purchases this product.
- When the user views the receipt (either the web version at
/purchases/:id/receiptor the email receipt), the malicious script executes.
Impact: Allows sellers to execute arbitrary JavaScript in the context of users viewing receipts for their products. This can lead to session hijacking, phishing, or other attacks against buyers.
Recommendation: Sanitize the custom_receipt content using a robust HTML sanitizer (like Rails' sanitize helper with appropriate configuration) before passing it to simple_format or Rinku.auto_link and before rendering it with raw or html_safe. Ensure only safe HTML tags and attributes are allowed.
Metadata
Metadata
Assignees
Labels
wontfixThis will not be worked onThis will not be worked on