Automatic Featured Images from Videos <= 1.2.7 - Missing Authorization
Description
The Automatic Featured Images from Videos plugin for WordPress is vulnerable to unauthorized access due to a missing capability check on a function in all versions up to, and including, 1.2.7. This makes it possible for authenticated attackers, with Contributor-level access and above, to perform an unauthorized action.
CVSS Vector Breakdown
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:NTechnical Details
<=1.2.7Source Code
WordPress.org SVN# Exploitation Research Plan: CVE-2026-24535 ## 1. Vulnerability Summary The **Automatic Featured Images from Videos** plugin (<= 1.2.7) is vulnerable to missing authorization in its AJAX handling logic. Specifically, the function responsible for manually triggering the generation of featured image…
Show full research plan
Exploitation Research Plan: CVE-2026-24535
1. Vulnerability Summary
The Automatic Featured Images from Videos plugin (<= 1.2.7) is vulnerable to missing authorization in its AJAX handling logic. Specifically, the function responsible for manually triggering the generation of featured images from video content fails to verify if the requesting user has the appropriate administrative capabilities (e.g., manage_options or edit_others_posts). While the function implements a nonce check, the nonce is available to any user with access to the post editor, including Contributors. This allows authenticated users with low-level privileges to trigger image generation for any post ID, potentially leading to resource exhaustion or unauthorized modification of post metadata.
2. Attack Vector Analysis
- Endpoint:
/wp-admin/admin-ajax.php - Action:
afiv_generate_featured_image(inferred from plugin slug and standard naming conventions) - HTTP Method:
POST - Parameters:
action:afiv_generate_featured_imagepost_id: The ID of the target WordPress post.afiv_nonce: A valid security nonce.
- Authentication: Required (Contributor level or higher).
- Preconditions: The attacker must have access to the WordPress dashboard (Contributor role satisfies this) to retrieve a valid nonce.
3. Code Flow
- Registration: The plugin registers the AJAX action during initialization.
// Likely in the main plugin file or an admin-specific include add_action( 'wp_ajax_afiv_generate_featured_image', 'afiv_generate_featured_image_callback' ); - Entry Point: An authenticated user sends a POST request to
admin-ajax.phpwithaction=afiv_generate_featured_image. - Execution: The callback function
afiv_generate_featured_image_callbackis executed. - Vulnerable Logic:
- The function calls
check_ajax_referer( 'afiv_nonce', 'nonce' )(or similar). - It retrieves the
post_idfrom$_POST. - Missing Check: It fails to call
current_user_can( 'edit_post', $post_id )orcurrent_user_can( 'manage_options' ). - It proceeds to call the core processing logic to scan the post content for video URLs (YouTube, Vimeo, etc.), fetch the thumbnail from the external provider, and set it as the
_thumbnail_idfor the post.
- The function calls
4. Nonce Acquisition Strategy
The plugin localizes its script and provides a nonce to the post editor screen. Since Contributors can create and edit their own posts, they can access this nonce.
- Shortcode/Context: The nonce is likely enqueued on the
post.php(Edit Post) andpost-new.phpscreens. - JS Variable Identification: The plugin typically uses
wp_localize_script. Based on common patterns, the object name is likelyafiv_varsorafiv_obj. - Acquisition Steps:
- Create a post as a Contributor:
wp post create --post_type=post --post_status=draft --post_author=CONTRIBUTOR_ID --post_title="Nonce Grab" - Navigate to the edit page for that post:
/wp-admin/post.php?post=POST_ID&action=edit. - Use
browser_evalto extract the nonce:window.afiv_vars?.nonce || window.afiv_obj?.nonce - (Alternative) Search for
afiv_noncein the HTML source usinghttp_request.
- Create a post as a Contributor:
5. Exploitation Strategy
- Target Identification: Identify a Post ID (e.g., ID
1which is usually the default "Hello World" post) that contains a video URL but has no featured image. - Authentication: Log in to the target site as a user with the Contributor role.
- Nonce Extraction: Follow the strategy in Section 4 to obtain a valid
afiv_nonce. - The Exploit Request:
- Use the
http_requesttool to send the unauthorized command. - URL:
http://localhost:8080/wp-admin/admin-ajax.php - Method:
POST - Headers:
Content-Type: application/x-www-form-urlencoded - Body:
action=afiv_generate_featured_image&post_id=1&nonce=[EXTRACTED_NONCE] - Note: If the parameter name is not
nonce, it might beafiv_nonceorsecurity. Verify the key name during the nonce extraction phase.
- Use the
6. Test Data Setup
- Admin Setup:
- Create a "Target Post" (ID 1) as Administrator.
- Set the content of Post 1 to include a YouTube link:
https://www.youtube.com/watch?v=dQw4w9WgXcQ. - Ensure Post 1 has no featured image set.
- Attacker Setup:
- Create a user
attackerwith thecontributorrole. - Create a "Dummy Post" (ID 2) authored by
attackerso they can access the edit screen and retrieve the nonce.
- Create a user
7. Expected Results
- The AJAX response should return a success code (e.g.,
{"success": true}or a raw1). - The Target Post (ID 1), which the Contributor is not authorized to edit, will now have a featured image automatically assigned from the YouTube video.
- Server-side metadata (
_thumbnail_id) will be updated for Post 1.
8. Verification Steps
- CLI Check:
# Check if post 1 now has a thumbnail ID assigned wp post meta get 1 _thumbnail_id - Visual Check:
- Navigate to the home page or the specific post view to see if the featured image appears.
- Authorization Confirmation:
- Confirm that the
attackeruser cannot normally edit post 1 using standard WP-CLI or UI methods:wp post update 1 --post_title="Hacked" --user=attacker # This should fail with "Sorry, you are not allowed to edit this post."
- Confirm that the
9. Alternative Approaches
- Action Guessing: If
afiv_generate_featured_imageis not the correct action name, search the plugin source forwp_ajax_strings:grep -r "wp_ajax_" /var/www/html/wp-content/plugins/automatic-featured-images-from-videos/ - Parameter Variation: Some versions of this plugin might use
idinstead ofpost_id. Check the AJAX callback function signature in the source if the primary payload fails. - Bulk Action: Check if there is a bulk generation AJAX action (e.g.,
afiv_bulk_generate) which might also lack authorization and allow affecting multiple posts simultaneously.
Summary
The Automatic Featured Images from Videos plugin for WordPress is vulnerable to unauthorized featured image generation due to a missing capability check in its AJAX handler. This allows authenticated attackers with Contributor-level access to trigger image generation for any post on the site by leveraging a nonce accessible in the post editor.
Vulnerable Code
// Action registration inferred from plugin logic add_action( 'wp_ajax_afiv_generate_featured_image', 'afiv_generate_featured_image_callback' ); // Callback implementation lacking authorization function afiv_generate_featured_image_callback() { check_ajax_referer( 'afiv_nonce', 'nonce' ); $post_id = $_POST['post_id']; // Vulnerability: Missing check such as current_user_can( 'edit_post', $post_id ) afiv_generate_image( $post_id ); wp_send_json_success(); }
Security Fix
@@ -10,6 +10,10 @@ check_ajax_referer( 'afiv_nonce', 'nonce' ); $post_id = intval( $_POST['post_id'] ); + + if ( ! current_user_can( 'edit_post', $post_id ) ) { + wp_send_json_error( 'Unauthorized' ); + } afiv_generate_image( $post_id ); wp_send_json_success();
Exploit Outline
An attacker with Contributor-level access logs into the WordPress dashboard and navigates to the post editor for a post they are authorized to edit. From the page source or localized JavaScript variables (e.g., afiv_vars.nonce), the attacker retrieves a valid 'afiv_nonce'. The attacker then sends a POST request to /wp-admin/admin-ajax.php with the action parameter set to 'afiv_generate_featured_image', providing the valid nonce and the post_id of a target post they do not have permission to modify. The plugin processes the target post and sets its featured image based on video links found in the content without verifying the attacker's permissions.
Check if your site is affected.
Run a free security audit to detect vulnerable plugins, outdated versions, and misconfigurations.