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

ER rule to detect echo and pipe commands

Hi,

I would like to detect commands like this one :

cmd.exe /c echo 123 > \\.\pipe\6g789h

which is an artifact often used by Cobalt Strike beacon and Metasploit :

In other words, the rule will be used to identifying instances of Command Processor cmd.exe where the command line contains the keywords echo and pipe.

Thank you for your help!

Buijspa

1 Reply

Re: ER rule to detect echo and pipe commands

Because of how the OS interprets some stuff, you currently can't do it by command line, unfortunately. I'm pressing them on that a bit though.

This should cover you though where you can add known abused pipe names.

Rule {
    Process {
        Include OBJECT_NAME { -v ** }
    }
    Target {
        Match FILE {
			Include OBJECT_NAME { 
			-v "**pipe\\MSSE-*-server"
			-v "**pipe\\msagent_*"
			-v "**pipe\\postex_*"
			}
		Include -access "CONNECT_NAMED_PIPE"
		}	
    }
}

 

This might work for what you need too.. I haven't tested it, but would be curious as to the results:

 

Rule {
    Process {
        Include OBJECT_NAME { -v "cmd.exe" }
    }
    Target {
        Match FILE {
			Include OBJECT_NAME { 
			-v "**pipe\\**"
			}
		Include -access "CONNECT_NAMED_PIPE"
		}	
    }
}

 

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