Jump to content

Recommended Posts

Posted

Nice guide, havnt read all of it yet but noticed something on the Software Restrictions and thought id post before i forget.

 

 

If you have Software Restrictions set to default on unrestricted or basic user and then disallow "%temp%*.exe" for example then if another folder is created so "%temp%\imabigvirus\*.exe" then this will still run.

 

 

There are two ways round it

Have million of policies for each new folder e.g:

%temp%*.exe

%temp%\*\*.exe

%temp%\*\*.exe

 

but this can be worked round pretty simply by creating one more folder than youve listed.

 

Second way is to set the Software Restriction Policy to be disabled by default and the specify places you allow rather than places you disallow stuff.

Posted (edited)
Nice guide, havnt read all of it yet but noticed something on the Software Restrictions and thought id post before i forget.

 

 

If you have Software Restrictions set to default on unrestricted or basic user and then disallow "%temp%*.exe" for example then if another folder is created so "%temp%\imabigvirus\*.exe" then this will still run.

 

 

There are two ways round it

Have million of policies for each new folder e.g:

%temp%*.exe

%temp%\*\*.exe

%temp%\*\*.exe

 

but this can be worked round pretty simply by creating one more folder than youve listed.

 

Second way is to set the Software Restriction Policy to be disabled by default and the specify places you allow rather than places you disallow stuff.

 

That's a good point. It's something I've got to look into and narrow down where we've got stuff installed on our machines, I think the only thing not in Program Files or Windows is Python due to it's default install being in the root. It's on my list of things to look into fixing soon, and it's either that method or AppLocker. I'll probably go with the GPO option as it's a little easier to manage for both of us here (AppLocker is probably very easy to manage and has Powershell access but we've already got GPOs in place).

 

Edit: Skimming through our GPO again and it looks like we've got at least one which is %appdata%**.exe, no idea if that would work for nested folders though so I'll probably still give it try doing white listing rather than black listing.

Edited by halbaradkenafin
Posted (edited)

If you have Software Restrictions set to default on unrestricted or basic user and then disallow "%temp%*.exe" for example then if another folder is created so "%temp%\imabigvirus\*.exe" then this will still run.

 

 

There are two ways round it

Have million of policies for each new folder e.g:

%temp%*.exe

%temp%\*\*.exe

%temp%\*\*.exe

 

but this can be worked round pretty simply by creating one more folder than youve listed.

 

Second way is to set the Software Restriction Policy to be disabled by default and the specify places you allow rather than places you disallow stuff.

 

By setting EXE (and the others listed) as a Designated File Type it should be blocked, no matter how nested the folder is.

 

EDIT: just spotted a code quirk that may confuse some. Your command in FSRM states:

 

-command &{C:\Disconnect-SMBShares.ps1 -username '[source Io Owner]'}

 

but the name of the script in the post is Disconnect-SMBAccess.ps1

 

Otherwise all looking good - I've implemented some of these now as I'm pretty paranoid about it. Sadly FSRM can't email me using my Exchange box as it's hardened so won't work as an unauthenticated relay, and I lost many hours trying to get that working!

Edited by 3s-gtech
Posted

EDIT: just spotted a code quirk that may confuse some. Your command in FSRM states:

 

-command &{C:\Disconnect-SMBShares.ps1 -username '[source Io Owner]'}

 

but the name of the script in the post is Disconnect-SMBAccess.ps1

 

Otherwise all looking good - I've implemented some of these now as I'm pretty paranoid about it. Sadly FSRM can't email me using my Exchange box as it's hardened so won't work as an unauthenticated relay, and I lost many hours trying to get that working!

 

Good spot, I'll report it to get it modified as I can't edit it anymore.

 

 

One thing I have noticed while doing some research on AppLocker is that it requires Win 7 Enterprise and won't work with Win 7 Pro. Something for people to bear in mind before investing lots of time in it.

 

