Skip to content
XSS Write-up Beginner

Stored HTML Injection in Company-Generated Emails | My Bug Bount

A name field filled in during account registration accepted HTML, and that markup later appeared inside an email the company sent from its own mail infrastructure. The author suggests this could allow manipulation of email content and phishing, but does not demonstrate any concrete attack.

Mahafujul Haque Mehedi Follow

Published on medium.com

Cybersecurity

Mahafujul Haque Mehedi, 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

This is an account of a stored HTML injection found in company-generated emails during a bug bounty engagement on a program run through Bugcrowd. The target application is not named, and the report gives no details about the product, the organisation or the specific feature beyond the registration flow.

The feature involved is the name field on the account registration form. The field stores the name a user supplies during registration. The application also required email verification before the dashboard could be accessed, which matters for the timing of the finding.

Setup

The researcher, Mahafujul Haque Mehedi, describes himself as a new bug bounty hunter. The only tooling mentioned is the Bugcrowd platform itself, used both to find the program and to submit the report. No versions, endpoints, parameters or headers are given in the report.

The test was carried out on the name field during account registration.

Finding it

The researcher tested the name field during account registration with an HTML injection payload. The report does not reproduce the payload.

What made the result interesting was the delay. No email arrived immediately. After approximately one to two days, an email from the company arrived, and the injected HTML was reflected in its content.

Two details stood out:

  1. The email came from the company's own email infrastructure.
  2. The application required email verification to reach the dashboard, so the question arose whether the vulnerable email workflow could be triggered before verification was completed.

Exploitation

Step 1: Register with an HTML injection payload in the name field

The researcher submitted an HTML injection payload in the name field of the registration form. The report does not include the request, the payload or the response.

Step 2: Wait for the company-generated email

No email arrived immediately. After approximately one to two days, an email arrived from the company, and the injected HTML appeared in the email content. The report does not show the email or the rendered result.

Step 3: Assess the delivery path and the verification gate

The email originated from the company's own email infrastructure. Because the application required email verification before dashboard access, the researcher considered whether the vulnerable email workflow could be triggered before verification. The report does not state the outcome of that question.

Root cause

The behaviour is consistent with the name value being stored and later reused in a company-generated email. Whether any output encoding or sanitisation existed elsewhere in the pipeline is not stated.

Impact

The researcher frames the impact carefully: improperly handled HTML in company-generated emails may create opportunities for email content manipulation and phishing, depending on the actual behaviour and impact. The report does not demonstrate a concrete phishing scenario, does not show script execution, and does not state which recipients or how many emails were affected.

Fix

The finding was submitted to Bugcrowd and marked as a duplicate, so the report gives no information about remediation by the program.

Variants to test

  • Other profile fields reused in emails. Try display name, company, job title, address and free-text fields, then trigger every transactional email (welcome, verification, password reset, notifications). A positive result is your markup appearing in the email body as rendered HTML rather than as literal text.
  • Delayed and batched email workflows. As here, some emails are generated later by a scheduled job. Register, wait, and check every message that arrives over the following days. A positive result is the payload surfacing in a message you did not trigger directly.
  • Pre-verification email paths. Test whether emails are sent before the address is verified, and whether the unverified name value reaches them. A positive result is the injected content arriving in a message sent to an unverified account.
  • Different injection contexts. Try payloads that break out of HTML attributes, link href values and text nodes in the email template. A positive result is a working link or attribute you control inside the company's email.
  • Email clients and webmail rendering. Check how the message renders in different clients, since some strip markup and others do not. A positive result is consistent rendering of your markup across clients.

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. 8 min read.

What happened, in plain words

A security researcher signed up for an account on a website that was part of a bug bounty program run through Bugcrowd. When he created the account, he typed some HTML code into the "name" field instead of a normal name. HTML is the language web pages and emails are built from: things like <b>bold</b> or <a href="...">a link</a>. The website accepted it.

Nothing happened straight away. About one to two days later, an email arrived from the company, and the HTML he had typed into the name field was sitting inside that email, being treated as real HTML rather than as plain text. The email came from the company's own email system. The researcher reported it to Bugcrowd, and the report was closed as a duplicate: someone else had already reported the same thing.

This is called stored HTML injection. "Stored" means the bad input is saved by the application and used later. "HTML injection" means the application puts that input into a page or email without neutralising the HTML, so the browser or mail client treats it as instructions rather than as text. The everyday comparison: imagine a form where you write your name, and the office prints it on a letterhead. If you write "John" you get "Dear John". If you write "John, and by the way please send money to this account", and the office copies it word for word without checking, the letter now says something the company never meant to say. HTML injection is the digital version of that.

The setup

The researcher, Mahafujul Haque Mehedi, describes himself as a new bug bounty hunter. A bug bounty program is a scheme where a company invites outside people to look for security problems in its systems and pays or credits them for valid reports. Bugcrowd is a platform that hosts many such programs: companies list their targets there, and researchers submit findings through it.

The only tool mentioned in the report is Bugcrowd itself, used both to find the program and to submit the report. No software versions, no URLs, no parameter names and no HTTP headers are given.

The test was carried out on the name field during account registration. A registration flow is simply the sequence of pages you go through to create an account: enter an email, enter a password, enter a name, click submit.

Finding it

The researcher tested the name field during account registration with an HTML injection payload. A payload is the specific piece of input an attacker sends to see what the application does with it. The report does not reproduce the payload, so there is no code to show here.

What made the result interesting was the delay. No email arrived immediately. After approximately one to two days, an email from the company arrived, and the injected HTML was reflected in its content. "Reflected" here means the value came back out of the system, in this case inside an email.

