Skip to content

Commit

Permalink
add new type of bash special obfuscation detect rules
Browse files Browse the repository at this point in the history
  • Loading branch information
We5ter committed May 7, 2019
1 parent ac83974 commit 942ab5f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion flerken/config/rules/linux_rule.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@
"file_io": {
"0": {"regex": "((eval|(bash\\s+-c)|(sh\\s+-c))[^\\x7c\\x3c\\x3e]*?(\\x22\\$\\x28)(.*?)(\\x29\\x22))|(eval|(bash\\s+-c)|(sh\\s+-c))[^\\x7c\\x3c\\x3e]*?(\\x27\\$\\x28)(.*?)(\\x29\\x27)"},
"1": {"regex": "(printf|echo)[^\\x7c\\x3c\\x3e]*?((\\x22.*?\\x22)|(\\x27.*?\\x27))\\x3e.*?\/(\\w+.*?\\x3b)"},
"2": {"regex": "[\\x3b](cat|tail|head).*?\/\\w+.*?"}
"2": {"regex": "[\\x3b](cat|tail|head).*?\/\\w+.*?"},
"3": {"regex": "(echo|printf)[^\\x7c]*?((\\x22.*?\\x24\\x7b[^~]*?~{2}\\x7d.*?\\x22)|(\\x27.*?\\x24\\x7b[^~]*?~{2}\\x7d.*?\\x27))"}
}
}
}
2 changes: 2 additions & 0 deletions flerken/control/plugins/linux_special_detect_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ def _check_file_io(self):
variable_name = fi_rules_compiled[0].search(self.cmd).group(5)
if fi_rules_compiled[1].search(self.cmd) != None and fi_rules_compiled[2].search(self.cmd) != None:
return True
elif fi_rules_compiled[3].search(self.cmd) != None:
return True
else:
return False

Expand Down

0 comments on commit 942ab5f

Please sign in to comment.