I am currently experimenting with White listing SRP though instead, I've got two victims volunteers to try it out over the next week or so before I push it out to the whole school.

Posted
By setting EXE (and the others listed) as a Designated File Type it should be blocked, no matter how nested the folder is.

 

EDIT: just spotted a code quirk that may confuse some. Your command in FSRM states:

 

-command &{C:\Disconnect-SMBShares.ps1 -username '[source Io Owner]'}

 

but the name of the script in the post is Disconnect-SMBAccess.ps1

 

Otherwise all looking good - I've implemented some of these now as I'm pretty paranoid about it. Sadly FSRM can't email me using my Exchange box as it's hardened so won't work as an unauthenticated relay, and I lost many hours trying to get that working!

 

Good spot, I'll report it to get it modified as I can't edit it anymore.

 

 

One thing I have noticed while doing some research on AppLocker is that it requires Win 7 Enterprise and won't work with Win 7 Pro. Something for people to bear in mind before investing lots of time in it.

 

I am currently experimenting with White listing SRP though instead, I've got two victims volunteers to try it out over the next week or so before I push it out to the whole school.

Corrected :)

  • Thanks 1
Posted

 

Otherwise all looking good - I've implemented some of these now as I'm pretty paranoid about it. Sadly FSRM can't email me using my Exchange box as it's hardened so won't work as an unauthenticated relay, and I lost many hours trying to get that working!

 

Should be able to allow anonymous from only the ip address of your fsrm server

 

http://johanveldhuis.nl/file-server-resource-manager-client-does-not-have-permission-to-send-as-this-sender/

Posted (edited)
I'm doing some testing at the momenet with a test OU, dfault is unrestricted and i'm trying to add the restrictions as shown in OP. I'm getting confused, if I use %appdata%*.exe It doesn't block the exe from running. If I use %appdata% it does. What gives? Edited by Pyroman
Posted
As I mentioned above, there shouldn't be a need to add the *.exe part, so long as you have .EXE as a Designated File Type in your SRPs. It does that bit for you, and saves you having to build nests of blocked folder.
Posted
As I mentioned above, there shouldn't be a need to add the *.exe part, so long as you have .EXE as a Designated File Type in your SRPs. It does that bit for you, and saves you having to build nests of blocked folder.

 

So if you just add the folder path - e.g. %appdata& - it automatically disallows all the executable filetypes listed in the Designated File Types?

Posted
As I mentioned above, there shouldn't be a need to add the *.exe part, so long as you have .EXE as a Designated File Type in your SRPs. It does that bit for you, and saves you having to build nests of blocked folder.

 

Cheers, now if i could only get powershell working!

 

