Hunting a Zero-Click Reflected XSS: Breaking Out of Attributes in WordPress Search
文章描述了一个零点击反射型跨站脚本(XSS)漏洞,存在于WordPress网站的搜索功能中。攻击者通过构造特殊URL,在页面加载时立即执行恶意代码,无需用户交互。该漏洞利用了搜索输入字段未正确转义HTML属性的特点,注入自定义属性触发即时JavaScript执行。这种漏洞可能导致钓鱼攻击、会话劫持等严重后果。 2026-1-2 05:15:22 Author: infosecwriteups.com(查看原文) 阅读量:2 收藏

Maverick

Source : Google

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.)

The Vulnerability: Attribute Breakout in the Search Input

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.

The Payload: Zero-Click Execution with autofocus + onfocus

?s=" autofocus onfocus=alert(1) x="

Press enter or click to view image in full size

Pwned !!!

Here’s how it breaks down:

  1. The “ closes the value attribute prematurely.
  2. autofocus — a valid HTML attribute that forces the browser to focus the input on page load.
  3. onfocus=alert(1) — an event handler that fires when the input gains focus.
  4. x=” — a dummy attribute to balance the syntax and prevent rendering errors.

Resulting injected HTML:

<input type="search" value="" autofocus onfocus="alert(1)" x="">

Boom: Page loads → input auto-focuses → onfocus triggers → alert(1) pops instantly.

Get Maverick’s stories in your inbox

Join Medium for free to get updates from this writer.

No clicks, no hovers pure zero-click.

Impact: Why This Matters

  • Arbitrary JS execution in the site’s origin.
  • Easy social engineering: “Hey, check this search result on [site]” → victim clicks link → code runs.
  • Potential for:
  • Stealing non-HttpOnly cookies/sessions.
  • Phishing overlays.
  • Keylogging.
  • Defacement (visual changes).
  • Even on a marketing site, it erodes trust and could target partners/customers.

Reflected XSS is often underrated, but zero-click variants elevate it to high severity.

Timeline & Responsible Disclosure

  • Discovered and PoC’d with screenshot evidence.
  • Reported via the company’s bug bounty platform.
  • Triaged as High severity but out-of-scope (program focuses on core product, excludes WordPress marketing site and standard WP issues).
  • No bounty, but that’s fine safety first.

Final Thoughts

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 ! 🚀


文章来源: https://infosecwriteups.com/hunting-a-zero-click-reflected-xss-breaking-out-of-attributes-in-wordpress-search-70071a099dd3?source=rss----7b722bfd1b8d---4
如有侵权请联系:admin#unsafe.sh