• Resolved hoboken411

    (@hoboken411)


    Since the 3.8 / 3.8.1 update we’re getting constant “blocked attempt to modify WordPress settings…” messages in our firewall log. It’s coming from localhost, and not an attack on our blog.

    Any suggestions?

    19/Dec/18 10:01:37  #4750320  CRITICAL     -  127.0.0.1        POST /wp-admin/admin-ajax.php - Blocked attempt to modify WordPress settings - [option: wp_user_roles, value: Array] - *******.com
    19/Dec/18 10:06:55  #6886373  CRITICAL     -  127.0.0.1        POST /wp-admin/admin-ajax.php - Blocked attempt to modify WordPress settings - [option: wp_user_roles, value: Array] - *******.com
    19/Dec/18 10:10:54  #5432006  CRITICAL     -  127.0.0.1        POST /wp-admin/admin-ajax.php - Blocked attempt to modify WordPress settings - [option: wp_user_roles, value: Array] - *******.com
    19/Dec/18 10:31:52  #2172497  CRITICAL     -  127.0.0.1        POST /wp-admin/admin-ajax.php - Blocked attempt to modify WordPress settings - [option: wp_user_roles, value: Array] - *******.com
    19/Dec/18 10:40:24  #7633702  CRITICAL     -  127.0.0.1        POST /wp-admin/admin-ajax.php - Blocked attempt to modify WordPress settings - [option: wp_user_roles, value: Array] - *******.com
    19/Dec/18 10:40:24  #1741060  CRITICAL     -  127.0.0.1        POST /wp-admin/admin-ajax.php - Blocked attempt to modify WordPress settings - [option: wp_user_roles, value: Array] - *******.com
    19/Dec/18 10:49:49  #6196981  CRITICAL     -  127.0.0.1        POST /wp-admin/admin-ajax.php - Blocked attempt to modify WordPress settings - [option: wp_user_roles, value: Array] - *******.com
    19/Dec/18 10:58:16  #7694632  CRITICAL     -  127.0.0.1        POST /wp-admin/admin-ajax.php - Blocked attempt to modify WordPress settings - [option: wp_user_roles, value: Array] - *******.com 

    100’s of times per day…

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author nintechnet

    (@nintechnet)

    Do you have any idea which application is doing that? It tries to modify the value of wp_user_roles which is one of the most important in the wp_options table.
    You can whitelist localhost to let it go: “NinjaFirewall > Firewall Policies > Intermediate Policies > IP > Scan traffic coming from localhost and private IP address spaces”, select “No” and save the new changes.

    Thread Starter hoboken411

    (@hoboken411)

    Not sure what app, if any is doing that… My host – who looked into it, suggested it may be page caching – and to lower the timeout, but that didn’t make a difference. The next test is to disable caching temporarily.

    Note that no changes were made to the WP install – and that this “event” simply started after the latest NinjaFirewall updates…

    I’ll try your whitelist suggestion. However, does that mean it will no longer “block?”

    Plugin Author nintechnet

    (@nintechnet)

    Yes, it will no longer block it, but that will apply to your request coming from localhost, not from a public IP.
    However, before doing that I recommend to try to find out which plugin or theme is doing that: you can scan your wp-content/themes/ and wp-content/plugins/ folders and search for wp_user_roles.

    That new protection was added to 3.8 after we noticed some hackers were trying to modify the wp_user_roles data by exploiting vulnerabilities found in two popular plugins lately. They try to give subscribers all admin capabilities such as manage_options etc.

    Thread Starter hoboken411

    (@hoboken411)

    When you say “scan” what are you suggesting? Just looking at the database tables? A little hint would help.

    Also – can you say which plugins those were so I can check to see if I have them installed?

    BTW, appreciate your quick responses! Very rare these days!

    Plugin Author nintechnet

    (@nintechnet)

    “WP GDPR Compliance” <1.4.3: https://blog.nintechnet.com/critical-vulnerability-in-wp-gdpr-compliance-plugin-massively-exploited/
    “Kiwi Social Sharing” <2.0.11: https://blog.nintechnet.com/critical-vulnerability-in-wordpress-kiwi-social-sharing-plugin-actively-exploited/

    It is all the PHP files in your plugin and theme folders that you need to scan/search for the wp_user_roles expression.

    Thread Starter hoboken411

    (@hoboken411)

    Thanks – luckily we’re not using those two plugins. But what is a quick way to scan the contents of php files other than manually loading them into an editor and using a text search?

    Thread Starter hoboken411

    (@hoboken411)

    I used the String Locator plugin to search all WordPress files.

    Oddly enough – the only one that had wp_user_roles was the Ninja Firewall plugin! (in wp-content/plugins/ninjafirewall/lib/utils.php)

    The only other instance was in the WordPress Core (wp-includes/class-wp-roles.php)

    Thread Starter hoboken411

    (@hoboken411)

    One last question before I get some sleep. I noticed this setting in the Intermediate Policies – about “block localhost IP for GET/POST requests”

    Is this maybe why we’re having issues?

    Should I NOT block localhost IP?

    Plugin Author nintechnet

    (@nintechnet)

    “block localhost IP for GET/POST requests” is not your issue. It is used to block a GET or POST payload that includes the localhost IP (e.g., ?foo=127.0.0.1).

    wp-content/plugins/ninjafirewall/lib/utils.php and wp-includes/class-wp-roles.php are the only 2 files that should contain the wp_user_roles string.

    Thread Starter hoboken411

    (@hoboken411)

    I guess the original question remains – what do you think is triggering this result from the firewall?

    CRITICAL - 127.0.0.1 POST /wp-admin/admin-ajax.php - Blocked attempt to modify WordPress settings - [option: wp_user_roles, value: Array]

    Is this truly a “Critical” thing to be concerned with – or should I just shut off mentions from localhost sources? I read in the plugin that you suggested this could be a SQL injection type attack?

    Plugin Author nintechnet

    (@nintechnet)

    It is not a SQLi attack, it’s a call to the WordPress API via admin-ajax.php. You need to find out where does it come from. It’s from the localhost, maybe it’s a cronjob?

    You can catch the request and write the POST payload to a file in order to see what is being sent:
    1. Open the wp-admin/admin-ajax.php script.
    2. Right before the define( 'DOING_AJAX', true ); line, add this code:

    if ( $_SERVER['REMOTE_ADDR'] == '127.0.0.1' && $_SERVER['REQUEST_METHOD'] == 'POST' ) {
    	file_put_contents( __DIR__ .'/ajax.log', print_r( $_POST, true ) );
    }
    

    3. Wait for the next attempt, and check the wp-admin/ajax.log log.

    Delete this code when you don’t need it anymore.

    Thread Starter hoboken411

    (@hoboken411)

    Thanks for the file mod. I was able to capture what was going on… and it seems harmless – but I’ll detail them here. Maybe you can help determine why this is being logged as a change to user roles? Doesn’t appear to be?

    These three log entries only happened when posts with EMBEDDED Google Maps… does Google Maps trigger something?

    Array
    (
        [action] => entry_views
        [_ajax_nonce] => bbc0d79a62
        [post_id] => 4701
    )

    and

    Array
    (
        [data] => Array
            (
                [wp-refresh-post-lock] => Array
                    (
                        [post_id] => 4701
                        [lock] => 1545516072:1
                    )
    
            )
    
        [interval] => 15
        [_nonce] => 4d403a9651
        [action] => heartbeat
        [screen_id] => post
        [has_focus] => false
    )

    And

    Array
    (
        [action] => entry_views
        [_ajax_nonce] => bbc0d79a62
        [post_id] => 5126
    )

    And this one seems to be just an image optimizing plugin:

    Array
    (
        [action] => shortpixel_image_processing
    )

    Any ideas?

    Plugin Author nintechnet

    (@nintechnet)

    None of them are/seem related to your issue. Also, they all connect from the same localhost IP? Do you have a reverse proxy which would explain why REMOTE_ADDR is set to 127.0.0.1? Go to NinjaFirewall “Overview” page and check if you have a warning about that. If you do, you’ll need to use the .htninja file to forward the correct IP.

Viewing 13 replies - 1 through 13 (of 13 total)

The topic ‘Erroneous Blocked attempt to modify WordPress settings’ is closed to new replies.