9

对APT34泄露工具的分析——Jason

 4 years ago
source link: https://3gstudent.github.io/3gstudent.github.io/%E5%AF%B9APT34%E6%B3%84%E9%9C%B2%E5%B7%A5%E5%85%B7%E7%9A%84%E5%88%86%E6%9E%90-Jason/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

0x00 前言


Jason是由Lab Dookhtegan在2019年6月3日泄露的另一款工具,用于Exchange账户的暴力破解

然而,泄露的这款工具虽然包括源码,但存在一些bug,无法正常使用

本文不会分析Jason和APT34之间的关联,仅在技术研究的角度,修复Jason的bug,恢复Jason的功能,分析使用的技术,同其他开源工具做横向比较

注:

之前关于APT34的分析文章:

《对APT34泄露工具的分析——PoisonFrog和Glimpse》

《对APT34泄露工具的分析——HighShell和HyperShell》

0x01 简介


本文将要介绍以下内容:

  • Jason的开源资料
  • 修复Jason的bug
  • 实际测试Jason
  • 同其他开源工具的横向比较

0x02 Jason的开源资料


Jason最早泄露于Telegram的频道:https://t.me/lab_dookhtegana

p3pperp0tts将其上传至Github,地址如下:

https://github.com/p3pperp0tts/APT34/tree/master/Jason

文件夹decompiled_code内为Jason的源码

Jason采用EWS Managed API来实现对Exchange资源的访问

注:

关于EWS Managed API的使用细节可参考之前的文章《Exchange Web Service(EWS)开发指南》

经过简单的修复,我在VS2015下能够编译成功

但在测试环境中,Jason无法识别正确的邮箱用户名和口令,所有测试结果均失败

0x03 修复Jason的bug


编译环境: VS2015

为了恢复正常功能,源代码需要修改以下4个位置

1.添加Microsoft.Exchange.WebServices.dll的引用

我这里是将Microsoft.Exchange.WebServices.dll放在工程的同级目录下,并做了引用

2.证书信任策略的bug修正

位置:Form1.cs

ServicePointManager.ServerCertificateValidationCallback = ((object <p0>, X509Certificate <p1>, X509Chain <p2>, SslPolicyErrors <p3>) => true);

修改后的代码:

ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => { return true; };

3.变量赋值的bug修正

位置:Form1.cs

(1)共有两个位置

MainConfig.AppLocation + "out.txt";

修改后的代码:

MainConfig.AppLocation = MainConfig.AppLocation + "out.txt";

(2)共有两个位置

MainConfig.UsernameStart + userClass.Username + MainConfig.UsernameEnd;

修改后的代码:

userClass.Username = MainConfig.UsernameStart + userClass.Username + MainConfig.UsernameEnd;

4.EWS和OAB的判断有问题

经过测试,变量MainConfig.Method的值始终为空

需要修正MainConfig.Method无法取值的bug

位置:Form1.cs

MainConfig.Method = this.cmbMethod.SelectedText;

修改后的代码:

MainConfig.Method = (string)this.cmbMethod.SelectedItem;

实现完整功能的工程我已上传至github,地址如下:

https://github.com/3gstudent/APT34-Jason

0x04 实际测试Jason


编译成功后生成文件Jason.exe

在同级目录需要文件Microsoft.Exchange.WebServices.dll,程序才可以正常运行

程序启动后,需要设置的配置如下:

1.Exchange Address

输入Exchange服务器的URL

在我的测试环境下,Exchange Address为:https://192.168.206.17

2.Exchange Version

选择对应的版本

此处选择低版本能够适用于高版本的Exchange服务器

3.BF Method

三个选项:

  • EWS(Exchange Web Service)
  • OAB(Offline Address Book)

通常选择EWS

4.Username File

用户名的字典文件

格式可参考PassSample.txt中提示的格式

我的测试环境下,我用的格式示例为:

[email protected] [email protected]

5.Password File

口令字典文件

6.Number of Threads

设置扫描线程个数

7.Generate Pass

点击后显示暴力破解使用的字典

8.Generate Pass Per

点击后生成文件夹PasswordPerUser,文件夹中生成以每个用户名命名的txt文件,内容为口令字典

9.Add to Username Start

产生新的用户,将输入的字符加在用户名前面

测试环境下建议不设置

10.Add to Username End

产生新的用户,将输入的字符加在用户名后面

测试环境下建议不设置

我的测试环境下,配置如下图

Alt text

暴力破解成功后,生成日志文件out-year-month-day-hour-minute-second.txt,保存用户名和对应的口令

0x05 同其他开源工具的横向比较


1.Jason

  • 对Exchange进行暴力破解的位置:
    • https://url/ews/exchange.asmx
    • https://url/oab
  • 支持多线程

2.MailSniper

  • https://github.com/dafthack/MailSniper
  • Powershell实现
  • 对Exchange进行暴力破解的位置:
    • https://url/ews/exchange.asmx
    • https://url/owa
  • 支持多线程
  • 命令行操作

3.Ruler

  • https://github.com/sensepost/ruler
  • 对Exchange进行暴力破解的位置:
    • https://url/autodiscover/autodiscover.xml
  • 不支持多线程
  • 命令行操作

对于Exchange账户的暴力破解,在原理上大同小异,都是访问Exchange的Web资源,如果返回401表示验证失败,如果获得预期结果代表用户口令正确

对于Jason,同MailSniper和Ruler相比,原理和功能基本相同,个人认为该工具不存在被大规模滥用的隐患,也不会导致恶意软件技术的升级

0x06 小结


本文介绍了如何修复Jason的bug,分析其中的技术,同其他开源工具做了横向比较,得出最终结论:个人认为该工具不存在被大规模滥用的隐患,也不会导致恶意软件技术的升级


LEAVE A REPLY


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK