Last active
December 14, 2015 07:19
-
-
Save mavam/5050260 to your computer and use it in GitHub Desktop.
Miniduke C&C detector
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@load base/frameworks/notice | |
module Malware; | |
export { | |
redef enum Notice::Type += { | |
## Miniduke C&C activity. | |
Miniduke_CC_Activity | |
}; | |
} | |
redef record HTTP::Info += { | |
miniduke: string &optional; | |
}; | |
function report(c: connection, uri: string) | |
{ | |
local param = split1(uri, /=/)[2]; | |
local payload = decode_base64(gsub(gsub(param, /-/, "+"), /_/, "/")); | |
NOTICE([$note=Miniduke_CC_Activity, | |
$msg=fmt("Miniduke C&C activity: %s", payload), | |
$conn=c]); | |
} | |
event http_request(c: connection, method: string, original_URI: string, | |
unescaped_URI: string, version: string) | |
{ | |
if ( /index\.php\?[[:alnum:]]+=([=-_]|[[:alnum:]])+/ in unescaped_URI ) | |
c$http$miniduke = unescaped_URI; | |
} | |
event http_message_done(c: connection, is_orig: bool, stat: http_message_stat) | |
{ | |
if ( is_orig || ! c$http?$miniduke || /image\/gif/ !in c$http$mime_type ) | |
return; | |
report(c, c$http$miniduke); | |
delete c$http$miniduke; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Finally got a real PCAP trace to test it...and it works.