PS C:\> powershell.exe -ExecutionPolicy ByPass -file c:\crypto.ps1
The term 'New-FSRMFileGroup' is not recognized as the name of a cmdlet, function, script file, or operable program. Che
ck the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\crypto.ps1:1 char:18
+ New-FSRMFileGroup <<<<  -Name "Cryptolocker Variants" -IncludePattern @("*.*AES256","*.*cry","*.*crypto","*.*darkness
","*.*enc","*.*encrypted","*.*exx","*.*kb15","*.*kraken","*.*locked","*.*nochance","*.*oshit","*@gmail_com_*","*@india.
com*","*cpyt*","*crypt*","*decipher*","*install_tor*.*","*keemail.me*","*qq_com*","*ukr.net*","*.*enc*","*restore_fi*.*
","*help_restore*.*","*how_to_recover*.*","*.ecc","*.exx","*.ezz","*.frtrss","*.vault","*want your files back.*","confi
rmation.key","enc_files.txt","last_chance.txt","recovery_file.txt","recovery_key.txt","
   + CategoryInfo          : ObjectNotFound: (New-FSRMFileGroup:String) [], CommandNotFoundException
   + FullyQualifiedErrorId : CommandNotFoundException

Posted
Cheers, now if i could only get powershell working!

Try this...

 

New-FSRMFileGroup –Name "Cryptolocker Variants" –IncludePattern @("*.*AES256","*.*cry","*.*crypto","*.*darkness","*.*enc","*.*encrypted","*.*exx","*.*kb15","*.*kraken","*.*locked","*.*nochance","*.*oshit","*@gmail_com_*","*@india.com*","*cpyt*","*crypt*","*decipher*","*install_tor*.*","*keemail.me*","*qq_com*","*ukr.net*","*.*enc*","*restore_fi*.*","*help_restore*.*","*how_to_recover*.*","*.ecc","*.exx","*.ezz","*.frtrss","*.vault","*want your files back.*","confirmation.key","enc_files.txt","last_chance.txt","recovery_file.txt","recovery_key.txt","vault.hta","vault.key","vault.txt","*.aaa","help_restore*.*","how_to_recover*.*"," install_tor*.*")

 

@halbaradkenafin's PowerShell command includes an unnecessary line break. :)

Posted (edited)

Obviously you'll need the FSRM role installed on the file server to also get the Powershell commands:

 

Install-WindowsFeature FS-Resource-manager -includemanagementtools

Edited by halbaradkenafin
Posted
Implemented this but it only seems to wipe out the connections to the shares on the file server where the files are detected, as opposed to all of them. I'll have a look at it again later.
Posted
Obviously you'll need the FSRM role installed on the file server to also get the Powershell commands:

 

Instal-WindowsFeature FS-Resouce-manager -includemanagementtools

 

Ah, just done some googling. I'm still on Server 2008R2 and might need to use the filescrn.exe

Posted
Implemented this but it only seems to wipe out the connections to the shares on the file server where the files are detected, as opposed to all of them. I'll have a look at it again later.

 

You need to add in your other servers using the Invoke-Command section, just duplicate it for the needed servers and update the names etc.

Posted (edited)

To me, the protection against cryptolocker and other malware/viruses is a lot bigger than just SRP's. Viruses and malware have multiple attack vectors, with browser plugins being one of the most targeted (cryptolockers main infection path is adobe flash exploitation). SRP's are good protection but there doesn't seem to be much other than them mentioned in this thread. Below is my checklist I have put together on some other protection methods in order of importance to provide defence in depth.

 






























































Backups Make sure all backups are regularly done and have adequate retention age.
Educate Staff Make sure all staff are cautious on opening email attachments and links, and know what to look for
Patch OS and Plugins Make sure all windows and browser updates are applied and any plugins are installed sparingly, and updated
Check any old versions have been removed

Cleanup Script Below
on error resume next

dim WshShell
dim RegKey
dim ScriptVerKey

Set WshShell = CreateObject("WScript.Shell")

'checks to see if registry key exists, if it does, the cleanup runs.
RegKey = "HKLM\SOFTWARE\EDU\Cleanup"
ScriptVerKey = WshShell.RegRead(RegKey & "JAVAOldVer")

if ScriptVerKey <> "1" Then
Cleanup()
Else
WScript.Quit
End If

Sub Cleanup()
' Uninstall REM Uninstall Java 8 Update 51
WshShell.Run "msiexec /x {26A24AE4-039D-4CA4-87B4-2F83218051F0} /q",1,True
' Uninstall REM Uninstall Java 8 Update 51
WshShell.Run "msiexec /x {26A24AE4-039D-4CA4-87B4-2F86418051F0} /q",1,True
' Uninstall REM Uninstall Java 8 Update 45
WshShell.Run "msiexec /x {26A24AE4-039D-4CA4-87B4-2F83218045F0} /q",1,True
' Uninstall REM Uninstall Java 8 Update 45 - 64 bit
WshShell.Run "msiexec /x {26A24AE4-039D-4CA4-87B4-2F86418045F0} /q",1,True
' Uninstall REM Uninstall Java 8 Update 31
WshShell.Run "msiexec /x {26A24AE4-039D-4CA4-87B4-2F83218031F0} /q",1,True
' Uninstall REM Uninstall Java 8 Update 31 - 32 bit
WshShell.Run "msiexec /x {26A24AE4-039D-4CA4-87B4-2F86418031F0} /q",1,True
' Uninstall REM Uninstall Java 8 Update 25
WshShell.Run "msiexec /x {26A24AE4-039D-4CA4-87B4-2F83218025F0} /q",1,True
' Uninstall REM Uninstall Java 8 Update 25 - 64 bit
WshShell.Run "msiexec /x {26A24AE4-039D-4CA4-87B4-2F86418025F0} /q",1,True

' Uninstall REM Java 7 Update 67
WshShell.Run "msiexec /x {26A24AE4-039D-4CA4-87B4-2F03217067FF} /q",1,True
' Uninstall REM Java 7 Update 60
WshShell.Run "msiexec /x {26A24AE4-039D-4CA4-87B4-2F03217060FF} /q",1,True
' Uninstall REM Java 7 Update 55
WshShell.Run "msiexec /x {26A24AE4-039D-4CA4-87B4-2F83217055FF} /q",1,True
' Uninstall REM Java 7 Update 51
WshShell.Run "msiexec /x {26A24AE4-039D-4CA4-87B4-2F83217051FF} /q",1,True
' Uninstall REM Java 7 Update 45
WshShell.Run "msiexec /x {26A24AE4-039D-4CA4-87B4-2F83217045FF} /q",1,True
' Uninstall REM Java 7 Update 40
WshShell.Run "msiexec /x {26A24AE4-039D-4CA4-87B4-2F83217040FF} /q",1,True
' Uninstall REM Java 7 Update 40 – 64 bit
WshShell.Run "msiexec /x {26A24AE4-039D-4CA4-87B4-2F86417040FF} /q",1,True
' Uninstall REM Java 7 Update 25 – 64 bit
WshShell.Run "msiexec /x {26A24AE4-039D-4CA4-87B4-2F86417025FF} /q",1,True

' Uninstall REM Java SE Development Kit 7 Update 5
WshShell.Run "msiexec /x {32A3A4F4-B792-11D6-A78A-00B0D0170050} /q",1,True
' Uninstall REM Java SE Development Kit 7 Update 45
WshShell.Run "msiexec /x {32A3A4F4-B792-11D6-A78A-00B0D0170450} /q",1,True

' Uninstall REM Adobe Flash Player 11 Plugin
WshShell.Run "msiExec.exe /X{9BFB1FAB-8FC4-4FAA-9B2D-2B121834B659} /q",1,True

'regkey below stops the script from running again
WshShell.RegWrite "HKLM\Software\EDU", "Default"
WshShell.RegWrite "HKLM\Software\EDU\Cleanup", "Default"
WshShell.RegWrite "HKLM\Software\EDU\Cleanup\JAVAOldVer", 1, "REG_SZ"

End Sub
AntiVirus Make Sure Antivirus is up to date and active scanning enabled on all machines
UTM Check Virus/Malware scanning is enabled for HTTP/HTTPS traffic as well as email.
Enable Greylisting ( builds and uses a database of ’known-good’ SMTP hosts that resend messages after receiving a temporary error)
Enable BATV (Bounce Address Tag Validation) signs the reverse path of outgoing email, so it is possible to detect and drop spam and virus backscatter)
Enable SPF check querying allowed sending hosts for a domain from DNS.
User Privileges Make sure all users have the bare minimum file permissions needed to perform their job. This will help reduce what can be infected
ACLS Set ACL's on VLANS to reduce what can be accessed by each machine. This will help reduce infection rate
Enable Click to run for Internet Explorer Create Registry Key through GPO Preferences under User config for both staff and students
HKCU\Software\Microsoft\Windows\CurrentVersion\Ext\Stats\{D27CDB6E-AE6D-11CF-96B8-444553540000}\iexplore\AllowedDomains\RandomSite
Enable Click to run for Chrome GPO User Configuration\Administrative Templates\Google\Google Chrome\Content Settings\setting="Click to play"
Disable Macros in MS Office Set the below for each office application in the users GPO

