Skip to content
XSS Write-up Beginner

[VDP] How HTML injection in email got me my first swag! | by SpoopyHost

The name field during signup allowed HTML injection, and the injected HTML was rendered in the welcome email sent to the user. An attacker could use this to include links to malicious sites or phishing content in the email.

medium.com

Published on medium.com

Bug Bounty

Spoopyghost, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 3 min read.

Context

The target is a site the author calls redacted.com, part of an RVDP (a responsible vulnerability disclosure programme). The bug was not fixed at the time of writing, which is why the domain is withheld. The feature involved is the sign-up flow: a new user registers and is asked to fill in personal details such as first name, last name and address. The injected markup later appeared in an email. That email is where the vulnerability appeared.

The author's usual approach on a main domain is to exercise the primary functionality (sign up, sign in, password reset) and to look at the endpoints around contact, newsletter and support forms. This finding came from the sign-up path itself.

Setup

No special tooling is described. The author browsed the site as a normal user, created an account, and used a temporary email address ("temp mail") to receive the registration email. The only precondition is the ability to register and to control the mailbox that receives the confirmation message.

Finding it

After signing up, the site prompted for profile details. The author filled in the required fields and, in the name field, decided to try a basic HTML injection payload rather than plain text. The reasoning is the standard one for stored input that is later rendered elsewhere: a name is data, and if it is placed into an HTML email without encoding, the markup will be interpreted by the mail client.

Exploitation

Step 1: Register and submit the payload in the name field

The author entered the following in the name field during sign-up:

HTML
<img src=”http://evanricafort.com/profile.png”>

This is an image tag pointing at an external host. If the value is placed into the HTML body of the email unencoded, the mail client will fetch and render the image, which proves markup injection.

Step 2: Complete sign-up and reach the dashboard

After submitting, the site redirected the author to the dashboard page. Nothing visible happened there; the payload's effect was expected in the email, not in the application UI.

Step 3: Check the registration email

The author opened the temporary mailbox and found the registration email. The image tag had been rendered: the picture loaded from the external URL, confirming that the name value was inserted into the email as HTML rather than as escaped text. The author describes the payload as having executed successfully in the email.

Step 4: Report

A proof of concept was prepared from the email and sent to the company.

Root cause

The application takes user-supplied profile data (here, the name) and interpolates it into the HTML body of an outgoing email without HTML-encoding it. The email template therefore treats the value as markup. The email rendering path lacked output encoding, so the value was treated as markup.

Impact

Because HTML injection works in the email, an attacker can place links in a message that appears to come from the target's own registration flow, and can trick the recipient into clicking through to an arbitrary site. The author also notes that an attacker could host an XSS page and use the injection for phishing. All of this depends on the victim opening the email and, for the link-based attacks, interacting with the injected content; the author frames the damage as falling on the victim rather than claiming script execution in the mail client.

Fix

The report does not say what change was made, and states that the bug was not fixed at the time of writing. The report does not describe a fix.

Variants to test

  1. Other profile fields that end up in email: last name, address, company, job title. Submit the same image payload in each and check the received message for a rendered image.
  2. Other email-generating features: password reset, contact and support forms, newsletter subscription, invitations. A positive result is the injected tag rendering in the delivered message.
  3. Link injection rather than image injection, for example an anchor tag with attacker-controlled text and destination, to demonstrate the phishing angle directly.
  4. Different mail clients, since rendering rules differ; a payload that is blocked in one client may render in another.
  5. Values that are escaped in the web UI but not in email, which is the pattern seen here: compare the rendered profile page with the rendered email for the same input.

After roughly 10 to 15 days the company replied, thanking the author for the report and offering swag worth $90 as a token of appreciation.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 9 min read.

What happened, in plain words

A security researcher signed up for an account on a website, and when the site asked for his name, he typed a small piece of HTML code instead of a normal name. The site accepted it without complaint. The email the site sent to his inbox contained a working image loaded from an external website, not plain text. That showed the site was placing the name value into its email as HTML without encoding it first. He wrote a report, sent it to the company, and about two weeks later they thanked him and sent him merchandise ("swag") worth $90.

