cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
El1ishac
Level 7
Report Inappropriate Content
Message 1 of 6

Expert Rule - How to block a powershell command that includes multiple words

Hello,

I am looking to create an expert rule for the following example:

Start-Process powershell.exe -WindowStyle hidden calc.exe

the above is an example and I would like to create an expert rule that would pick this up based on any command that included: start-Process & -WindowStyle & hidden.

And they could be in any order.

I created the following but does not seem to work:

Rule {
Process {
Include OBJECT_NAME { -v "**powershell**"}
Exclude USER_NAME { -v "NT Authority\\SYSTEM" }
}
Target {
Match PROCESS {
Include AggregateMatch {
Include PROCESS_CMD_LINE { -v "**start-Process **" }
Include PROCESS_CMD_LINE { -v "**-WindowStyle **" }
Include PROCESS_CMD_LINE { -v "**hidden**" }
}
}
}
}

Any help would be much appreciated. 

5 Replies
Sivakumar1
McAfee Employee
McAfee Employee
Report Inappropriate Content
Message 2 of 6

Re: Expert Rule - How to block a powershell command that includes multiple words

Hello @El1ishac . Thank you for reaching out to McAfee Enterprise Support Community. We might have to test this rule in lab and will give an update ont his as early as possible.

Was my reply helpful?
If you find this post useful, Please give it a Kudos! Also, Please don't forget to select "Accept as a solution" if this reply resolves your query!

El1ishac
Level 7
Report Inappropriate Content
Message 3 of 6

Re: Expert Rule - How to block a powershell command that includes multiple words

@raskin Ok thank you, do you know roughly how long this will take?

Re: Expert Rule - How to block a powershell command that includes multiple words

Rule {
Process {
}
Target {
Match PROCESS {

Include OBJECT_NAME { -v "powershell.exe"}
Exclude USER_NAME { -v "NT Authority\\SYSTEM" }
Include AggregateMatch {
Include PROCESS_CMD_LINE { -v "**start-Process **" }
Include PROCESS_CMD_LINE { -v "**-WindowStyle **" }
Include PROCESS_CMD_LINE { -v "**hidden**" }
}
}
}
}

El1ishac
Level 7
Report Inappropriate Content
Message 5 of 6

Re: Expert Rule - How to block a powershell command that includes multiple words

Should the first Process be opened and closed straight away? just double checking.

Re: Expert Rule - How to block a powershell command that includes multiple words

You can include a Include OBJECT_NAME { -v "**" }, but the basic idea is that you want to allow for any parent process, which goes in there.  The second area is the target or child process, which is PowerShell in this case. 

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 the McAfee Community for peer-to-peer and expert product support. Enjoy these benefits with a free membership:

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