Skip to content
XSS Disclosed report Beginner

HTML Injection in Contact Form Email Enables Phishing via Legitimate ████████ Infrastructure

The contact form email endpoint inserts the firstName field into the HTML body of a confirmation email without encoding, so an unauthenticated attacker can inject styled anchor tags. The attacker can send branded emails containing phishing links to any recipient address, and the links pass SPF, DKIM and DMARC checks.

tenzai Follow

Originally disclosed on HackerOne

Medium 5.3 View original
  • Triaged in 7 days
  • Fixed in 3 months
  • Disclosed after 4 months

Summary

The contact form email endpoint at POST ████████/contacts/email on ████████ accepts a firstName field that is rendered as raw, unescaped HTML in the body of the transactional confirmation email sent via SendGrid. The email greeting reads "Buongiorno {firstName}" where {firstName} is inserted without HTML entity encoding. This allows an unauthenticated attacker to inject arbitrary HTML elements -- including styled anchor tags posing as legitimate action links -- into ████████-branded emails delivered to any recipient address the attacker specifies.

The <img> tag is stripped by the email pipeline, but <a> tags with inline styles persist and render in email clients. The endpoint requires no authentication, no CAPTCHA, and imposes no rate limiting.

The contact form endpoint accepts a JSON body with email, firstName, lastName, queryType, and message fields. Upon submission, the server sends a transactional confirmation email to the provided email address using a ████████-branded HTML template via SendGrid.

The firstName value is interpolated directly into the email body's greeting line:

Buongiorno {firstName} {lastName},

No HTML entity encoding is applied to firstName before insertion into the text/html email body. This allows injection of arbitrary HTML elements that render in the recipient's email client.

Sanitization Behavior

Payload Rendered in Email
<a href='//evil.test' style='font-weight:bold;color:red'>CLICK</a> Rendered as styled link (href rewritten by SendGrid click tracker, but anchor text and styles preserved)
<b>BOLD</b> Rendered as bold text
<img src=x> Stripped by email pipeline
<script>alert(1)</script> Accepted by API (200), rendering depends on email client
<div style='color:red'>RED</div> Accepted by API (200)

The key finding is that <a> tags with inline styles survive the email pipeline. SendGrid rewrites the href through its click-tracking proxy (u28522215.ct.sendgrid.net/ls/click?...), but the anchor text and CSS styles remain entirely attacker-controlled. The tracking proxy transparently redirects to the attacker's URL on click.

Steps to Reproduce

Step 1: Send contact form with HTML-injected firstName

POST ████████/contacts/email?lang=it HTTP/2
Host: ████████
Content-Type: application/json

{
  "email": "[email protected]",
  "firstName": "<a href='https://attacker.test/phish' style='font-weight:bold;color:red'>APRIRE RIFERIMENTO</a>",
  "lastName": "User",
  "queryType": "OTHER",
  "message": "Richiesta di assistenza tecnica."
}

Response: HTTP 200 (empty body) -- email dispatched.

Step 2: Victim receives ████████-branded email

The recipient receives a legitimate ████████ Direct confirmation email with:

  • From: Essity/████████ via SendGrid infrastructure
  • Subject: "Modulo di conferma della richiesta"
  • Body: Full ████████-branded HTML template with logo, blue header bar, and footer
  • Greeting: "Buongiorno APRIRE RIFERIMENTO User," -- where "APRIRE RIFERIMENTO" is a bold red clickable link pointing to the attacker's URL (via SendGrid click tracking redirect)

The injected link blends seamlessly into the email template, appearing as a legitimate ████████ action item.

Step 3: Victim clicks the injected link

The styled anchor tag looks like a legitimate call-to-action within the ████████ email. Clicking it:

  1. Hits SendGrid's click tracker (u28522215.ct.sendgrid.net/ls/click?...)
  2. Redirects to the attacker's URL (https://attacker.test/phish)
  3. The attacker can present a credential harvesting page or malware download

Proof of Concept

Python
import requests

TARGET = "https://████████████████/contacts/email?lang=it"
VICTIM = "[email protected]"

r = requests.post(TARGET, json={
    "email": VICTIM,
    "firstName": "<a href='https://attacker.test/phish' style='font-weight:bold;color:red'>APRIRE RIFERIMENTO</a>",
    "lastName": "User",
    "queryType": "OTHER",
    "message": "Richiesta di assistenza."
})
print(f"Status: {r.status_code}")  # 200 = email sent

Confirmed Email Rendering

The injected HTML renders in the actual ████████ email template as follows:

  • The ████████ logo and blue header bar display normally
  • The greeting reads: "Buongiorno APRIRE RIFERIMENTO User,"
  • "APRIRE RIFERIMENTO" appears as a bold, red, clickable link
  • The rest of the email (summary section, FAQ links, footer) renders as a standard ████████ communication
  • The email originates from Essity's SendGrid sending infrastructure, passing SPF/DKIM/DMARC validation

The phishing link is visually indistinguishable from a legitimate ████████ action link within the email template.

Impact

  1. Phishing via trusted infrastructure -- the attacker sends emails from Essity's legitimate SendGrid domain, passing all email authentication checks (SPF, DKIM, DMARC). The injected phishing link appears within a genuine ████████-branded template, making it significantly more convincing than a standalone phishing email.

  2. Arbitrary recipient targeting -- the email field accepts any address, allowing the attacker to target any individual. Combined with the lack of authentication and rate limiting, this enables phishing campaigns at scale through Essity's own email infrastructure.

  3. No authentication or CAPTCHA -- the endpoint is completely open. No bearer token, no session, no CAPTCHA, no rate limiting. Automated abuse is trivial.

  4. SendGrid reputation damage -- mass abuse of this endpoint for phishing could damage Essity's SendGrid sending reputation and potentially cause legitimate Essity emails to be flagged as spam.

Recommendations

  1. HTML-encode the firstName field -- apply HTML entity encoding (&lt;, &gt;, &amp;, &quot;) to all user-supplied values before interpolating them into the email HTML template.
  2. Input validation -- reject or strip HTML tags from name fields at the API layer. Names should be alphanumeric with basic punctuation only.
  3. Add CAPTCHA -- require reCAPTCHA or similar challenge on the contact form endpoint to prevent automated abuse.
  4. Rate limiting -- implement per-IP and per-recipient rate limits on the email endpoint to prevent mass phishing campaigns.

The original report as published on HackerOne, by tenzai. 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 server interpolates the firstName value into the HTML email template without HTML entity encoding or input validation.

Impact

An unauthenticated attacker could send branded emails containing phishing links to any recipient, and because the emails pass SPF, DKIM and DMARC, the links appear within a genuine template; the text notes that img tags are stripped but anchor tags survive.

What the attacker needed

No authentication; no CAPTCHA; no rate limiting; attacker specifies recipient email

The fix

The firstName field should be HTML-entity-encoded before interpolation, HTML tags should be rejected at the API layer, and CAPTCHA plus rate limiting should be added.

How it was found

  1. Send a POST request to the contact form email endpoint with a JSON body containing the victim's email address and an HTML anchor tag in the firstName field.
  2. The server responds with HTTP 200 and dispatches a branded confirmation email to the victim.
  3. The victim receives the email, where the injected anchor renders as a styled clickable link.
  4. The victim clicks the link, which goes through SendGrid's click tracker and redirects to the attacker's URL.

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 a website puts user input into a web page or email without cleaning it, the input can be treated as code. Here the contact form's first-name field is placed straight into an HTML email, so someone can type HTML tags that become real links. The attacker uses this to send a genuine-looking company email with a fake link to any address they choose.

What is XSS?

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

More from Essity

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.