This article walks through that finding from zero. You only need a browser and a computer to follow along.

The target and the feature

The site is referred to as redacted.com. The author hides the real name because the bug was part of an RVDP, a responsible vulnerability disclosure programme, and the issue was not fixed at the time of writing. An RVDP is an arrangement where a company invites people to report security problems to it privately, instead of having those problems exploited or published. Hiding the domain protects the company while it works on a fix.

The feature involved is the sign-up flow. A new user registers, the site asks for personal details such as first name, last name and address, and an email is sent. That email is where the problem showed up.

The author's usual routine on a main domain is to exercise the primary functionality (sign up, sign in, password reset) and to look at the endpoints around contact, newsletter and support forms. An endpoint is simply a specific address on a server that does one job, like a counter in a shop: you go to the sign-up counter to register, the password-reset counter to recover an account, the contact counter to send a message. This finding came from the sign-up path itself, not from one of the side forms.

Setup

No special tooling is described. The author browsed the site as a normal user, created an account, and used a temporary email address ("temp mail") to receive the registration email. A temporary mailbox is a throwaway inbox you can open in a browser tab, read, and abandon; it is useful in testing because you can register many times without cluttering your real inbox, and because you can see exactly what the site sends to a brand-new address. The only precondition is the ability to register and to control the mailbox that receives the confirmation message.

Finding it

After signing up, the site prompted for profile details. The author filled in the required fields and, in the name field, decided to try a basic HTML injection payload rather than plain text.

HTML is the language browsers use to describe a page: tags in angle brackets tell the browser what to display, for example an image, a link or a heading. HTML injection means getting your own tags into a page (or an email) that someone else built, so that the reader's software treats your text as instructions rather than as ordinary words. A useful comparison is a form where you write your name on a line: if the clerk later copies your line onto a printed letter and the printing machine obeys anything written on that line, then writing "draw a picture here" gets a picture drawn, because nobody checked that the line was just a name.

The reasoning is the standard one for stored input that is later rendered elsewhere: a name is data, and if it is placed into an HTML email without encoding, the markup will be interpreted by the mail client. Encoding (or escaping) means converting special characters into harmless stand-ins, so that < becomes something the mail client displays as a character instead of treating as the start of a tag.

Exploitation

Step 1: Register and submit the payload in the name field

The author entered the following in the name field during sign-up:

HTML
<img src=”http://evanricafort.com/profile.png”>

Line by line, in plain words:

  • <img starts an image tag. It tells the software reading the page (here, the mail client) that a picture should be shown.
  • src= is the attribute that says where the picture lives. Think of it as the address written on the back of a photo: the software has to go and fetch the photo from that address.
  • ”http://evanricafort.com/profile.png” is that address, a URL pointing at an external host. The quotes wrap the address so the software knows where it ends.
  • > closes the tag.

So the whole thing means: "show the picture found at this address". If the value is reflected into the HTML body of the email unencoded, the mail client will fetch and render the image, which both proves markup injection and gives the attacker a way to detect that the email was opened. That second part matters: the picture is hosted externally, so the mail client has to fetch it from that address.

Step 2: Complete sign-up and reach the dashboard

After submitting, the site redirected the author to the dashboard page. A dashboard is the logged-in home screen of an account. Nothing visible happened there; the payload's effect was expected in the email, not in the application UI. This is a key idea: the same piece of text can be handled safely in one place and unsafely in another. The web page may show the name as harmless text while the email treats it as code, because the two are built by different parts of the system.

Step 3: Check the registration email

The author opened the temporary mailbox and found the registration email. The image tag had been rendered: the picture loaded from the external URL, confirming that the name value was inserted into the email as HTML rather than as escaped text. The author describes the payload as having executed successfully in the email. In other words, the mail client did what the tag asked and fetched the picture, which is exactly what a browser would do with the same markup on a web page.

Step 4: Report

