How SPF Checkers Are Unknowingly Exposing Websites to XSS Attacks
SPF record checker tools fetch DNS TXT records and render them as raw HTML without escaping, so an attacker who controls a domain's SPF record can inject JavaScript that executes in the browser of anyone who checks that domain. This could lead to session hijacking, credential theft, redirection, or defacement.
medium.com
Published on medium.com
In recent weeks, I’ve discovered a critical class of vulnerabilities affecting multiple SPF record checker tools across the web — including some belonging to well-known security and hosting companies. These tools, designed to help website owners verify their DNS and email authentication records, often fail to sanitize…
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
The checker tools treat DNS TXT record contents as trusted HTML and insert them into the page without output encoding or escaping.
Impact
An attacker could execute arbitrary script in the browser of anyone using the checker, leading to session hijacking, credential theft, redirection, or defacement, though the text does not confirm which specific defences were present on each affected site.
What the attacker needed
Attacker controls a domain; victim visits the checker and looks up that domain
The fix
The tools should escape or encode all DNS data before rendering it, default to safe output encoding, render SPF data as plain text, add CSP headers, and consider sandboxing public diagnostic tools.
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.
An SPF record is a small piece of text stored in DNS that tells email servers which computers are allowed to send mail for a domain. Anyone who owns a domain can put almost any text in that record, including code. Some websites that look up SPF records display that text directly in the page without cleaning it, so the code runs in the visitor's browser as if the website itself had written it.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.