Contributor+ Stored CSS Injection
CVSS v3.1 Vector Breakdown
Base Score: 3.5 / 10CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:U/C:L/I:L/A:NSummary
GutenKit Blocks Addon (< 2.5.1) does not validate or escape style settings saved against a post before using them to build inline CSS output on the front end. This allows authenticated users with Contributor role and above to perform Stored CSS Injection attacks affecting other users, administrators, and visitors.
Technical Details & Root Cause
The plugin allows users to attach custom styles to posts and blocks (e.g. via the postBodyCss post meta field or block attributes like blocksCSS). When rendering the page on the frontend, the plugin injects these user-supplied values directly into an inline <style id="gutenkit-frontend-common-inline-css"> element without proper sanitization, validation, or escaping.
GutenKit registers custom post meta fields including postBodyCss and globalClassManagerStyle with show_in_rest => true. In versions prior to 2.5.1, postBodyCss was registered with a regex-based sanitize_css callback that only stripped basic tags, script protocols, and legacy expressions, while leaving standard CSS rules, properties, and selectors intact. Furthermore, classManagerCustomCSS had its sanitization callback misconfigured outside the args array in register_post_meta, leaving it completely unsanitized over the REST API.
Because WordPress core strips direct <style> tags from post content submitted by Contributors (users without unfiltered_html), storing raw CSS through GutenKit’s post meta and block attributes bypasses standard contributor restrictions.
Scope & Impact
- Visual Defacement & Interface Redressing: Contributors can alter page styling, conceal UI elements, or redress portions of the layout for phishing presentations.
- External Resource Loading: Forcing visitor or reviewer browsers to request external resources via
background: url()or@importdeclarations. - Scope Limitations:
- No Script Execution: Arbitrary JavaScript execution is not possible inside inline style tags in modern browsers.
- Draft Quarantine: For users with the Contributor role, injected styles remain confined to drafts and only render when an Editor or Administrator previews that specific post draft. Only published posts (authored by higher-privileged roles) serve the styles to public visitors.
Fixed In
Fixed in version 2.5.1 (2026-08-30) by introducing capability-aware save-time sanitization (sanitize_css_on_save), dropping unprivileged custom CSS unless the author possesses publish_posts capability, and introducing the _gutenkit_css_trusted render trust boundary.