User Configuration->Administrative Templates->Classic Administrative Templates(ADM)->Microsoft Excel 2010->Excel Options->Security->Trust Center->VBA Macro Notification Setting
Block Malicious filetypes on Email Block Malicious file types being sent on Email including Zip's EXE's etc
Software Restriction Policy Disallowed by default
Whitelist the below
C:\Program Files (X86)
C:\Program Files
C:\Windows
C:\Program Data
Network Shares
File Screening Enable file screening for shared and home drives, blocking any malicious file extensions
USB Security Check SRP's and AV protect against malicious USB's
BIOS Security Checkboot from USB is disabled, all Bios updates have been done and password protected
Edited by rrrrr
  • Thanks 1
Posted
Obviously you'll need the FSRM role installed on the file server to also get the Powershell commands:

 

[color="#FF0000"]Instal[/color]-WindowsFeature FS-[color="#FF0000"]Resouce[/color]-manager -includemanagementtools

^ That command doesn't look quite right. :)

 

Install-WindowsFeature –Name FS-Resource-Manager –IncludeManagementTools

Posted

To add to @rrrrr's post here are a few more suggestions...

 

How to mitigate 85% of threats with only four strategies « SecureList

 

Through comprehensive, detailed analysis of local attacks and threats, the Australian Signals Directorate (ASD) has found that at least 85 per cent of the targeted cyber-intrusions it responds to could be mitigated by four basic strategies. Three of them are related to specialized security solutions. Kaspersky Lab products include technological solutions to cover these first three major strategies:

 

  • Use application whitelisting to help prevent malicious software and unapproved programs from running
  • Patch applications such as Java, PDF viewers, Flash, web browsers and Microsoft Office
  • Patch operating system vulnerabilities
  • Restrict administrative privileges to operating systems and applications, based on user duties.

 

