The Sleeper Agent Bug: How One HTML Payload Lay Hidden for Months to Attack My Inbox ⏳
A name field stored HTML without sanitisation, and months later an email template inserted that stored value into an HTML email without escaping. An attacker could inject a live link and form control into official emails, enabling phishing.
Published on lordofheaven1234.medium.com
When I first started poking around a site I’d signed up for long ago — let’s call it xyz.com — I was in bug-hunting mode. I threw common payloads into every visible input field, especially the Name field, because that’s one of the easiest places developers forget to sanitize properly.
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.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the email template rendered the stored name as raw HTML instead of escaping it, unlike the web UI which encoded it.
Impact
An attacker could place a live link and form control inside official emails, making phishing more convincing; the text notes email clients lack browser CSP protections, so many users could be exposed.
What the attacker needed
A free account; ability to set the Name field; victim receives an official email
The fix
User input should be escaped when rendered into HTML emails, using the template engine's auto-escaping and avoiding raw/safe markers.
How it was found
- Submit a value containing HTML into the Name field and save it.
- Observe the profile page shows the value encoded, with no link or input rendered.
- Wait for an email from the service that inserts the stored name.
- See the injected HTML rendered live in the email.
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 write-up has not been written yet. The Original tab links to the source.
When a website saves what you type and later shows it somewhere else, it must neutralise any code-like characters first. Here the website cleaned the name on the profile page but not when building an email, so the saved HTML came alive in the inbox. That let a crafted name turn into a clickable link inside a trusted message.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.