Post Blocks & Tools <= 1.3.0 - Authenticated (Author+) Stored Cross-Site Scripting via 'sliderStyle' Block Attribute
Description
The Post Blocks & Tools plugin for WordPress is vulnerable to Stored Cross-Site Scripting via the 'sliderStyle' block attribute in the Posts Slider block in all versions up to, and including, 1.3.0 due to insufficient input sanitization and output escaping on user supplied attributes. This makes it possible for authenticated attackers, with author-level access and above, 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:L/UI:N/S:C/C:L/I:L/A:NTechnical Details
What Changed in the Fix
Changes introduced in v1.3.1
Source Code
WordPress.org SVN# Exploitation Research Plan: CVE-2026-5711 (Post Blocks & Tools <= 1.3.0) ## 1. Vulnerability Summary The **Post Blocks & Tools** plugin for WordPress is vulnerable to **Stored Cross-Site Scripting (XSS)** via the `sliderStyle` attribute of the **Posts Slider** block. In version 1.3.0 and below, t…
Show full research plan
Exploitation Research Plan: CVE-2026-5711 (Post Blocks & Tools <= 1.3.0)
1. Vulnerability Summary
The Post Blocks & Tools plugin for WordPress is vulnerable to Stored Cross-Site Scripting (XSS) via the sliderStyle attribute of the Posts Slider block. In version 1.3.0 and below, the plugin fails to sanitize this attribute before using it to construct a CSS class name, which is then rendered on the page. Since authors can create posts and define block attributes, an authenticated attacker with Author-level permissions can inject arbitrary JavaScript that executes in the context of any user viewing the affected post.
2. Attack Vector Analysis
- Endpoint: WordPress REST API
POST /wp-json/wp/v2/posts(or the Gutenberg editor). - Authentication: Author-level or higher (
edit_postscapability). - Vulnerable Attribute:
sliderStylewithin thebnm-blocks/posts-sliderblock. - Payload Carry: The payload is embedded in the JSON-encoded block attributes within the post content.
- Preconditions: The plugin
bnm-blocksmust be active, and an attacker must have credentials for an Author-level account.
3. Code Flow
- Entry Point: A user saves a post containing a
bnm-blocks/posts-sliderblock. The block's attributes are stored as a JSON comment in `
Summary
The Post Blocks & Tools plugin for WordPress is vulnerable to Stored Cross-Site Scripting (XSS) via various block attributes such as 'sliderStyle', 'sectionHeaderStyle', and 'columns'. This occurs because version 1.3.0 and below fail to sanitize or escape these attributes before including them in HTML class names on the frontend, allowing authenticated authors to inject malicious JavaScript into posts.
Vulnerable Code
// src/blocks/posts/slider/view.php line 207 $slider_style_class = 'bnm-sw-' . $attributes['sliderStyle']; $classes = array( 'wpbnmposw', 'bnmbcs', $slider_style_class ); // ... if ( $attributes['sectionHeaderStyle'] ) { $classes[] = 'bnm-bhs-' . $attributes['sectionHeaderStyle']; } --- // src/blocks/posts/posts-ultra/view.php line 173 if ( isset( $attributes['columns'] ) && 'grid' === $attributes['postLayout'] ) { $classes[] = 'columns-' . $attributes['columns']; } if ( $attributes['showFeaturedImage'] && isset( $attributes['imagePosition'] ) ) { $classes[] = 'image-align' . $attributes['imagePosition']; } if ( $attributes['textAlign'] ) { $classes[] = 'has-text-align' . $attributes['textAlign']; } // ... if ( $attributes['sectionHeaderStyle'] ) { $classes[] = 'bnm-bhs-' . $attributes['sectionHeaderStyle']; }
Security Fix
@@ -34,28 +34,30 @@ $article_query = new WP_Query( $post_query_args ); $slider_style = isset( $attributes['sliderStyle'] ) ? $attributes['sliderStyle'] : 'style-1'; - $slides_per_view = isset( $attributes['slidesPerView'] ) ? $attributes['slidesPerView'] : 1; - $asepec_ratio = isset( $attributes['aspectRatio'] ) ? $attributes['aspectRatio'] : 0.5625; - $space_between_slides = isset( $attributes['spaceBetweenSlides'] ) ? $attributes['spaceBetweenSlides'] : 20; - $autoplay = isset( $attributes['autoplay'] ) ? $attributes['autoplay'] : false; + $slides_per_view = isset( $attributes['slidesPerView'] ) ? (int) $attributes['slidesPerView'] : 1; + $asepect_ratio = isset( $attributes['aspectRatio'] ) ? (float) $attributes['aspectRatio'] : 0.5625; + $space_between_slides = isset( $attributes['spaceBetweenSlides'] ) ? (int) $attributes['spaceBetweenSlides'] : 20; + $autoplay = isset( $attributes['autoplay'] ) ? (bool) $attributes['autoplay'] : false; $delay = isset( $attributes['delay'] ) ? absint( $attributes['delay'] ) : 5; $featured_image_slug = ! empty( $attributes['featuredImageSizeSlug'] ) ? $attributes['featuredImageSizeSlug'] : ''; $slider_thumb_size = ! empty( $attributes['slideThumbSize'] ) ? $attributes['slideThumbSize'] : ''; $image_fit = ! empty( $attributes['imageFit'] ) ? $attributes['imageFit'] : 'cover'; - $thumbSlidesPerView = isset( $attributes['thumbSlidesPerView'] ) ? $attributes['thumbSlidesPerView'] : 5; - $slide_image_class = "image-fit-{$image_fit}"; + $thumbSlidesPerView = isset( $attributes['thumbSlidesPerView'] ) ? (int) $attributes['thumbSlidesPerView'] : 5; + $slide_image_class = sanitize_html_class( 'image-fit-'. $image_fit ); @@ -205,13 +207,13 @@ $slider_block = ob_get_clean(); // Slider style class name. - $slider_style_class = 'bnm-sw-' . $attributes['sliderStyle']; + $slider_style_class = sanitize_html_class( 'bnm-sw-' . $attributes['sliderStyle'] ); $classes = array( 'wpbnmposw', 'bnmbcs', $slider_style_class ); if ( $attributes['categoryBGColor'] || $attributes['categoryBGHoverColor'] || ! empty($attributes['categoryPadding']) ) { $classes[] = 'bnm-box-cat'; } if ( $attributes['sectionHeaderStyle'] ) { - $classes[] = 'bnm-bhs-' . $attributes['sectionHeaderStyle']; + $classes[] = sanitize_html_class( 'bnm-bhs-' . $attributes['sectionHeaderStyle'] ); }
Exploit Outline
The exploit requires an attacker with Author-level permissions. 1. Authenticate to the WordPress dashboard as an Author. 2. Create a new post or edit an existing one. 3. Insert a block belonging to the plugin, such as the 'Posts Slider' block (`bnm-blocks/posts-slider`). 4. Switch to the 'Code Editor' view in Gutenberg. 5. Locate the JSON comment for the block and inject an XSS payload into the 'sliderStyle' attribute (e.g., `"sliderStyle":"\"><script>alert(1)</script>"`). 6. Save and publish the post. 7. When any user views the post, the script will execute because the payload breaks out of the HTML class attribute and injects a script tag.
Check if your site is affected.
Run a free security audit to detect vulnerable plugins, outdated versions, and misconfigurations.