cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ENS rules for blocking threats from Powershell

Hi!

I need to create a set of rules in my environment in the ENS tools to block possible malicious activities involving Porwershell.

The objective is not to block Powershell completely, but rather macros, exploits, and other possible threats that may arise from the use of Powershell by malicious entities.

What are the recommendations for creating these rules?

1 Reply

Re: ENS rules for blocking threats from Powershell

1) Enable AMSI in TP and the AMSI integration in ATP.
2) Enable the AMSI protection rules in Exploit Prevention.

3) you can create custom rules like this to block specific command lines:

Rule {
	Process {
		Exclude OBJECT_NAME {
			-v "ParentProcessIwanttoAllow1.exe"
			-v "ParentProcessIwanttoAllow2.exe"
		}
	}
	Target {
		Match PROCESS {
			Include DESCRIPTION {
				-v "Windows PowerShell"
			}
			Include PROCESS_CMD_LINE { 
				-v "* -e *"
				-v "* -en *"
				-v "* -enc *"
				-v "*webrequest*"
				-v "*iwr*"
			}
			Exclude PROCESS_CMD_LINE { 
				-v "*excludedString1*"
				-v "*excludedString2*"
			}
			Include -access "CREATE"
		}
	}
}

 

If they get long you can break them up into chunks:

 

Rule {
	Process {
		Exclude OBJECT_NAME {
			-v "ParentProcessIwanttoAllow1.exe"
			-v "ParentProcessIwanttoAllow2.exe"
		}
	}
	Target {
		Match PROCESS {
			Include DESCRIPTION {
				-v "Windows PowerShell"
			}
			Include AggregateMatch {
				Include PROCESS_CMD_LINE { 
					-v "* -e *"
					-v "* -en *"
					-v "* -enc *"
				}
				Exclude PROCESS_CMD_LINE { 
					-v "*excludedString1*"
					-v "*excludedString2*"
				}
			}
			Include AggregateMatch {
				Include PROCESS_CMD_LINE { 
					-v "*webrequest*"
					-v "*iwr*"
				}
				Exclude PROCESS_CMD_LINE { 
					-v "*excludedString1*"
					-v "*excludedString2*"
				}
			}
			Include -access "CREATE"
		}
	}
}

 

Test them thoroughly just monitoring them before blocking.  Excluded strings or parent processes as it makes sense.  

You Deserve an Award
Don't forget, when your helpful posts earn a kudos or get accepted as a solution you can unlock perks and badges. Those aren't the only badges, either. How many can you collect? Click here to learn more.

Community Help Hub

    New to the forums or need help finding your way around the forums? There's a whole hub of community resources to help you.

  • Find Forum FAQs
  • Learn How to Earn Badges
  • Ask for Help
Go to Community Help

Join the Community

    Thousands of customers use our Community for peer-to-peer and expert product support. Enjoy these benefits with a free membership:

  • Get helpful solutions from product experts.
  • Stay connected to product conversations that matter to you.
  • Participate in product groups led by employees.
Join the Community
Join the Community