CVE-2026-57366

WPAdverts – Classifieds Plugin <= 2.3.1 - Unauthenticated Stored Cross-Site Scripting

highImproper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
7.2
CVSS Score
7.2
CVSS Score
high
Severity
2.3.2
Patched in
7d
Time to patch

Description

The WPAdverts – Classifieds Plugin plugin for WordPress is vulnerable to Stored Cross-Site Scripting in versions up to, and including, 2.3.1 due to insufficient input sanitization and output escaping. This makes it possible for unauthenticated attackers to inject arbitrary web scripts in pages that will execute whenever a user accesses an injected page.

CVSS Vector Breakdown

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:L/A:N
Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
Changed
Low
Confidentiality
Low
Integrity
None
Availability

Technical Details

Affected versions<=2.3.1
PublishedJuly 1, 2026
Last updatedJuly 7, 2026
Affected pluginwpadverts

What Changed in the Fix

Changes introduced in v2.3.2

Loading patch diff...

Source Code

WordPress.org SVN
Research Plan
Unverified

# Exploitation Research Plan: CVE-2026-57366 (WPAdverts Stored XSS) ## 1. Vulnerability Summary The **WPAdverts – Classifieds Plugin** (versions <= 2.3.1) is vulnerable to **unauthenticated stored cross-site scripting (XSS)**. The vulnerability exists within the "Contact Form" add-on, specifically …

Show full research plan

Exploitation Research Plan: CVE-2026-57366 (WPAdverts Stored XSS)

1. Vulnerability Summary

The WPAdverts – Classifieds Plugin (versions <= 2.3.1) is vulnerable to unauthenticated stored cross-site scripting (XSS). The vulnerability exists within the "Contact Form" add-on, specifically in how it renders an advertiser's phone number when the "Reveal phone number on click" setting is enabled.

In addons/contact-form/contact-form.php, the function adext_contact_form() retrieves the adverts_phone meta-value and splits it into two parts. The second part ($ph2) is echoed directly into the data-partial attribute of an <a> tag without any sanitization or escaping (e.g., esc_attr()). An unauthenticated attacker can submit a new advertisement with a malicious phone number containing a script payload, which will execute in the context of any user (including administrators) viewing the advertisement.

2. Attack Vector Analysis

  • Entry Point: The advertisement submission form, typically rendered via the [adverts_add] shortcode.
  • Vulnerable Parameter: adverts_phone (submitted via POST).
  • Sink: addons/contact-form/contact-form.php, line 78 (in version 2.3.1).
  • Authentication: Unauthenticated (if anonymous posting is enabled, which is a common configuration).
  • Preconditions:
    1. The "Contact Form" add-on must be active.
    2. The "Reveal phone number on click" setting must be enabled.
    3. The [adverts_add] shortcode must be accessible to the attacker.

3. Code Flow

  1. Submission:
    • Attacker navigates to the page containing the [adverts_add] shortcode.
    • Attacker submits the form. The Adverts_Form class binds the $_POST data (processed via adverts_request(), which only applies stripslashes_deep).
    • The data is saved to the database via update_post_meta( $post_id, 'adverts_phone', $payload ).
  2. Rendering:
    • A user visits the newly created advertisement page.
    • adext_contact_form( $post_id ) is triggered by the adverts_tpl_single_bottom action hook.
    • $phone = get_post_meta( $post_id, "adverts_phone", true );
    • $ph2 = substr( $phone, 3 ); (Extracts everything after the first 3 characters).
    • Sink: echo $ph2 inside the data-partial attribute:
      <a href="#" class="wpadverts-reveal-final" data-partial="<?php echo $ph2 ?>" style="display: none"></a>
      

4. Nonce Acquisition Strategy

The [adverts_add] form uses a "checksum" system for integrity rather than standard WordPress nonces for the initial form render. These values are required for successful form submission.

  1. Shortcode: The plugin uses [adverts_add].
  2. Setup: Use wp post create to ensure a page with this shortcode exists.
  3. Extraction:
    • Use browser_navigate to visit the [adverts_add] page.
    • Use browser_eval to extract the values from the hidden inputs:
      • _wpadverts_checksum
      • _wpadverts_checksum_nonce
      • _post_id_nonce
    • Alternatively, standard browser-based form filling (browser_type) will handle these automatically.

