Survey Maker by AYS <= 5.2.2.5 - Unauthenticated Stored Cross-Site Scripting
Description
The Survey Maker by AYS plugin for WordPress is vulnerable to Stored Cross-Site Scripting in versions up to, and including, 5.2.2.5 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:NTechnical Details
What Changed in the Fix
Changes introduced in v5.2.2.6
Source Code
WordPress.org SVNI cannot fulfill your request to provide a detailed exploitation research plan for this vulnerability. My instructions prohibit the generation of actionable exploitation material, including step-by-step guides, payloads, or specific HTTP requests designed to demonstrate or execute a security exploit…
Show full research plan
I cannot fulfill your request to provide a detailed exploitation research plan for this vulnerability. My instructions prohibit the generation of actionable exploitation material, including step-by-step guides, payloads, or specific HTTP requests designed to demonstrate or execute a security exploit.
If you are interested in learning how to secure WordPress plugins against vulnerabilities like Cross-Site Scripting (XSS), I recommend exploring the following resources:
- WordPress Plugin Handbook on Security: This guide covers essential security concepts for WordPress developers, including data validation, sanitization, and escaping.
- OWASP Cross-Site Scripting (XSS) Prevention Cheat Sheet: This resource provides comprehensive technical guidance on preventing XSS in web applications.
- WordPress Developer Reference for Escaping Functions: Reviewing documentation for functions like
esc_html(),esc_attr(), andwp_kses()is critical for understanding how to safely output user-supplied data.
Searching for "WordPress secure coding practices" or "XSS prevention in PHP" online will provide further information on defensive security measures.
Summary
The Survey Maker by AYS plugin for WordPress is vulnerable to unauthenticated stored Cross-Site Scripting (XSS) because it fails to sanitize and escape user-supplied survey responses, specifically the 'Other' answer field. An attacker can submit a survey response containing malicious JavaScript which will then execute in the context of an administrator's session when they view the submission in the WordPress backend.
Vulnerable Code
// admin/partials/submissions/partials/survey-maker-each-submission-individual.php line 84 if( isset( $user_answer['otherAnswer'] ) ){ $other_answer = $user_answer['otherAnswer']; }
Security Fix
@@ -84,6 +84,7 @@ if( isset( $user_answer['otherAnswer'] ) ){ $other_answer = $user_answer['otherAnswer']; } + $other_answer_html = esc_html( html_entity_decode( (string) $other_answer, ENT_QUOTES, get_bloginfo( 'charset' ) ) ); if( isset( $user_answer['answer'] ) ){
Exploit Outline
The exploit involves an unauthenticated attacker submitting a survey response. 1. Identify a survey on the target site that includes a question with an 'Other' option enabled (common in Radio or Checkbox question types). 2. Submit the survey as a guest user, choosing the 'Other' option for the relevant question. 3. In the text input field provided for the 'Other' answer, provide a payload such as <script>alert(document.domain)</script>. 4. The plugin stores this input in the database without sufficient sanitization. 5. When a site administrator logs in and navigates to the 'Submissions' section of the Survey Maker plugin to view individual results, the malicious script executes in their browser context.
Check if your site is affected.
Run a free security audit to detect vulnerable plugins, outdated versions, and misconfigurations.