Hi there,
by now the topic is a little bit outdated, but just in case anyone stumbles across this through google (like I did),
here is what we did to block shellshock.
To explain Mikrotik rules, let's discuss this example:
^.*(get|GET|post|POST).+(\(\))
As you see, you need to set your expression in () and escape the real () as \(\)
I recommend this article, as it explains the get/post part and how an attack works:
http://blog.cloudflare.com/inside-shellshock/
But this just checks for "()" instead of "() {", but helped us in the first days, giving time to patch our servers.
To make things worse there are (at the moment) at least 6 different ways to exploit shellshock.
And one way to circumvent your hex-code rule is using more spaces like "() {"
Long story short, this regex checks for spaces and tabs, too:
^.*(get|GET|post|POST).+(\(\)\s*\t*\{.*;\s*\}\s*)
---
Back to MikroTik, what we do is:
added one filter rule at the very top that drops everything from src adress list "xyz"
added a second rule that checks for the above layer7 regex, action: add src to adress list "xyz" with timeout 2days
Make sure you use the rules in that order, so if an attacker comes back within 2days, doesn't need to be checked again, gets dropped by the 1st rule. Of course the name of the adress list is completely up to you.
The part with 2days is made to keep adress list short, maybe you just have a little Routerboard instead of a CCR, then layer7 filter can consume a lot processing power depending on your load, cause every single packed gets checked against all IP's in the adress list in real-time.
Anyway, most shellshocker these days are:
a) script kiddies or bots with try and error, if they get blocked, they search elsewhere (and if they come back, get blocked for another 2 days)
b) scanning sites/companies that do these "awesome" reports in the news like "73,42% of 17.934 servers in xyz country are vulnerable"
Sure, we want to block the little %'s of bad guys, thats why we are here.
In our case, this regex blocked 325 IP's within the first 24h after setup.
---
Credits
btw. found the regex here:
https://twitter.com/MalwrSignatures/sta ... 1086248960