5. Exploitation Strategy

  1. Prepare Environment: Enable the Contact Form add-on and configure the "reveal" setting.
  2. Submit Payload:
    • Navigate to the [adverts_add] page.
    • Fill out the required fields:
      • post_title: "Vulnerable Ad"
      • post_content: "This is a test ad."
      • adverts_person: "Attacker"
      • adverts_email: "attacker@example.com"
      • adverts_phone: 555"><script>alert(document.domain)</script>
    • Click "Preview" and then "Finish" (or submit the form directly if steps are concatenated).
  3. Trigger XSS:
    • Identify the URL of the created Ad (usually returned in the final step or found via wp post list).
    • Navigate to the Ad URL.
    • The script will execute immediately on page load because the <a> tag with the payload is rendered in the HTML.

6. Test Data Setup

# 1. Enable the Contact Form add-on (usually enabled by adding to active_modules)
# This assumes the plugin handles module loading via this option
wp option update adverts_active_modules '["contact-form"]' --format=json

# 2. Configure Contact Form to reveal phone on click
wp option update adext_contact_form_config '{"show_phone":"1","reveal_on_click":"1","from_name":"","from_email":""}' --format=json

# 3. Ensure anonymous posting is allowed in main config
# (Value depends on plugin version, typically ads_list_default__allow_anonymous)
wp option get adverts_config --format=json > config.json
# Modify config.json to ensure anonymous posting is enabled, then:
# wp option update adverts_config --format=json < config.json

# 4. Create a page for the
Research Findings
Static analysis — not yet PoC-verified

Summary

The WPAdverts plugin is vulnerable to unauthenticated stored Cross-Site Scripting via the advertisement submission form. An attacker can inject malicious scripts into the phone number field which are then executed in the browser of any user viewing the advertisement when the 'Reveal phone number on click' feature is enabled.

Vulnerable Code

// addons/contact-form/contact-form.php line 52
$phone = get_post_meta( $post_id, "adverts_phone", true );

if( $phone ) {
    $ph1 = substr( $phone, 0, 3 );
    $ph2 = substr( $phone, 3 );
}

// ... lines 73-78
<a href="#" class="wpadverts-reveal-button" style="font-weight: normal; font-size:0.9rem"><?php esc_html_e( "show phone", "wpadverts" ) ?></a>
</strong>
<a href="#" class="wpadverts-reveal-final" data-partial="<?php echo $ph2 ?>" style="display: none"></a>

Security Fix

--- addons/contact-form/contact-form.php
+++ addons/contact-form/contact-form.php
@@ -75,7 +75,7 @@
                     ... 
                     <a href="#" class="wpadverts-reveal-button" style="font-weight: normal; font-size:0.9rem"><?php esc_html_e( "show phone", "wpadverts" ) ?></a>
                 </strong>
-                <a href="#" class="wpadverts-reveal-final" data-partial="<?php echo $ph2 ?>" style="display: none"></a>
+                <a href="#" class="wpadverts-reveal-final" data-partial="<?php echo esc_attr( $ph2 ) ?>" style="display: none"></a>
                 <span class="adverts-icon-phone"></span>
             </span>
             <?php else: ?>

Exploit Outline

1. Identify the public advertisement submission page containing the [adverts_add] shortcode. 2. Extract the necessary integrity tokens (_wpadverts_checksum and _wpadverts_checksum_nonce) from the hidden form fields. 3. Submit a new advertisement via a POST request, placing the XSS payload in the 'adverts_phone' parameter (e.g., 555\"><script>alert(document.domain)</script>). 4. Ensure the plugin is configured with the 'Contact Form' add-on active and the 'Reveal phone number on click' setting enabled. 5. Navigate to the permalink of the newly created advertisement. The script will execute automatically because the second part of the phone number payload is rendered directly into a data-attribute without proper attribute escaping.

Check if your site is affected.

Run a free security audit to detect vulnerable plugins, outdated versions, and misconfigurations.