REPORT / 01

Analysis Report · Folder Analysis cache/wp-user-frontend_4.2.4 → cache/wp-user-frontend_4.2.5 — CVE-2025-14047

Shared security patch analysis results

mode patchdiff ai claude_cli haiku
02 · Lifecycle actions cancel · resume · skip · regenerate
03 · Share this analysis copy link · embed report
03 · CVE Security Analysis & Writeups ai-generated · per cve

Comprehensive security analysis generated by AI for each confirmed CVE match. Click on a CVE to view the detailed writeup including vulnerability background, technical details, patch analysis, and PoC guide.

CVE-2025-14047 NVD
AI-Generated Analysis
05 · Findings filter · search · paginate
Use quotes for exact: "SQL injection" · Operators: hello AND bye, admin OR root, -error, NOT warning
Showing 0 to 0 of 0 results
includes/Ajax/Frontend_Form_Ajax.php AI: 1 vulnerabilities 1 true positive CVE-2025-14047
--- cache/wp-user-frontend_4.2.4/includes/Ajax/Frontend_Form_Ajax.php	2026-01-03 00:34:06.033697079 +0000+++ cache/wp-user-frontend_4.2.5/includes/Ajax/Frontend_Form_Ajax.php	2026-01-03 00:39:17.140943985 +0000@@ -130,7 +130,40 @@             }         } +        // Attachment deletion authorization check+        $current_user_id = get_current_user_id();+        $post_id_for_edit = isset( $_POST['post_id'] ) ? intval( wp_unslash( $_POST['post_id'] ) ) : 0;+         foreach ( $attachments_to_delete as $attach_id ) {+            $attach_id = absint( $attach_id );++            if ( empty( $attach_id ) ) {+                continue;+            }++            $attachment = get_post( $attach_id );++            // Skip if attachment doesn't exist or is not an attachment+            if ( ! $attachment || 'attachment' !== $attachment->post_type ) {+                continue;+            }++            // Authorization check: User must be the attachment author OR have delete_others_posts capability+            $is_owner = ( $current_user_id > 0 ) && ( (int) $attachment->post_author === $current_user_id );+            $can_delete_others = current_user_can( 'delete_others_posts' );++            if ( ! $is_owner && ! $can_delete_others ) {+                continue;+            }++            if ( $post_id_for_edit > 0 ) {+                $attachment_parent = (int) $attachment->post_parent;++                if ( $attachment_parent !== 0 && $attachment_parent !== $post_id_for_edit && ! $can_delete_others ) {+                    continue;+                }+            }+             wp_delete_attachment( $attach_id, true );         } 
AI Analysis
Vulnerability Existed: yes
TRUE POSITIVE
Broken Access Control / Improper Authorization - CWE-639 - includes/Ajax/Frontend_Form_Ajax.php [130-166]

Old Code:
```php
foreach ( $attachments_to_delete as $attach_id ) {
    wp_delete_attachment( $attach_id, true );
}
```

Fixed Code:
```php
// Attachment deletion authorization check
$current_user_id = get_current_user_id();
$post_id_for_edit = isset( $_POST['post_id'] ) ? intval( wp_unslash( $_POST['post_id'] ) ) : 0;

foreach ( $attachments_to_delete as $attach_id ) {
    $attach_id = absint( $attach_id );

    if ( empty( $attach_id ) ) {
        continue;
    }

    $attachment = get_post( $attach_id );

    // Skip if attachment doesn't exist or is not an attachment
    if ( ! $attachment || 'attachment' !== $attachment->post_type ) {
        continue;
    }

    // Authorization check: User must be the attachment author OR have delete_others_posts capability
    $is_owner = ( $current_user_id > 0 ) && ( (int) $attachment->post_author === $current_user_id );
    $can_delete_others = current_user_can( 'delete_others_posts' );

    if ( ! $is_owner && ! $can_delete_others ) {
        continue;
    }

    if ( $post_id_for_edit > 0 ) {
        $attachment_parent = (int) $attachment->post_parent;

        if ( $attachment_parent !== 0 && $attachment_parent !== $post_id_for_edit && ! $can_delete_others ) {
            continue;
        }
    }

    wp_delete_attachment( $attach_id, true );
}
```

Explanation:
The original code was vulnerable to an authorization bypass vulnerability (CWE-639: Authorization Through User-Controlled Key). The AJAX endpoint was deleting attachments without verifying that the current user had permission to delete them. An authenticated user could potentially delete attachments belonging to other users or posts by manipulating the `$attachments_to_delete` array, even if they didn't have the appropriate permissions.

The fix implements proper authorization checks before deletion:
1. Retrieves the current user ID and post context
2. Validates each attachment exists and is actually an attachment post type
3. Verifies the user is either the attachment's original author OR has the `delete_others_posts` capability
4. If a specific post context exists, ensures the attachment belongs to that post (unless user has admin capabilities)
5. Only proceeds with deletion if authorization checks pass

This prevents unauthorized users from deleting attachments they don't own or aren't associated with their posts.
CVE Analysis Results:
CVE-2025-14047: Yes
View CVE Description
The Registration, User Profile, Membership, Content Restriction, User Directory, and Frontend Post Submission – WP User Frontend plugin for WordPress is vulnerable to unauthorized loss of data due to a missing capability check on the 'Frontend_Form_Ajax::submit_post' function in all versions up to, and including, 4.2.4. This makes it possible for unauthenticated attackers to delete attachment.
Showing 1 to 1 of 1 results