http://vgy.me/2JLSlH.jpg

  • Thanks 1
Posted (edited)

Further to the Software Restriction Policies, once you've blocked %appdata% you need to unblock

%AppData%\Microsoft\Internet Explorer\Quick Launch\User Pinned\StartMenu

if you want Start Menu pinned items to still work. Otherwise it blocks them completely - to the point you can open a shortcut from the Start Menu fine, then right-click>Pin, and it'll then immediately stop working.

 

EDIT:

%AppData%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar

for your taskbar as well. I hadn't set that because we don't pin anything there for users (didn't want to have to explain the difference between open programs and shortcuts when we switched from XP), until I tried to open something from my taskbar and realised no-one else has them, but I have 8.

Edited by sonofsanta
  • Thanks 2
Posted (edited)

Some further updates from my testing...

 

1) The *.*enc* entry in the File Group just triggered a false positive for a user who opened a PowerPoint, and when Windows tried to create the Recent Document link, it picked up %appdata%\Microsoft\Windows\Recent\4. Ageing Population and Dependency ratio.lnk - the 4. fooled it into thinking the extension was Ageing Population and Dependency ratio.lnk, daft as that is. Computers!

 

2) The PowerShell scripts aren't firing because of the ExecutionPolicy - if I set the following arguments in the Command tab

-ExecutionPolicy Bypass -command &{C:\Disconnect-SMBShares.ps1 -username '[source Io Owner]'}

then it fires fine and works a charm :)

 

I'm going to leave it just firing emails for now, not triggering the script, so I can check for more false positives, but all in all it's a great system - cheers @halbaradkenafin :D

Edited by sonofsanta
omg the spleling
Posted
We get one or two false positives a week, it's the nature of such a detection method and something that you can quickly work around with the script that's there (I've always got at least one PS Prompt open that I can quickly run the script from).

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...