tag and its attributes. This Cyber News was published on www.wordfence.com. Publication date: Tue, 12 Dec 2023 17:43:04 +0000
An example shortcode not sanitized by the wp kses post() function: As there is no HTML tag in this case, the wp kses post() function does not check or sanitize anything.
Developers might reasonably assume that the shortcode attributes are sanitized and secure.
Technical Analysis #1. A general but fictional shortcode will be used to demonstrate a shortcode XSS vulnerability, focusing only on the most important details.
Let's take an example where shortcode attributes are used as HTML attributes.
Let's take a look at an example where the following shortcode is used in the post content: Link Text.
In this case, the class attribute of the shortcode is used and outputted in the class attribute of the HTML tag.
Now, let's take a look at a threat actor that wants to inject malicious web scripts into a post using the plugin's shortcode.
To make the shortcode secure, escape functions must be used.
The above two functions make the shortcode completely secure against Cross-Site Scripting.
Technical Analysis #2. Next, let's look at an example where shortcode attributes are used as JS variable values.
In this blog post, we have detailed Stored Shortcode-Based XSS vulnerabilities within several WordPress repository plugins.
For unpatched plugins that have been closed by the WordPress.org security team, we recommend that WordPress users delete the affected plugin and look for an alternative solution.