这个脚本用于检测 Bash 漏洞(CVE-2014-6271,绰号 “ShellShock”)被成功利用的情况。它比目前大多数检测方案更全面,因为它会监视被攻击主机的行为,以判断其是否可能已被成功入侵,或是否确实存在漏洞。
如果发现某台主机通过 HTTP 收到攻击,Bro 会监视该主机是否会下载投放器(dropper)载荷或发送 ICMP ping。还可能出现更多响应机制,但这已足以覆盖目前大多数已知的响应机制。默认情况下,此脚本配置为监视 MIME 类型为 application/x-executable 的文件,这可以覆盖此处攻击中列出的投放器:
https://gist.github.com/anonymous/929d622f3b36b00c0be1
另外,如果攻击者只是用 ping 命令进行测试,此脚本会在检测到攻击后的短时间内,监视受害主机是否发出 ping 命令。
此脚本还会在 HTTP 日志的 “tags” 字段中为任何疑似攻击的请求添加标签。标签内容为:ShellShock::HIT。
顺便说一下,此脚本支持集群(cluster-aware),可以很好地在 Bro 集群上运行,也适合在运营环境中使用。
此脚本目前支持 Bro 2.3、2.4 和 2.5。如果您在受支持的 Bro 版本上遇到问题,请提交工单。
本仓库包含一个示例数据包捕获文件 exploit.pcap,其中包含对示例服务器的攻击。以下是输出的相关日志。
notice.log
#separator \x09
#set_separator ,
#empty_field (empty)
#unset_field -
#path notice
#open 2014-09-26-10-47-02
#fields ts uid id.orig_h id.orig_p id.resp_h id.resp_p fuid file_mime_type file_desc proto note msg sub src dst p peer_descr actions suppress_for dropped remote_location.country_code remote_location.region remote_location.city remote_location.latitude remote_location.longitude
#types time string addr port addr port string string string enum enum string string addr addr port count string set[enum] interval bool string string string double double
1411666207.583791 - - - - - - - - - ShellShock::Scanner 10.246.50.2 sent at least 1 CVE-2014-6271 exploit attempts in 0m0s. Used payload: "() { :;}; /bin/ping -c1 10.246.50.2" :: against sample victim hosts: 10.246.50.6 10.246.50.2 - - - bro Notice::ACTION_LOG 3600.00000-
1411666207.588581 - - - - - - - - - ShellShock::Exploit High likelihood of successful CVE-2014-6271 exploitation against 10.246.50.6. Attack over HTTP and sent a ping to 10.246.50.2 within 0.000 seconds of an attack. Attack over HTTP and sent a ping to 10.246.50.2 within 0.000 seconds of an attack. 10.246.50.6 - - - bro Notice::ACTION_LOG 3600.000000 F - - - - -
http.log
#separator \x09
#set_separator ,
#empty_field (empty)
#unset_field -
#path http
#open 2014-09-26-10-47-02
#fields ts uid id.orig_h id.orig_p id.resp_h id.resp_p trans_depth method host uri referrer user_agent request_body_len response_body_len status_code status_msg info_code info_msg filename tags username password proxied orig_fuids orig_mime_types resp_fuids resp_mime_types
#types time string addr port addr port count string string string string count count count string count string string set[enum] string string set[string] vector[string] vector[string] vector[string] vector[string]
1411666207.583791 CC7s232GDnmtxZUly5 10.246.50.2 43616 10.246.50.6 80 1 GET 10.246.50.6 /exploitable.cgi - () { :;}; /bin/ping -c1 10.246.50.2 0 615 500 Internal Server Error - - - ShellShock::HIT - - - - - FgVgjb1GU12ixSuugc text/html
#close 2014-09-26-10-47-02
bro-pkg refresh
bro-pkg install corelight/bro-shellshock
这里有几个配置变量。
## The number of apparent attacks a host must send for it to be
## detected as ShellShock::Scanner.
const ShellShock::scan_threshold = 10 &redef;
## The period over which scanner detection is performed.
const ShellShock::scan_detection_period = 10min &redef;
这些变量可用于调整对 ShellShock 扫描者的监视时长,以及在其被判定为扫描并生成通知之前所需发生的攻击次数。
Seth Hall <[email protected]>
Stephen Hosom - Provided a fully exploiting packet capture.
Nick Weaver - Valuable discussion on how shellshock is and isn't exploitable.
Vlad Grigorescu - Feature request after feature request.
Mike Patterson - Suggesting to watch for shellscripts as a post-exploit dropper.