XWorm Malware Teknik Analiz Raporu

9 minute read

XWorm malware-as-a-service (MaaS) olarak dağıtılan Remote Acces Trojan (RAT) türünde zararlı yazılımdır. İlk olarak Temmuz 2022 tarihinde görülmüştür. Bulaştığı sistemden GPU, CPU, RAM vb. hardware bilgilerini toplama, topladığı bilgileri komuta kontrol adresine aktarma, sistemi bot haline getirerek Distributed Denial of Service (DDOS) saldırılarında kullanma, kullanıcı aktivitesini inceleme gibi farklı işlevleri bulunmaktadır.

Xworm zararlısının kaynağı ve hedefleri, saldırının amacına ve arkasındaki aktörlerin motivasyonlarına bağlı olarak değişir. Finansal kazanç elde etmek amacıyla bankacılık, finans sektörleri hedef alınmakla birlikte casusluk faaliyetleri amacıyla devlet kurumlarına saldırılar düzenlenir. Saldırılar ülkeye özgü veya bağımsız şekilde yapılabilmekle birlikte farklı ülkelerdeki sunucular veya botnet ağları üzerinden gerçekleştirilir. Saldırılar çoğunlukla Rusya, Çin, Kuzey Kore ülkelerinden yapılmaktadır.

XWorm, genellikle phishing saldırılarıyla sistemlere sızan çok aşamalı bir tehdit olarak öne çıkar. Sisteme yerleştikten sonra, kendini gizlemek ve sürekli çalışmasını sağlamak için çeşitli yöntemler kullanır. Savunma mekanizmalarını aşmak için PowerShell komutlarıyla hareket eder, sistem bilgilerini ve kullanıcı verilerini toplar. Bu veriler dışarıya sızdırılır ve enfekte olmuş cihazlar, uzaktan kontrol edilen botlar haline getirilerek DDoS saldırıları ve diğer zararlı faaliyetler için kullanılır.

Aşağıda zararlı yazılım analiz laboratuvarında incelenen Xworm zararlısına ait elde edilen bulgulara yer verilmiştir.

Yürütme

Wxorm zararlısı bulaştığı sistemde “Microsoft Edge.exe” isimli payload dosyasını oluşturur. Oluşturduğu payload dosyası içerisine zararlı kodlar ekler. Dosya farklı bir işlev içermemekle birlikte zararlının fark edilmemek amacıyla oluşturduğu kendi kopyasıdır.

Kalıcılık

Xworm zararlısı bulaştığı sistemde kalıcılık elde etmek amacıyla scheduled task oluşturur. Yönetici haklarına sahipse en yüksek ayrıcalıklarla (/RL HIGHEST) her dakika olacak şekilde (/sc minute /mo 1) çalışacak bir görev oluşturur.

Zararlı yazılım çalıştırıldığında sonuçlar Sysmon ile incelenerek sistemde oluşturulan scheduled task dinamik olarak gözlemlenir.

Zararlı yazılım, Windows kayıt defterindeki “Run” anahtarına kendisini ekler. Bu işlemle birlikte sistem her açıldığında zararlının otomatik olarak başlatılması sağlanır. Başlangıç klasöründe oluşturduğu .lnk uzantılı kısayol dosyası ile kullanıcı her oturum açışında yazılım otomatik olarak başlatılarak kalıcılık sağlanır.

Powershell başlatılarak kullanıcıdan gizlenmesi sağlanır. ExecutionPolicy Bypass ile komut çalışması kısıtı kaldırılarak zararlı komutlar çalıştırılır. Windows Defender taramalarından muaf tutulur. Buradaki amaç, zararlının kendini gizleyerek fark edilmemesini sağlamaktır.

Keşif

XWorm zararlısı işlemci sayısı, username, makine adı, hardware bilgilerini alarak sistem hakkında detaylı bilgiler elde eder. Kullanıcının son aktivite bilgileri, aktif olduğu süre gibi bilgileri elde ederek uykuyu önleme fonksiyonunu çalıştırır, böylelikle zararlı faaliyetlerini kesintisiz bir şekilde gerçekleştirir.

“avicap32.dll” kütüphanesi kullanılarak video yakalama penceresi oluşturulur, sürücü bilgisi alınır. Bilgisayara bağlı kamera olup olmadığının kontrolü yapılarak kamera üzerinden görüntü toplama işlemi gerçekleştirilir.

