IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    wannamine 分析

    fatekey\'s Blog发表于 2022-01-19 00:00:00
    love 0

    0x00 简单分析

    notion image
    未加壳,c++开发
    微步沙箱分析
    notion image
    微步说可能被加壳?应该是微步误报了吧
    火绒剑分析行为
    添加过滤
    • 进程过滤-挖矿进程
    • 动作过滤-创建文件\写入文件
    notion image
    • 进程过滤-挖矿进程
    • 动作过滤-设置\创建\删除注册表
    notion image
    • 进程过滤-挖矿进程
    • 动作过滤-网络连接
    notion image
    ip 查询
    notion image
    通过查看对挖矿进程创建 cmd 进程的参数分析执行的命令
    notion image
    ?删除自身可以理解,为什么要 ping 127.0.0.1 呢?
    创建服务.服务名应该是随机的,但是看着还挺像正常服务的,应该是有一个随机字典
    notion image

    0x01 IDA分析

    notion image
    跟进到 404FF0
    notion image
    跟进到 4050E0
    notion image
    notion image
    判断Software\\Microsoft\\Windows NT\\CurrentVersion\\NetworkPlatform\\Location Awareness 是否存在.
    返回 404FF0 ,以上注册表不存在则调用 404880.这里应该是为了判断病毒是否是第一次运行.
    notion image
    跟进 404880
    发现生成随机服务名,由 3 个部分拼接而成
    notion image
    生成用到的字典,拼接起来真的有系统服务那味了
    notion image
    notion image
    生成随机服务名.dll
    具体生成流程 获取 system 文件夹路径 创建随机文件名文件 删除随机服务名.dll 估计是为了防止生成的 dll 和某些 dll 重名 创建写入随机服务名.dll
    创建用于判断是否第一次运行的注册表,通过判断这个注册表是否存在,也就能判断是否感染过这个挖矿病毒了
    notion image
    404FF0 如果不是第一次运行则进入 4041E0,具体功能为查询服务状态
    notion image
    再回到 main 函数,进入405330
    notion image
    notion image
    再回到 main 函数,进入405390
    notion image
    装载后返回了资源在内存中的开始指针
    进入 4052D0
    notion image
    根据之前知道的长度和内存指针,取出内容,创建并写入文件
    返回 main 函数
    进入 4054F0
    notion image
    notion image
    进入 403F80
    notion image
    进入 403EA0
    notion image
    打开并读取之前写入内容那个随机文件名文件
    返回 4054F0
    notion image
    进入 4052D0
    notion image
    将读取出的内容写入服务名.dll
    再再再返回 main 函数
    notion image
    跟进 4051A0
    notion image
    读取\设置svchost.exe的创建、访问及上次修改时间
    返回主函数,进入 406110
    notion image
    notion image
    进入 405F40
    notion image
    打开注册表SOFTWARE\Microsoft\Windows NT\CurrentVersion\Svchost
    查询netsvcs 的值
    ⭐
    一般来说,Svchost.exe 总是根据 HKEY_LOCAL_MACHINE\Software\Microsoft\WindowsNT\CurrentVersion\Svchost 下面的键值分组管理DLL 申请的服务,这里的每一键值对应一个独立的Svchost.exe进程,也就是说这里的键值就是在任务管理器中我们看到的Svchost.exe进程。 当然,由于这里的键值并不是一次性全部加载,而是根据需要才加载,因此这里的键值数要多于在任务管理器中看到的Svchost.exe进程数,而每个Svchost.exe进程所包含的服务名、参数值和DLL则来自HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Service 这个键值。
    notion image
    建立一个连接到服务控制管理器并打开它的数据库
    创建一个服务对象,并将其添加到指定的服务控制管理器数据库
    这一步创建了随机命名的恶意服务
    跟进 405CA0
    notion image
    设置注册表 SYSTEM\CurrentControlSet\Services\%s 的Description 值
    返回 405F40
    notion image
    再次调用 405CA0设置注册表 SYSTEM\CurrentControlSet\Services\%s\Parameters 的 ServiceDll 值为随机服务名.dll
    返回 406110
    notion image
    建立一个连接到服务控制管理器并打开它的数据库
    开启恶意服务,运行恶意服务
    该服务释放了挖矿模块dllhostex.exe
    返回 main
    进入 4041E0
    notion image
    notion image
    notion image
    检测恶意服务状态
    返回 main,进入4058E0
    如果安装成功,传入的是Install_Done,安装失败传入Error_%d
    notion image
    notion image
    得到主机名和系统版本
    notion image
    拼接请求参数
    系统版本,主机名,还有上一步传入的安装结果
    进入405670
    notion image
    获得请求的目标 185.128.24.101:80 与火绒剑记录的一致
    返回 4058E0 进入 405720
    notion image
    发起 http 请求,请求方式为 get, UA 为Mozilla/4.0 (compatible; MSIE 6.1; Windows NT)
    返回 main 函数,进入 405570
    notion image
    notion image
    获取病毒文件路径
    不开窗口执行命令 cmd.exe /c ping 127.0.0.1 -n 5 & cmd.exe /c del /a
    完成病毒自杀

    0x02 dll 分析

    做了一定的伪装
    notion image
    主要进行了 2 个操作
    创建注册表Software\Microsoft\Windows NT\CurrentVersion\NetworkPlatform\

    横向移动 - searchindexer.exe

    notion image
    写入C:\Windows\NetworkDistribution\ MS17-010永恒之蓝利用工具
    notion image
    攻击
    notion image
    是获取内网 ip 选择网段扫描,不是内置网段扫描
    会多次扫描

    挖矿 - dllhostex.exe

    notion image
    notion image
    看了下,应该就是稍微修改的开源挖矿程序.
    ⭐
    骚操作:系统任务管理器启动时, 挖矿进程会自动退出.任务管理器关闭后, 挖矿进程又会重新启动.


沪ICP备19023445号-2号
友情链接