As a security researcher, one of the most satisfying finds is a zero-click vulnerability something that executes malicious code the moment a victim loads the page, with no interaction required. Recently, I discovered exactly that: a reflected Cross-Site Scripting (XSS) vulnerability in the search functionality of a public-facing WordPress site.
This wasn’t a stored XSS that persists forever, but a reflected one delivered via a crafted URL. What made it dangerous? The proof-of-concept (PoC) triggered JavaScript execution instantly on page load, turning a simple shared link into a potential phishing or session hijacking vector.
In this write-up, I’ll break down the vulnerability, the payload, why it worked, the impact, and most importantly how developers can prevent it. (The issue was reported responsibly, deemed out-of-scope for the program’s bounty due to it being on the marketing site, but appears to have been fixed shortly after.)
WordPress sites commonly use the ?s= parameter for search queries (e.g., / ?s=keyword). Themes often repopulate the search box on the results page like this:
<input type="search" name="s" value="<?php echo $_GET['s']; ?>">If the input isn’t properly escaped for HTML attributes (using something like esc_attr() in PHP), an attacker can break out of the value attribute and inject new ones.
Many sinks escape text content (like the <h1>Results for “…` heading), but forget the input field itself a classic oversight.
?s=" autofocus onfocus=alert(1) x="Press enter or click to view image in full size
Here’s how it breaks down:
Resulting injected HTML:
<input type="search" value="" autofocus onfocus="alert(1)" x="">Boom: Page loads → input auto-focuses → onfocus triggers → alert(1) pops instantly.
Join Medium for free to get updates from this writer.
No clicks, no hovers pure zero-click.
Reflected XSS is often underrated, but zero-click variants elevate it to high severity.
Finding executable XSS never gets old especially zero-click ones that feel like magic. Shoutout to the team for the quick (implicit) fix and running a program.
If you’re hunting WordPress sites, check those search fields! Happy hunting ! 🚀