Komuta Kontrol

XWorm zararlısı C2 adresine ulaşarak zararlı komutları indirir. Zararlının komuta kontrol adresinin Rusya’da olduğu tespit edilmiştir.

Zararlı yazılım bulaştığı bilgisayardan kullanıcı adı, OS, USB, CPU, GPU, RAM bilgilerini toplar. Topladığı bilgileri Telegram botu aracılığıyla Telegram kanalına yollar. Telegram kanalının Birleşik Krallık’ta olduğu tespit edilmiştir. Gönderilen bilgiler kullanılarak hedefler bot haline dönüştürülür ve DDOS saldırıları için kullanılır.

Zararlının asıl işlevlerini gerçekleştirdiği kısım DDOS saldırısı için bot haline getirildiği kısımdır. Merkezi bir komut sunucusundan alınan talimatlar yerine getirilerek zararlı faaliyetlerde bulunulan backdoor fonksiyonu görülmektedir. Bilgisayar bot haline getirilerek DDoS saldırıları, dosya indirme, komut çalştırma, sistem kontrolü vb. işlevleri gerçekleştirmesi sağlanır.

SONUÇ

XWorm’un ana saldırı vektörü, phishing e-postaları ile kullanıcılara gönderilen zararlı belgeler ve bu belgeler aracılığıyla yüklenen makrolardır. Bu makrolar, PowerShell komut dosyaları çalıştırarak zararlıyı sisteme yükler ve kullanıcının sisteminde kalıcı hale getirir.

XWorm V5.6, gelişmiş kalıcılık ve gizlenme yöntemleri kullanarak, enfekte ettiği sistemlerde zararlı faaliyetlerini sürdüren tehlikeli bir zararlı yazılım olarak dikkat çekmektedir. PowerShell komutları ile savunma mekanizmalarını atlatan, Windows Defender gibi güvenlik yazılımlarını devre dışı bırakan XWorm, elde ettiği sistem bilgilerini ve kullanıcı verilerini C2 sunucularına ileterek, enfekte sistemleri bot haline getirmekte ve DDoS saldırılarında kullanmaktadır. Bu tür zararlı yazılımların tespiti ve bertaraf edilmesi, güvenlik operasyon merkezleri için önemli bir öncelik haline gelmiştir.

MITRE ATT&CK Matrix

IoC

SHA 256 -> XClient.exe : 8ca7c43f383d3214f469a18fcc30436f472f9bd3d9b6134aea5d61a523665659

Domain Bilgileri

  • pastebin.com
  • pastebin.com/raw/zs3YKzJ3
  • qsjksd-22439.portmap.host api.telegram.org/bot
  • MyApplication.org

IP Adresleri

  • 192.161.193.99
  • 149.154.167.220

Dropper Dosyaları

  • C:\Users\admin\Downloads\buidl.exe C:\Users\user\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\Microsoft Edge.lnk

Deobfuscator

using System;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using dnlib.DotNet;
using dnlib.DotNet.Emit;

namespace ConsoleApp1
{
internal class Deobfuscator
{
// Decrypts the given obfuscated string using a predefined key and Rijndael (AES) algorithm
public static string DecryptString(string encryptedString, string key)
{
using (RijndaelManaged rijndaelManaged = new RijndaelManaged())
using (MD5CryptoServiceProvider md5CryptoServiceProvider = new MD5CryptoServiceProvider())
{
// Hash the static key with MD5 to create the decryption key
byte[] keyArray = new byte[32];
byte[] hashArray = md5CryptoServiceProvider.ComputeHash(Encoding.UTF8.GetBytes(key));

            //Copy the first 16 bytes into the first half of the key array  
            Array.Copy(hashArray, 0, keyArray, 0, 16);  
            // Copy the first 16 bytes again into the second half   
            Array.Copy(hashArray, 0, keyArray, 15, 16);  
  
            // Set the Rijndael key and mode to ECB  
            rijndaelManaged.Key = keyArray;  
            rijndaelManaged.Mode = CipherMode.ECB;  
  
            // Create a decryptor with the given key  
            ICryptoTransform decryptor = rijndaelManaged.CreateDecryptor();  
  
            // Convert the Base64 encrypted string into bytes and decrypt it  
            byte\[\] encryptedBytes = Convert.FromBase64String(encryptedString);  
            byte\[\] decryptedBytes = decryptor.TransformFinalBlock(encryptedBytes, 0, encryptedBytes.Length);  
  
            return Encoding.UTF8.GetString(decryptedBytes);  
        }  
    }  
  
