-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
Description
Vulnerability: Stored Cross-Site Scripting (XSS)
Location: Rental Expiration Warning Email
Source: Link.name field (product name, controllable by sellers).
Sink:
- In the
rental_expiration_warningmethod of/app/app/mailers/customer_low_priority_mailer.rb:241, thepurchase.link.nameis interpolated directly into an HTML string. - This entire string is then marked
.html_safeand assigned to the@contentinstance variable. - This
@contentvariable is likely rendered without further escaping in the mailer's view template.
Exploitation:
- A seller creates or edits a product and sets its name to an XSS payload, e.g.,
<img src=x onerror=alert('XSS-RentalWarning')>. - A user rents this product.
- When the rental expiration warning email is generated and sent to the user, the seller's malicious product name is rendered unsanitized, executing the script in the user's email client.
Impact: Allows sellers to execute arbitrary JavaScript in the context of users receiving rental expiration warning emails.
Recommendation: HTML-escape the purchase.link.name before interpolating it into the string. For example: ... rental of #{h(purchase.link.name)} will expire .... Alternatively, ensure @content is escaped in the view template, but escaping at the source (before interpolation) is generally preferred.