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_warning method of /app/app/mailers/customer_low_priority_mailer.rb:241, the purchase.link.name is interpolated directly into an HTML string.
- This entire string is then marked
.html_safe and assigned to the @content instance variable.
- This
@content variable 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.
Vulnerability: Stored Cross-Site Scripting (XSS)
Location: Rental Expiration Warning Email
Source:
Link.namefield (product name, controllable by sellers).Sink:
rental_expiration_warningmethod of/app/app/mailers/customer_low_priority_mailer.rb:241, thepurchase.link.nameis interpolated directly into an HTML string..html_safeand assigned to the@contentinstance variable.@contentvariable is likely rendered without further escaping in the mailer's view template.Exploitation:
<img src=x onerror=alert('XSS-RentalWarning')>.Impact: Allows sellers to execute arbitrary JavaScript in the context of users receiving rental expiration warning emails.
Recommendation: HTML-escape the
purchase.link.namebefore interpolating it into the string. For example:... rental of #{h(purchase.link.name)} will expire .... Alternatively, ensure@contentis escaped in the view template, but escaping at the source (before interpolation) is generally preferred.