Code Embed WordPress Plugin Stored Cross-Site Scripting Vulnerability

Vulnerability

A stored cross-site scripting vulnerability has been identified in the Code Embed plugin for WordPress, affecting all versions through 2.5.1. The issue arises because the plugin's sanitization function, 'sec_check_post_fields()', only activates on the 'save_post' hook. This creates a gap, as WordPress allows custom fields to be added through the 'wp_ajax_add_meta' AJAX endpoint without triggering 'save_post'. Consequently, the 'ce_filter()' function directly outputs these unsanitized custom field values into page content without proper escaping. This vulnerability enables authenticated attackers with Contributor-level access or higher to inject arbitrary scripts into pages, where the scripts will execute when a user views the affected page.

Impact

Exploitation of this vulnerability allows for stored cross-site scripting, where injected scripts are executed in the context of the user viewing the page.

Reproduction

To reproduce this vulnerability, an authenticated user with Contributor-level access or higher can add a custom field meta value through the 'wp_ajax_add_meta' AJAX endpoint. The 'sec_check_post_fields()' sanitization function will not be applied, leaving the injected content unsanitized. Once the custom field is saved, the 'ce_filter()' function will output the injected script into the page content without escaping, allowing the script to execute when the page is accessed.

Remediation

Users are advised to update the Code Embed plugin to version 2.5.2 or later.

Added: Mar 18, 2026, 4:33 PM
Updated: Mar 18, 2026, 4:33 PM

Vulnerability Rating

Custom Algorithm
spread
5.2
impact
1.7
exploitability
6.2
remediation
7.7
relevance
4.1
threat
4.8
urgency
2.9
incentive
0.0

Our algorithm analyzes dozens of metrics to generate these 8 key vulnerability categories, which are then combined to calculate the overall risk score.