CVE-2026-2512
Received Received - Intake
Stored XSS in WordPress Code Embed Plugin Allows Script Injection

Publication date: 2026-03-18

Last updated on: 2026-03-18

Assigner: Wordfence

Description
The Code Embed plugin for WordPress is vulnerable to Stored Cross-Site Scripting via custom field meta values in all versions up to, and including, 2.5.1. This is due to the plugin's sanitization function `sec_check_post_fields()` only running on the `save_post` hook, while WordPress allows custom fields to be added via the `wp_ajax_add_meta` AJAX endpoint without triggering `save_post`. The `ce_filter()` function then outputs these unsanitized meta values directly into page content without 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.
CVSS Scores
EPSS Scores
Probability:
Percentile:
Meta Information
Published
2026-03-18
Last Modified
2026-03-18
Generated
2026-05-07
AI Q&A
2026-03-18
EPSS Evaluated
2026-05-05
NVD
EUVD
Affected Vendors & Products
Showing 3 associated CPEs
Vendor Product Version / Range
wordfence simple_embed_code to 2.5.1 (inc)
wordfence simple_embed_code 2.5.2
code_embed code_embed to 2.5.1 (inc)
Helpful Resources
Exploitability
CWE
CWE Icon
KEV
KEV Icon
CWE ID Description
CWE-79 The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
Attack-Flow Graph
AI Powered Q&A
Can you explain this vulnerability to me?

The Code Embed plugin for WordPress up to version 2.5.1 is vulnerable to Stored Cross-Site Scripting (XSS) via custom field meta values. This happens because the plugin's sanitization function only runs when a post is saved, but WordPress allows custom fields to be added through an AJAX endpoint without triggering that sanitization. As a result, attackers with Contributor-level access or higher can inject malicious scripts into pages. These scripts execute whenever any user views the infected page.


How can this vulnerability impact me? :

This vulnerability allows authenticated users with Contributor-level access or above to inject arbitrary JavaScript into WordPress pages via custom fields. The injected scripts execute in the browsers of users who visit those pages, potentially leading to session hijacking, defacement, or other malicious actions. Because the vulnerability involves stored XSS, the malicious code persists and affects all visitors to the compromised content.


How does this vulnerability affect compliance with common standards and regulations (like GDPR, HIPAA)?:

I don't know


How can this vulnerability be detected on my network or system? Can you suggest some commands?

This vulnerability involves stored Cross-Site Scripting (XSS) via custom field meta values in the Code Embed WordPress plugin. Detection involves identifying if any custom fields contain unsanitized or malicious scripts injected by authenticated users with Contributor-level access or higher.

Since the vulnerability arises from unsanitized meta values being output in page content, detection can include searching the WordPress database for suspicious or unexpected script tags or HTML in post meta fields related to the plugin.

  • Use SQL queries on the WordPress database to find meta values containing script tags or suspicious HTML in meta keys related to the plugin's embed code prefix.
  • Example SQL command to find suspicious meta values (replace 'embed_key_prefix' with the actual prefix used by the plugin): SELECT post_id, meta_key, meta_value FROM wp_postmeta WHERE meta_key LIKE 'embed_key_prefix%' AND meta_value LIKE '%<script>%';
  • Check WordPress logs or audit plugins for AJAX calls to the 'wp_ajax_add_meta' endpoint that add custom fields without triggering sanitization.

No specific commands or tools are provided in the available resources, but these database queries and log inspections are typical methods to detect such stored XSS vulnerabilities.


What immediate steps should I take to mitigate this vulnerability?

[{'type': 'paragraph', 'content': 'The primary mitigation is to update the Code Embed plugin to version 2.5.2 or later, where the vulnerability has been fixed.'}, {'type': 'paragraph', 'content': 'The fix involves sanitizing all custom field meta values related to code embeds on every write operation, including those done via AJAX and REST API calls, using the WordPress function wp_kses_post() to strip dangerous markup.'}, {'type': 'list_item', 'content': 'Update the plugin to version 2.5.2 or newer where the security patch is implemented.'}, {'type': 'list_item', 'content': "Ensure that only trusted users with the 'unfiltered_html' capability (typically admins or editors) can add or modify embed code meta fields."}, {'type': 'list_item', 'content': 'If immediate update is not possible, restrict Contributor-level and above users from adding custom fields or embedding code until the patch can be applied.'}, {'type': 'paragraph', 'content': 'These steps prevent malicious scripts from being saved and executed by sanitizing input and limiting permissions.'}] [3, 4]


Ask Our AI Assistant
Need more information? Ask your question to get an AI reply (Powered by our expertise)
0/70
EPSS Chart