Meta-box GalleryMeta <= 3.0.1 - Missing Authorization to Authenticated (Author+) Gallery Management
Description
The Meta-box GalleryMeta plugin for WordPress is vulnerable to unauthorized modification of data due to a missing capability check on the 'mb_gallery' custom post type in all versions up to, and including, 3.0.1. This makes it possible for authenticated attackers, with Author-level access and above, to create and publish galleries.
CVSS Vector Breakdown
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:NTechnical Details
<=3.0.1Source Code
WordPress.org SVNThis plan outlines the research and exploitation strategy for **CVE-2026-0687**, a missing authorization vulnerability in the **Meta-box GalleryMeta** plugin. The vulnerability allows users with **Author** roles or higher to manage (create/publish) galleries, which should likely be restricted to hig…
Show full research plan
This plan outlines the research and exploitation strategy for CVE-2026-0687, a missing authorization vulnerability in the Meta-box GalleryMeta plugin. The vulnerability allows users with Author roles or higher to manage (create/publish) galleries, which should likely be restricted to higher-privileged roles (like Editors or Administrators).
1. Vulnerability Summary
The Meta-box GalleryMeta plugin registers a custom post type (CPT) called mb_gallery. The vulnerability arises because the plugin fails to properly restrict the capabilities associated with this CPT. Specifically, it likely omits the capability_type and capabilities parameters in the register_post_type call, or fails to define a custom permission schema. This results in the CPT defaulting to standard post capabilities. Since users with the Author role have the publish_posts capability, they are inadvertently granted the ability to create, edit, and publish mb_gallery objects.
2. Attack Vector Analysis
- Target Endpoint:
- WordPress REST API:
POST /wp-json/wp/v2/mb_gallery(ifshow_in_restis true). - Standard Admin UI:
wp-admin/post-new.php?post_type=mb_gallery.
- WordPress REST API:
- Authentication: Authenticated user with Author role.
- Vulnerable Parameter: The
post_typeitself is accessible to unauthorized roles for publication. - Preconditions: The plugin must be active. An Author account is required.
3. Code Flow (Inferred)
- Initialization: During the
inithook, the plugin callsregister_post_type( 'mb_gallery', $args ). - The Flaw: The
$argsarray likely lacks a restrictivecapability_type(e.g., it is absent or set to'post') and does not setmap_meta_cap => truewith custom mapped capabilities. - Access Control: When a request is made to create a post of type
mb_gallery, WordPress checks if the current user canedit_posts(for drafts) orpublish_posts(for publishing). - Authorization Failure: Because an Author possesses
publish_posts, the check passes for a post type that was intended to be restricted to Administrators.
4. Nonce Acquisition Strategy
If exploiting via the REST API, a REST nonce (wp_rest action) is required. If exploiting via the standard Admin UI, the browser handles nonces automatically.
Method: REST API Nonce
- Identify Localization: WordPress typically localizes the REST nonce in the
wp-apiorwp-utilsscripts, or it is provided by the theme/plugin. - Extraction:
- Navigate to any dashboard page (e.g.,
/wp-admin/index.php) as the Author user. - Use
browser_evalto extract the nonce from thewpApiSettingsobject.
- Navigate to any dashboard page (e.g.,
- JavaScript:
window.wpApiSettings?.nonce
5. Exploitation Strategy
We will demonstrate the vulnerability by using an Author account to publish a new mb_gallery post via the REST API.
Step 1: Authentication
Log in as an Author user using the http_request tool to obtain session cookies.
Step 2: Nonce Extraction
Navigate to the dashboard and extract the wp_rest nonce.
Step 3: Create and Publish Gallery
- Endpoint:
http://localhost:8080/wp-json/wp/v2/mb_gallery - Method:
POST - Headers:
Content-Type: application/jsonX-WP-Nonce: [EXTRACTED_NONCE]
- Payload:
{ "title": "Unauthorized Gallery by Author", "status": "publish", "content": "This gallery was created by an Author user." }
6. Test Data Setup
- Install Plugin: Ensure
meta-box-gallerymeta(v3.0.1 or lower) is installed and active. - Create User: Create a user with the Author role.
wp user create attacker attacker@example.com --role=author --user_pass=password123
- No Existing Galleries: Ensure no galleries exist initially to make verification clear.
wp post delete $(wp post list --post_type=mb_gallery --format=ids) --force(if any exist).
7. Expected Results
- HTTP Response: The REST API should return
201 Created. - Response Body: Should contain the details of the newly created gallery, including
"status": "publish". - Unauthorized Behavior: An Author should normally not be able to publish "Galleries" if they are considered a management/administrative feature of the plugin.
8. Verification Steps
After the HTTP request, verify the post creation via WP-CLI:
- Check Post Count:
wp post list --post_type=mb_gallery
- Verify Author and Status:
wp post list --post_type=mb_gallery --field=post_author --field=post_status- Confirm the
post_authormatches the Author's ID andpost_statusispublish.
9. Alternative Approaches
If the REST API is not enabled for this CPT (show_in_rest => false):
- Standard Admin POST: Use
browser_navigatetowp-admin/post-new.php?post_type=mb_gallery. - Form Submission: Use
browser_evalto fill the title and click the "Publish" button. - Manual POST: Capture the
POSTrequest towp-admin/post.phpmade by the browser and replicate it viahttp_request, ensuring the_wpnonce(for theadd-postaction) is included in the URL-encoded body.
Summary
The Meta-box GalleryMeta plugin fails to properly restrict access to its 'mb_gallery' custom post type, allowing users with Author-level permissions to create and publish galleries. This is due to the custom post type defaulting to standard WordPress post capabilities, which Authors possess by default.
Vulnerable Code
// Inferred registration within the plugin initialization // wp-content/plugins/meta-box-gallerymeta/meta-box-gallerymeta.php register_post_type( 'mb_gallery', array( 'labels' => $labels, 'public' => true, 'show_in_rest' => true, 'supports' => array( 'title', 'editor', 'thumbnail' ), // The vulnerability exists because 'capability_type' defaults to 'post' // and 'map_meta_cap' defaults to null/false, granting Authors standard post permissions. ) );
Security Fix
@@ -10,6 +10,8 @@ 'public' => true, 'show_in_rest' => true, 'supports' => array( 'title', 'editor', 'thumbnail' ), + 'capability_type' => 'mb_gallery', + 'map_meta_cap' => true, ) );
Exploit Outline
The exploit leverages the default behavior of WordPress Custom Post Types (CPTs) when no custom capability schema is defined. 1. Authentication: The attacker authenticates as a user with the 'Author' role (or higher). 2. Nonce Retrieval: The attacker accesses the WordPress dashboard to extract a valid REST API nonce (wp_rest) from the localized 'wpApiSettings' JavaScript object. 3. Endpoint Target: The attacker targets the REST API endpoint for the gallery post type: '/wp-json/wp/v2/mb_gallery'. 4. Payload Delivery: The attacker sends a POST request to the endpoint containing gallery metadata, including 'status': 'publish'. 5. Authorization Bypass: Because the plugin has not defined a specific 'capability_type', WordPress checks if the user has the 'publish_posts' capability. Since Authors possess this capability, the check passes, allowing them to publish 'mb_gallery' objects which should be restricted to Administrators.
Check if your site is affected.
Run a free security audit to detect vulnerable plugins, outdated versions, and misconfigurations.