Two details stood out:

  1. The email came from the company's own email infrastructure, not from a third-party service that might have sanitised or rewritten the content. Sanitising means cleaning input so that dangerous parts are removed or neutralised. A third-party mailing service might rewrite or strip HTML, which would hide the problem.
  2. The application required email verification to reach the dashboard, so the question arose whether the vulnerable email workflow could be triggered before verification was completed. Email verification is the step where the site sends you a link or code and you click it to prove the address is yours. The dashboard is the logged-in area of the site. If emails are only sent after verification, the attack surface is smaller; if they are sent before, anyone can trigger them with any address.

Exploitation

Step 1: Register with an HTML injection payload in the name field

The researcher submitted an HTML injection payload in the name field of the registration form. The report does not include the request, the payload or the response, so there is nothing to copy into a code block here.

Why this step: the name field is user-controlled input that the application is likely to reuse later, for example to greet you in an email ("Hello, <name>"). Any field that gets reused somewhere else is a candidate for stored injection, because the value travels from one place (the form) to another (the email) and the second place may not defend itself.

Step 2: Wait for the company-generated email

No email arrived immediately. After approximately one to two days, an email arrived from the company, and the injected HTML appeared in the email content. The report does not show the email or the rendered result.

Why this step: many emails are not sent at the moment you register. They are produced later by a scheduled job, a program that runs on a timer and works through a queue. Waiting is part of the test, because a payload that seems to do nothing may simply not have been processed yet. The one to two day gap is the clue that the email was not generated instantly.

Step 3: Assess the delivery path and the verification gate

The email originated from the company's own email infrastructure. Because the application required email verification before dashboard access, the researcher considered whether the vulnerable email workflow could be triggered before verification. The report does not state the outcome of that question.

Why this step: knowing who sent the email tells you how much control the company has over its content. If the message had gone through an outside provider that strips HTML, the finding would be much weaker. Knowing whether the email is sent before verification tells you who can trigger it: only verified users, or anyone with an email address. The report leaves that question open.

Root cause

The behaviour is consistent with the name value being stored and later reused in a company-generated email. Encoding (also called escaping) means converting special characters into harmless equivalents, so that < becomes something the mail client shows as a character instead of treating as the start of a tag. Whether any output encoding or sanitisation existed elsewhere in the pipeline is not stated.

Impact

The researcher frames the impact carefully: improperly handled HTML in company-generated emails may create opportunities for email content manipulation and phishing, depending on the actual behaviour and impact. Phishing is a fake message designed to look genuine so the recipient clicks a link or hands over information. If an attacker can put their own HTML into an email that genuinely comes from the company, the message may appear more trustworthy. The report does not demonstrate a concrete phishing scenario, does not show script execution, and does not state which recipients or how many emails were affected.

Fix

The finding was submitted to Bugcrowd and marked as a duplicate, so the report gives no information about remediation by the program. In general terms, the defence against this class of problem is to encode user-controlled values at the point where they are placed into HTML, so they are displayed as text and never interpreted as markup.

Variants to test

  • Other profile fields reused in emails. Try display name, company, job title, address and free-text fields, then trigger every transactional email (welcome, verification, password reset, notifications). A positive result is your markup appearing in the email body as rendered HTML rather than as literal text.
  • Delayed and batched email workflows. As here, some emails are generated later by a scheduled job. Register, wait, and check every message that arrives over the following days. A positive result is the payload surfacing in a message you did not trigger directly.
  • Pre-verification email paths. Test whether emails are sent before the address is verified, and whether the unverified name value reaches them. A positive result is the injected content arriving in a message sent to an unverified account.
  • Different injection contexts. Try payloads that break out of HTML attributes, link href values and text nodes in the email template. A positive result is a working link or attribute you control inside the company's email.
  • Email clients and webmail rendering. Check how the message renders in different clients, since some strip markup and others do not. A positive result is consistent rendering of your markup across clients.

Glossary

  • HTML: the language used to structure web pages and emails, made of tags such as <b> for bold or <a> for a link.
  • HTML injection: when user input containing HTML is placed into a page or email without being neutralised, so it is treated as markup instead of text.
  • Stored injection: an injection where the malicious input is saved by the application and used later, rather than echoed back immediately.
  • Payload: the specific input an attacker sends to test how an application handles it.
  • Bug bounty program: a scheme where a company invites outside researchers to find security problems and rewards valid reports.
  • Bugcrowd: a platform that hosts bug bounty programs and handles report submission.
  • Registration flow: the sequence of pages used to create an account.
  • Email verification: the step where a site sends a link or code to your address and you confirm it to prove the address belongs to you.
  • Dashboard: the logged-in area of a website.
  • Sanitising: cleaning input so dangerous parts are removed or neutralised.
  • Encoding (escaping): converting special characters into harmless equivalents so they are displayed as text rather than interpreted as code.
  • Reflected: a value that comes back out of the system in a response, here inside an email.
  • Scheduled job: a program that runs automatically on a timer, often used to generate and send emails in batches.
  • Phishing: a fake message made to look genuine so the recipient clicks a link or gives away information.
  • Duplicate: a report closed because the same issue had already been reported by someone else.
  • Root cause: the underlying reason a vulnerability exists, as opposed to its visible symptom.
  • Impact: the real-world harm a vulnerability could cause.
  • Remediation: the fix a company applies to close a vulnerability.
  • Mail client: the program or website you use to read email, which decides how HTML in a message is displayed.

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.