    // Extracts the value of a specific field from the given module  
    static string GetFieldValue(ModuleDefMD module, string fieldName)  
    {  
        foreach (TypeDef type in module.Types)  
        {  
            foreach (MethodDef method in type.Methods)  
            {  
                if (!method.HasBody) continue; // Skip methods without body  
                for (int i = 0; i < method.Body.Instructions.Count; i++)  
                {  
                    // Find the Stsfld opcode (sets a static field) and check the field name  
                    if (method.Body.Instructions\[i\].OpCode == OpCodes.Stsfld &&  
                        method.Body.Instructions\[i\].Operand.ToString() == fieldName)  
                    {  
                        // Return the previous operand which holds the value being assigned to the field  
                        return method.Body.Instructions\[i - 1\].Operand.ToString();  
                    }  
                }  
            }  
        }  
        return string.Empty;  
    }  
  
    // Decrypting and replacing obfuscated strings  
    static void ReplaceEncryptedStrings(ModuleDefMD module, string key)  
    {  
        // Loop through all types in the module  
        foreach (TypeDef type in module.Types)  
        {  
            if (!type.HasMethods) continue; // Skip types without methods  
  
            // Loop through all methods of the type  
            foreach (MethodDef method in type.Methods)  
            {  
                if (!method.HasBody) continue;  
                for (int i = 0; i < method.Body.Instructions.Count; i++)  
                {  
                    if (method.Body.Instructions\[i\].OpCode == OpCodes.Call)  
                    {  
                        string functionName = method.Body.Instructions\[i\].Operand.ToString();  
  
                        // Look for the obfuscated decryption function  
                        if (functionName.Contains("Sf3ygLwXizFpQcdEafah6RmRmvi94yTN3n3UpcJF") ||  
                            functionName.Contains("rcGLP28muXxfBxK3uFwoeAtSCKBUh59TpsFfzA1jtrEEczzNWbt7mki"))  
                        {  
                            // Get the encrypted string from the previous instruction  
                            string fieldValue = method.Body.Instructions\[i - 1\].Operand.ToString();  
                            Console.WriteLine(fieldValue);  
  
                            // Decrypt the value and replace the instruction with the decrypted string  
                            string decryptedString = DecryptString(GetFieldValue(module, fieldValue), key);  
  
                            method.Body.Instructions\[i - 1\].OpCode = OpCodes.Nop; // Clear the original instruction  
                            method.Body.Instructions\[i\].OpCode = OpCodes.Ldstr; // Load the decrypted string instead  
                            method.Body.Instructions\[i\].Operand = decryptedString;  
                        }  
                    }  
                }  
            }  
        }  
    }  
  
    static void Main(string\[\] args)  
    {  
        string filePath = @"C:\\Users\\aycagl\\Desktop\\buidl.exe";  
        string key = "N0BNPIHTRtK9oiyP";  
  
        ModuleDefMD module = ModuleDefMD.Load(filePath);  
  
        ReplaceEncryptedStrings(module, key);  
  
        // Write the deobfuscated code to a new file  
        module.Write(@"C:\\Users\\aycagl\\Desktop\\clean.exe");  
  
        Console.WriteLine("Deobfuscation completed.");  
        Console.ReadKey();  
    }  
}   }

YARA Kuralları

rule Suspicious_Persistence_Indicators
{
meta:
description = “Detects suspicious persistence mechanisms via registry, shortcuts, and scripts”
author = “aycagl - Ayca Gul”
date = “2024-08-15”
reference = “XWorm V5.6”

strings:  
$scheduled \= "schtasks.exe" fullword wide  
    $task\_highest \= "/create /f /RL HIGHEST /sc minute /mo 1 /tn \\"" fullword wide  
    $task\_basic \= "/create /f /sc minute /mo 1 /tn \\"" fullword wide  
    $registry\_run \= "SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Run" fullword wide  
    $wscript\_shell \= "WScript.Shell" fullword wide  
    $create\_shortcut \= "CreateShortcut" fullword wide  
    $target\_path \= "TargetPath" fullword wide  
    $working\_directory \= "WorkingDirectory" fullword wide  
  
condition:  
    6 of them   }  

