Bypass of image rewriting / tracking blocker via srcset
Hey's email client rewrites image URLs to block tracking pixels, but the srcset attribute was not rewritten. An attacker could send an email with a crafted srcset to make the victim's browser request an attacker-controlled server, leaking the victim's IP address.
- Triaged in 4 hours
- Fixed in 5 days
- Paid in 4 hours
- Disclosed after 35 days
CVSS
Medium 4.7 CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:C/C:N/I:L/A:N
Description
One of the security features of Hey is blocking of tracking pixels to preserve users privacy.
As such, img tags and similar are rewritten by the app to point to gopher.hey.com. However, an attacker can bypass this filter via the srcset attribute.
POC
Send an email with the following code to the victim, where example.com is an attacker-controlled tracking server. The HTML code can for example be sent via thunderbird by clicking insert -> HTML.
<!DOCTYPE html SYSTEM "https://example.com/log?doctype">
<html xmlns="http://www.w3.org/1999/xhtml" manifest="https://example.com/log?html-manifest">
<head profile="https://example.com/log?head-profile">
</head>
<body>
<picture>
<img srcset="https://example.com/log?picture-img-srcset">
</picture>
<img srcset=",,,,,https://example.com/log?img-srcset">
</body>
</html>
Open the incoming email in https://app.hey.com. The page will look like this:
<html style="[...]"><head>
<meta charset="UTF-8">
<style>
[...]
</style>
<style>@import url("https://production.haystack-assets.com/assets/message_content-1f242d41450daac108bc715557eebc198d06b738e4e50d3f1005cba03d186861.css");</style>
</head><body><div class="message-content-inner"><div class="trix-content">
<div class="__body">
<p>
<img srcset="https://example.com/log?picture-img-srcset">
<img srcset=",,,,,https://example.com/log?img-srcset">
testtest
</p>
</div>
</div>
</div></body></html>
It can be seen that the srcset attribute was not rewritten & a request will have been sent to the tracking server directly from the victim users browser.
Impact
bypass of the img URL rewriting which prevents tracking scripts from gathering users IP addresses
Context
Hey is an email service, and one of its advertised security features is the blocking of tracking pixels to protect users' privacy. When a message is rendered in the web app, img tags and similar elements are rewritten by the application so that they point to gopher.hey.com instead of the original remote host. That way the remote server never sees the recipient's browser make the request directly.
The report targets the web app at https://app.hey.com, on the *.hey.com asset, and shows that the rewriting can be bypassed through the srcset attribute.
Setup
No special accounts, roles or tooling are described. The only precondition is the ability to send an HTML email to a victim who opens it in https://app.hey.com. The report notes that the HTML can be composed in Thunderbird, for example, via insert -> HTML. The attacker also needs a server they control to receive the tracking requests; in the proof of concept this is example.com.
Finding it
The researcher knew that Hey rewrites img tags and similar elements to gopher.hey.com as part of its tracking-pixel blocking. The gap is that the rewriting does not cover srcset. Since srcset is a legitimate way to give a browser candidate image URLs, a browser will fetch from it, and if the attribute is left untouched the request goes straight to the attacker's host.
Exploitation
Step 1: Build an HTML email with several candidate vectors
The researcher sends an email containing the following code to the victim, where example.com is an attacker-controlled tracking server:
<!DOCTYPE html SYSTEM "https://example.com/log?doctype">
<html xmlns="http://www.w3.org/1999/xhtml" manifest="https://example.com/log?html-manifest">
<head profile="https://example.com/log?head-profile">
</head>
<body>
<picture>
<img srcset="https://example.com/log?picture-img-srcset">
</picture>
<img srcset=",,,,,https://example.com/log?img-srcset">
</body>
</html>
The payload places remote URLs in several places: the SYSTEM identifier of the doctype, the manifest attribute on html, the profile attribute on head, an img with srcset inside a picture element, and a bare img whose srcset starts with a run of commas before the URL. Each URL carries a distinct query string.
Step 2: Open the email in the web app
The victim opens the incoming email in https://app.hey.com. The rendered page looks like this:
<html style="[...]"><head>
<meta charset="UTF-8">
<style>
[...]
</style>
<style>@import url("https://production.haystack-assets.com/assets/message_content-[redacted].css");</style>
</head><body><div class="message-content-inner"><div class="trix-content">
<div class="__body">
<p>
<img srcset="https://example.com/log?picture-img-srcset">
<img srcset=",,,,,https://example.com/log?img-srcset">
testtest
</p>
</div>
</div>
</div></body></html>
In the rendered output the two img elements still carry their original srcset values pointing at example.com. The srcset attribute was not rewritten, so the browser fetches the candidate URLs directly from the tracking server, from the victim's browser. The report does not state which of the other candidate vectors, if any, produced a request.
Root cause
The rewriting logic that redirects image loads to gopher.hey.com handles src but does not handle srcset. Because srcset is a standard attribute that browsers use to select and load image resources, leaving it in place gives the browser a direct path to the remote host. The existing defence therefore did not cover all the ways an image resource can be referenced.
Impact
The bypass defeats the image URL rewriting that is meant to stop tracking scripts from gathering users' IP addresses. An attacker who can send an email to a Hey user can have the victim's browser contact their server when the message is opened, revealing the request and the IP address it came from. The CVSS vector given is CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:C/C:N/I:L/A:N, scored 4.7 (Medium): network attack, no privileges, user interaction required, scope changed, no confidentiality or availability impact, low integrity impact.
Fix
The report does not describe a fix. The natural remedy, given the root cause, is to apply the same rewriting to srcset (and to any other attribute that can cause the browser to load a remote resource) as is applied to src.
Variants to test
- Put the remote URL in
srcseton a plainimg, as in the second payload element, and check whether the rendered message keeps the attribute. A positive result is an unmodifiedsrcsetin the output and a request arriving at your server. - Put the remote URL in
srcseton animginside apictureelement, as in the first payload element. A positive result is the same: the attribute survives rendering and the browser fetches it. - Try the other resource-bearing attributes used in the payload (
manifestonhtml,profileonhead, the doctypeSYSTEMidentifier) to see whether any of them also survive rendering and trigger a request. - Use distinct query strings per vector, as the researcher did, so you can attribute each incoming request to the element that caused it.
Hunting notes
This kind of bug hides wherever an application sanitises or rewrites HTML for privacy or safety and enumerates attributes by hand. The signal is a feature description that names specific elements (img tags and similar) rather than a general policy, which suggests an allowlist or rewrite list that may be incomplete. To confirm impact, render a message containing several candidate vectors with unique callback URLs and check both the rendered HTML and your server logs: an attribute that survives rendering and produces a request from the victim's browser is the proof. The rendered output shows the untouched srcset, and the report states a request will have been sent to the tracking server.
What happened, in plain words
Hey is an email service. Like most email services, it has to show you pictures that people send you inside their emails. But pictures in emails can be used to spy on you. A sender can put a tiny, invisible image in a message, and when your email app loads that image, the sender's server learns that you opened the message, roughly when you opened it, and the address your computer connected from. This trick is called a tracking pixel, and Hey advertises that it blocks it.
How does Hey block it? When Hey shows you a message, it does not let your browser fetch the picture from the sender's server. Instead, Hey rewrites the image address so that it points at one of Hey's own servers, gopher.hey.com. Hey fetches the picture, and the sender's server only ever sees Hey, not you. Your browser never talks to the sender directly.
The researcher found that the rewriting misses the standard srcset attribute. If a sender puts the tracking address in srcset instead, Hey leaves it alone, and when you open the message your browser goes straight to the sender's server. The privacy protection is bypassed.
The report was rated Medium with a CVSS score of 4.7.
The pieces you need to know
Before the steps make sense, here are the ideas involved, from zero.
- HTML: the language web pages and HTML emails are written in. It is plain text with tags in angle brackets, like
<img>, that tell the browser what to display. - Tag and attribute: a tag is an instruction such as
<img>(show an image). An attribute is a setting inside the tag, written asname="value". For example,<img src="https://example.com/cat.png">has the attributesrcwhose value is the address of the picture. src: the classic attribute that holds the address of an image. The browser downloads whatever is at that address and shows it.srcset: a newer, standard attribute that lets a page offer several candidate image addresses, for example different sizes for different screens. The browser picks one and downloads it. Crucially, a browser will fetch fromsrcsetjust as readily as fromsrc.- Tracking pixel: a tiny or invisible image whose only purpose is to make your browser contact the sender's server, so the sender learns you opened the message and sees your IP address.
- IP address: the number that identifies your connection on the internet, a bit like a return address on an envelope. It can reveal your approximate location and which network you use.
- Rewriting: when a program takes the HTML of an email and changes parts of it before showing it to you. Hey rewrites image addresses so they point at
gopher.hey.cominstead of the sender's server. - Bypass: getting around a protection without breaking it outright. The protection is still there, but it does not cover the path you take.
- Proof of concept (POC): a small, concrete demonstration that a problem is real, not theoretical.
- Query string: the part of a web address after a question mark, such as
?log?img-srcset. It is often used to pass information to a server. Here the researcher uses a different one for each attempt so that, when a request arrives, they can tell which part of the HTML caused it. - CVSS: a standard scoring system for the severity of a security problem. The vector string is a compact code describing the conditions; the number is the resulting score.
Context
Hey is an email service, and one of its advertised security features is blocking tracking pixels to protect users' privacy. When a message is shown in the web app, img tags and similar elements are rewritten by the application so that they point to gopher.hey.com instead of the original remote host. That way the remote server never sees the recipient's browser make the request directly.
The report targets the web app at https://app.hey.com, on the *.hey.com asset, and shows that the rewriting can be bypassed through the srcset attribute.
Setup
No special accounts, roles or tooling are described. The only precondition is the ability to send an HTML email to a victim who opens it in https://app.hey.com. The report notes that the HTML can be composed in Thunderbird, for example, via insert -> HTML. The attacker also needs a server they control to receive the tracking requests; in the proof of concept this is example.com.
In plain terms: you need an email account that can send HTML email (the report mentions Thunderbird, a desktop email program, and its insert -> HTML menu, which lets you paste raw HTML instead of typing a normal message), a victim who opens the message in Hey's web app, and a web server of your own that records incoming requests. example.com stands in for that server throughout the report.
Finding it
The researcher knew that Hey rewrites img tags and similar elements to gopher.hey.com as part of its tracking-pixel blocking. The gap is that the rewriting covers src but not srcset. Since srcset is a legitimate way to give a browser candidate image URLs, a browser will fetch from it, and if the attribute is left untouched the request goes straight to the attacker's host.
Think of it like a mail room that opens every parcel addressed to a certain street and forwards it through its own depot. If someone writes the address in a slightly different but still valid format, the mail room does not recognise it, and the parcel goes straight to the original address. The protection is not broken; it simply does not recognise the second format.
Exploitation
Step 1: Build an HTML email with several candidate vectors
The researcher sends an email containing the following code to the victim, where example.com is an attacker-controlled tracking server:
<!DOCTYPE html SYSTEM "https://example.com/log?doctype">
<html xmlns="http://www.w3.org/1999/xhtml" manifest="https://example.com/log?html-manifest">
<head profile="https://example.com/log?head-profile">
</head>
<body>
<picture>
<img srcset="https://example.com/log?picture-img-srcset">
</picture>
<img srcset=",,,,,https://example.com/log?img-srcset">
</body>
</html>
Line by line, in plain words:
<!DOCTYPE html SYSTEM "https://example.com/log?doctype">declares the document type. TheSYSTEMpart can carry an address; here it points at the attacker's server with the labeldoctype, so if a request arrives with that label, this line caused it.<html ... manifest="https://example.com/log?html-manifest">opens the page. Themanifestattribute is an old way to point at a file describing the page; here it points at the attacker's server with the labelhtml-manifest.<head profile="https://example.com/log?head-profile">opens the head section (the part of the page that holds information about the page rather than visible content). Theprofileattribute is another old address-bearing attribute, labelledhead-profilehere.<picture>opens a picture element, a container that lets a page offer several image options.<img srcset="https://example.com/log?picture-img-srcset">is an image inside that container, with its address insrcsetrather thansrc, labelledpicture-img-srcset.<img srcset=",,,,,https://example.com/log?img-srcset">is a plain image whosesrcsetbegins with a run of commas before the address, labelledimg-srcset. The commas are part of thesrcsetsyntax, which separates candidate entries with commas.- The closing tags simply end the elements opened above.
Why several attempts in one message? The message includes several places that can carry a remote address. Each address carries a distinct label after the question mark, so the attacker's server log shows exactly which one fired. This is a common technique: send many candidates at once, then read the results.
Step 2: Open the email in the web app
The victim opens the incoming email in https://app.hey.com. The rendered page looks like this:
<html style="[...]"><head>
<meta charset="UTF-8">
<style>
[...]
</style>
<style>@import url("https://production.haystack-assets.com/assets/message_content-[redacted].css");</style>
</head><body><div class="message-content-inner"><div class="trix-content">
<div class="__body">
<p>
<img srcset="https://example.com/log?picture-img-srcset">
<img srcset=",,,,,https://example.com/log?img-srcset">
testtest
</p>
</div>
</div>
</div></body></html>
What this shows, in plain words:
- The outer structure (
<html>,<head>,<body>) is Hey's own page, not the sender's. The[...]marks parts the report shortened. - The
<style>blocks are Hey's styling, including a stylesheet loaded fromproduction.haystack-assets.com. These are part of Hey's interface. - Inside the body, the nested
divelements with class names such asmessage-content-innerandtrix-contentare Hey's containers for displaying the message body. - The important part is the
<p>element: the twoimgtags still carry their originalsrcsetvalues pointing atexample.com. Hey did not rewrite them. - The word
testtestis text the researcher added to the message, shown here as part of the rendered body.
Because the srcset attribute was not rewritten, the browser fetches the candidate URLs directly from the tracking server, from the victim's browser. The report does not state which of the other candidate vectors, if any, produced a request.
In other words: when the victim opens the email, their browser contacts the attacker's server. The attacker's log then shows the request and the IP address it came from. That is exactly what the tracking-pixel blocking was supposed to prevent.
Root cause
The rewriting logic that redirects image loads to gopher.hey.com handles src but does not handle srcset. Because srcset is a standard attribute that browsers use to select and load image resources, leaving it in place gives the browser a direct path to the remote host. The existing defence therefore did not cover all the ways an image resource can be referenced.
In everyday terms: the guard was given a list of things to check, and the list was incomplete. Anything not on the list passes through untouched.
Impact
The bypass defeats the image URL rewriting that is meant to stop tracking scripts from gathering users' IP addresses. An attacker who can send an email to a Hey user can have the victim's browser contact their server when the message is opened, revealing the request and the IP address it came from.
The CVSS vector given is CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:C/C:N/I:L/A:N, scored 4.7 (Medium). Read piece by piece, it says:
| Part | Meaning |
|---|---|
AV:N |
Attack vector: network, reachable over the internet |
AC:L |
Attack complexity: low, no special conditions needed |
PR:N |
Privileges required: none, the attacker needs no account on the target |
UI:R |
User interaction: required, the victim must open the email |
S:C |
Scope: changed, the impact reaches beyond the component that was attacked |
C:N |
Confidentiality impact: none |
I:L |
Integrity impact: low |
A:N |
Availability impact: none |
Fix
The report does not describe a fix. The natural remedy, given the root cause, is to apply the same rewriting to srcset (and to any other attribute that can cause the browser to load a remote resource) as is applied to src.
Variants to test
The variations to try:
- Put the remote URL in
srcseton a plainimg, as in the second payload element, and check whether the rendered message keeps the attribute. A positive result is an unmodifiedsrcsetin the output and a request arriving at your server. - Put the remote URL in
srcseton animginside apictureelement, as in the first payload element. A positive result is the same: the attribute survives rendering and the browser fetches it. - Try the other resource-bearing attributes used in the payload (
manifestonhtml,profileonhead, the doctypeSYSTEMidentifier) to see whether any of them also survive rendering and trigger a request. - Use distinct query strings per vector, as the researcher did, so you can attribute each incoming request to the element that caused it.
Hunting notes
This kind of bug hides wherever an application sanitises or rewrites HTML for privacy or safety and enumerates attributes by hand. The signal is a feature description that names specific elements (img tags and similar) rather than a general policy, which suggests an allowlist or rewrite list that may be incomplete. To confirm impact, render a message containing several candidate vectors with unique callback URLs and check both the rendered HTML and your server logs: an attribute that survives rendering and produces a request from the victim's browser is the proof. The report's acceptance rested on exactly that: the rendered output showing the untouched srcset and the resulting direct request to the tracking server.
Glossary
- Attribute: a setting inside an HTML tag, written as
name="value", such assrcorsrcset. - Bounty: a payment made by a company to a researcher who reports a valid security problem.
- Bypass: getting around a protection without breaking it, by taking a path the protection does not cover.
- CVSS: a standard scoring system for the severity of a security problem, expressed as a vector string and a number.
- Disclosure: the public release of a security report, often after the problem has been fixed.
- Doctype: the declaration at the top of an HTML document that states which document type it is; it can carry a
SYSTEMidentifier pointing at an address. - HTML: the language web pages and HTML emails are written in, made of tags in angle brackets.
- IP address: the number identifying a connection on the internet, comparable to a return address.
manifest: an HTML attribute that can point at a file describing a page.picture: an HTML container element that lets a page offer several image options.profile: an HTML attribute on theheadelement that can point at an address describing the document.- Proof of concept (POC): a concrete demonstration that a problem is real.
- Query string: the part of a web address after a question mark, often used to pass information to a server.
- Rewriting: changing parts of an email's HTML before displaying it, for example to redirect image loads.
src: the classic HTML attribute holding the address of an image.srcset: a standard HTML attribute offering one or more candidate image addresses for the browser to choose from.- Tag: an instruction in HTML such as
<img>, written in angle brackets. - Tracking pixel: a tiny or invisible image used to make a recipient's browser contact the sender's server, revealing that the message was opened and from which IP address.
- Vector (CVSS): the compact code describing the conditions of a security problem, from which the score is calculated.