A proof of concept was prepared from the email and sent to the company. A proof of concept (PoC) is the smallest, clearest demonstration that a problem is real: here, the received email showing the injected image, plus the steps to reproduce it. A good report lets the company repeat your steps and see the same result.

Root cause

The application takes user-supplied profile data (here, the name) and interpolates it into the HTML body of an outgoing email without HTML-encoding it. Interpolating means slotting a value into a template, the way a mail-merge puts a customer's name into a standard letter. The email template therefore treats the value as markup. The email rendering path lacked output encoding, so the value was treated as markup. Validation here means checking input on the server and refusing anything that does not look like a name.

Impact

Because HTML injection works in the email, an attacker can place links in a message that appears to come from the target's own registration flow, and can trick the recipient into clicking through to an arbitrary site. The author also notes that an attacker could host an XSS page and use the injection for phishing. XSS, cross-site scripting, is when an attacker gets their own script to run inside a page a victim trusts; phishing is when a message impersonates a trusted party to push the reader towards a fake page or a harmful action. All of this depends on the victim opening the email and, for the link-based attacks, interacting with the injected content; the author frames the damage as falling on the victim rather than claiming script execution in the mail client. That last point is worth keeping straight: the report demonstrates an image loading, not code running inside the mail program.

Fix

The report does not say what change was made, and states that the bug was not fixed at the time of writing. The report does not describe a fix. In everyday terms: the clerk should copy the name onto the letter as plain letters, not as instructions the printing machine will obey.

Variants to test

If you want to look for the same class of bug yourself, these are directions to consider:

  1. Other profile fields that end up in email: last name, address, company, job title. Submit the same image payload in each and check the received message for a rendered image.
  2. Other email-generating features: password reset, contact and support forms, newsletter subscription, invitations. A positive result is the injected tag rendering in the delivered message.
  3. Link injection rather than image injection, for example an anchor tag with attacker-controlled text and destination, to demonstrate the phishing angle directly. An anchor tag is the HTML element that creates a clickable link.
  4. Different mail clients, since rendering rules differ; a payload that is blocked in one client may render in another.
  5. Values that are escaped in the web UI but not in email, which is the pattern seen here: compare the rendered profile page with the rendered email for the same input.

After roughly 10 to 15 days the company replied, thanking the author for the report and offering swag worth $90 as a token of appreciation.

Glossary

  • HTML: the language of tags in angle brackets that tells a browser (or a mail client) what to display, such as images, links and headings.
  • HTML injection: getting your own HTML tags into a page or email built by someone else, so the reader's software treats your text as instructions.
  • Payload: the specific piece of text or code an attacker submits to test or exploit a weakness.
  • Tag: one instruction in HTML, such as <img ...>, written between angle brackets.
  • Attribute: a setting inside a tag, such as src=, that gives the tag extra information.
  • URL: the address of something on the internet, such as a picture or a page.
  • Encoding (escaping): converting special characters into harmless stand-ins so software displays them as text instead of obeying them.
  • Validation: checking input on the server and refusing values that do not fit what is expected.
  • Interpolation: slotting a value into a template, like a mail-merge filling a name into a standard letter.
  • Endpoint: a specific address on a server that performs one job, such as sign-up or password reset.
  • Sign-up flow: the sequence of pages and emails a new user goes through to create an account.
  • Dashboard: the logged-in home screen of an account.
  • Temp mail: a throwaway email inbox used to receive messages during testing without using a real address.
  • Mail client: the program or web service that displays email, such as the one that opened the registration message.
  • Rendering: the act of a program turning markup into what the user sees, such as fetching and showing an image.
  • Proof of concept (PoC): the smallest, clearest demonstration that a reported problem is real and reproducible.
  • RVDP: a responsible vulnerability disclosure programme, where a company invites private reports of security problems.
  • XSS (cross-site scripting): getting an attacker's script to run inside a page a victim trusts.
  • Phishing: impersonating a trusted party in a message to push the reader towards a fake page or a harmful action.
  • Swag: merchandise given as a reward or thank-you.

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.