rule XWorm_Indicators
{
meta:
description = “Detects the XWorm malware’s send_infos method that sends system information via a Telegram bot”
author = “aycagl - Ayca Gul”
date = “2024-08-15”
reference = “XWorm V5.6”

strings:  
    $xworm\_version \= "XWorm V" fullword wide  
    $new\_client \= "New Clinet :" fullword wide  
    $username \= "UserName :" fullword wide  
    $os\_fullname \= "OSFullName :" fullword wide  
    $usb \= "USB :" fullword wide  
    $cpu \= "CPU :" fullword wide  
    $gpu \= "GPU :" fullword wide  
    $ram \= "RAM :" fullword wide  
    $group \= "Groub :" fullword wide  
    $telegram\_api \= "https://api.telegram.org/bot" fullword wide  
    $send\_message \= "/sendMessage?chat\_id=" fullword wide  
    $webclient\_function \= {00735600000A0C08026F5700000A0ADE2D}  
  
condition:  
    6 of them   }  

rule Malware_Information_Queries {
meta:
description = “Detects malware performing system information queries and persistence setup.”
author = “aycagl - Ayca Gul”
date = “2024-08-15”
reference = “XWorm V5.6”

strings:  
    $query\_antivirus \= "\\\\root\\\\SecurityCenter2" fullword wide  
    $query\_antivirus\_product \= "Select \* from AntivirusProduct" fullword wide  
    $query\_display\_name \= "displayName" fullword wide  
    $query\_video\_controller \= "SELECT \* FROM Win32\_VideoController" fullword wide  
    $query\_processor \= "Win32\_Processor.deviceid" fullword wide  
  
condition:  
    4 of them   }  

rule Malware_Command_Detection {
meta:
description = “Detects specific malware command and function strings”
author = “aycagl - Ayca Gul”
date = “2024-08-15”
reference = “XWorm V5.6”

strings:  
    $s1 \= "pong" fullword wide  
    $s2 \= "CLOSE" fullword wide  
    $s3 \= "uninstall" fullword wide  
    $s4 \= "update" fullword wide  
    $s5 \= "Urlopen" fullword wide  
    $s6 \= "Urlhide" fullword wide  
    $s7 \= "PCShutdown" fullword wide  
    $s8 \= "shutdown.exe /f /s /t 0" fullword wide  
    $s9 \= "PCRestart" fullword wide  
    $s10 \= "shutdown.exe /f /r /t 0" fullword wide  
    $s11 \= "PCLogoff" fullword wide  
    $s12 \= "shutdown.exe -L" fullword wide  
    $s13 \= "RunShell" fullword wide  
    $s14 \= "StartDDos" fullword wide  
    $s15 \= "StopDDos" fullword wide  
    $s16 \= "StartReport" fullword wide  
    $s17 \= "StopReport" fullword wide  
    $s18 \= "Xchat" fullword wide  
    $s19 \= "Hosts" fullword wide  
    $s20 \= "\\\\drivers\\\\etc\\\\hosts" fullword wide  
    $s21 \= "Shosts" fullword wide  
    $s22 \= "HostsMSG" fullword wide  
    $s23 \= "Modified successfully!" fullword wide  
    $s24 \= "HostsErr" fullword wide  
    $s25 \= "DDos" fullword wide  
    $s26 \= "plugin" fullword wide  
    $s27 \= "sendPlugin" fullword wide  
    $s28 \= "savePlugin" fullword wide  
    $s29 \= "RemovePlugins" fullword wide  
    $s30 \= "Plugins Removed!" fullword wide  
    $s31 \= "OfflineGet" fullword wide  
    $s32 \= "OfflineKeylogger Not Enabled" fullword wide  
    $s33 \= "Plugin" fullword wide  
    $s34 \= "Invoke" fullword wide  
    $s35 \= "RunRecovery" fullword wide  
    $s36 \= "Recovery" fullword wide  
  
  
condition:  
    15 of ($s\*)   }