问答
发起
提问
文章
攻防
活动
Toggle navigation
首页
(current)
问答
商城
实战攻防技术
漏洞分析与复现
NEW
活动
摸鱼办
搜索
登录
注册
样本分析:phobos勒索软件样本分析学习
样本基本信息 基本信息: 文件大小:61kb MD5:ca52ef8f80a99a01e97dc8cf7d3f5487 文件类型:exe 病毒家族:Phobos 基础分析-持久化 该勒索软件带有加密配置,可以使用硬编码的AES...
样本基本信息 ======  基本信息: - 文件大小:61kb - MD5:ca52ef8f80a99a01e97dc8cf7d3f5487 - 文件类型:exe - 病毒家族:Phobos 基础分析-持久化 ========  该勒索软件带有加密配置,可以使用硬编码的AES密钥解密,加密逻辑在`sub_4062A6`中。 `sub_40646A`:  该勒索软件自定义实现的AES加密算法,不需要依赖WIndows API。  回到入口,该勒索软件使用`GetTickCount()`检索自系统启动以来经过的毫秒数:  GetLocaleInfoW 函数用于获取操作系统的默认语言环境 (0x800 = **LOCALE\_SYSTEM\_DEFAULT** , 0x58 = **LOCALE\_FONTSIGNATURE** )。  二进制文件通过调用 GetModuleFileNameW 函数检索当前进程的可执行文件的路径,如下图:  调用`CreateFIleW`寻找一个文件(0x80000000 = **GENERIC\_READ**,0x3 = **OPEN\_EXISTING**)  接着它使用`GetVersion`方法提取系统的主版本号和此版本号:   如上图,还调用`OpenProcessToken` API打开与当前进程关联的访问令牌,之后用 `GetTokenInformation`验证令牌是否被提升。 环境变量“%systemdrive%”被展开,显示了包含Windows目录的驱动器:  该勒索软件还创建了俩个互斥锁:  分别是`Global\\<<BID>><Volume serial number>00000001`和`Global\\<<BID>><Volume serial number>00000000`。 通过`GetouduuleHandle`获取了Kernel.dll的模块句柄。  勒索软件还会使用到`GetShellWindow`函数获取Shell桌面窗口的句柄,通过`GetWindowThreadProcessId`函数来检索创建窗口的进程,例如explorer.exe。如果检索到窗口,会使用`OpenProcess`方法来打开文件句柄。  在上图中,`DuplicateTokenEx` API 用于创建一个新的访问令牌,该令牌复制上面提到的令牌。勒索软件在新创建的令牌的安全上下文中运行,它创建一个新线程,该线程将在`sub_264B85`函数中运行以下命令: - vssadmin delete shadows /all /quiet – 删除所有卷影副本 - wmic shadowcopy delete – 删除所有卷影副本 - bcdedit /set {default} bootstatuspolicy ignoreallfailures – 如果启动、关机或检查点失败,则忽略错误 - bcdedit /set {default} recoveryenabled no – 禁用自动修复 - wbadmin delete catalog -quiet – 删除计算机上的备份目录 - netsh advfirewall set currentprofile state off – 禁用当前网络配置文件的防火墙 - netsh Firewall set opmode mode=disable – 禁用防火墙   接着往下走:  该进程将其可执行文件复制到“%AppData%\\Local”目录。 `RegOpenKeyExW` 用于打开 Run 注册表项。该勒索软件通过创建一个基于可执行文件名称命名的条目来建立持久性,该条目指向新创建的可执行文件:   以下是该勒索软件的加密目标: fdb sql 4dd 4dl abs abx accdb accdc accde adb adf ckp db db-journal db-shm db-wal db2 db3 dbc dbf dbs dbt dbv dcb dp1 eco edb epim fcd gdb mdb mdf ldf myd ndf nwdb nyf sqlitedb sqlite3 sqlite 线程活动 ==== sub\_XX22EE 函数 --------------   恶意软件打开与当前进程关联的访问令牌(0x20 = **TOKEN\_ADJUST\_PRIVILEGES**),LookupPrivilegeValueW 方法用于提取代表“SeDebugPrivilege”权限的本地唯一标识符(LUID),之后通过调用 AdjustTokenPrivileges 来启用上述权限。 以下进程将被终止,因为它们可能会锁定要加密的文件: msftesql.exe sqlagent.exe sqlbrowser.exe sqlservr.exe sqlwriter.exe oracle.exe ocssd.exe dbsnmp.exe synctime.exe agntsvc.exe mydesktopqos.exe isqlplussvc.exe xfssvccon.exe mydesktopservice.exe ocautoupds.exe agntsvc.exe agntsvc.exe agntsvc.exe encsvc.exe firefoxconfig.exe tbirdconfig.exe ocomm.exe mysqld.exe mysqld-nt.exe mysqld-opt.exe dbeng50.exe sqbcoreservice.exe excel.exe infopath.exe msaccess.exe mspub.exe onenote.exe outlook.exe powerpnt.exe steam.exe thebat.exe thebat64.exe thunderbird.exe visio.exe winword.exe wordpad.exe 该恶意软件会对系统中所有进程进行快照,如下图所示。  使用 `Process32FirstW` 和 `Process32NextW` API 枚举进程,再使用`TerminateProcess`方法停止任何目标进程:  sub\_XX239A函数 -------------  `OpenProcessToken` 用于打开与进程关联的访问令牌(0x8 = **TOKEN\_QUERY**),二进制文件通过调用 `GetTokenInformation` API(0x14 = TokenElevation )再次验证令牌是否被提升。 勒索软件它再次使用“Global\\<<BID>><Volume serial number>00000000”互斥名称调用 OpenMutexW 和 CreateMutexW 方法:  sub\_XX2161函数(加密网络共享) ---------------------   勒索软件使用事件来同步线程。它使用 `CreateEventW` 创建两个未命名的事件对象: 创建完事件对象后提取本地机器的 NetBIOS 名称:  `WNetOpenEnumW` 用于启动所有当前连接的资源的枚举(0x1 = **RESOURCE\_CONNECTED**),再通过调用 `WNetEnumResourceW` 函数继续枚举:  该过程通过调用`GetIpAddrTable`函数获取接口到IPv4地址映射表,如下所示:  这里使用 ntohl 将上面提取的每个 IP 地址从网络顺序转换为主机字节顺序  它还会创建一个 TCP 套接字(0x2 = **AF\_INET**、0x1 = **SOCK\_STREAM**、0x6 = **IPPROTO\_TCP**),尝试通过端口 445 连接到网络上的每个主机,以加密每个可用的网络共享:  sub\_XX4B85函数 -------------  该进程通过调用 CreatePipe 方法创建两个匿名管道,接着使用 `SetHandleInformation` (0x1 = HANDLE\_FLAG\_INHERIT )可以使读取句柄可继承。 勒索软件会创建一个“cmd.exe”进程,该进程将执行多个命令,例如负责禁用防火墙、删除所有卷影副本等的命令通过管道传输到新创建的进程:  sub\_XX1CC5函数 -------------  此线程不断使用 `GetLogicalDrives` API 提取代表当前可用磁盘驱动器的位掩码 AES加密 ----- ### sub\_XX1A76函数  这里会解密用于加密文件所用的 AES256 密钥的 RSA 公钥。 它使用多个函数提取当前本地日期和时间、当前进程和线程 ID 以及其他信息:  二进制文件会创建一个新线程,该线程将遍历网络共享和驱动器,以提取要加密的文件:  ### sub\_XX54BF函数  之中的sub\_XX8EBE: 勒索软件以读取模式打开要加密的文件(0x80000000 = **GENERIC\_READ**、0x7 = **FILE\_SHARE\_DELETE** | **FILE\_SHARE\_WRITE** | **FILE\_SHARE\_READ**、0x3 = **OPEN\_EXISTING**),如下  它使用 GetFileSizeEx API 检索文件的大小,将大小与 0x180000 字节(1.5MB)进行比较,字节数较大的文件被部分加密,其余文件则被全部加密:  使用一个`ReadFile`读取文件内容  自定义的AES加密算法:  内容经过AES加密后使用`WriteFile`写入文件中。 未加密的文件将被0覆盖,然后被删除: 
发表于 2024-10-17 09:00:01
阅读 ( 20420 )
分类:
漏洞分析
0 推荐
收藏
0 条评论
请先
登录
后评论
Sciurdae
16 篇文章
×
发送私信
请先
登录
后发送私信
×
举报此文章
垃圾广告信息:
广告、推广、测试等内容
违规内容:
色情、暴力、血腥、敏感信息等内容
不友善内容:
人身攻击、挑衅辱骂、恶意行为
其他原因:
请补充说明
举报原因:
×
如果觉得我的文章对您有用,请随意打赏。你的支持将鼓励我继续创作!