Linux:最新Bash漏洞修补初级方案
June 16, 2015
Bash爆出远程解析命令执行漏洞(CVE-2014-6271),波及各大Linux发行版与MacOSX系统。漏洞可以直接在Bash支持的Web CGI环境下远程执行任意命令。
bash注入公开之后根据官方的文档发现,攻击者只要保持
$ env x='() { :;}; echo vulnerable' bash -c "echo this is a test"
中前四个字符不改变,也就是'(){ 固定,后面的:;}中符合规定的语法就可以进行攻击测试。虽然漏洞的影响非常大,但是相比于‘Openssl’来说,利用的环境是有限的。
防御bash注入的方法,首先需要更新bash,yum update下就OK了,更新到bash-4.1.2-15。
或者是添加mod_security:
Request Header values: SecRule REQUEST_HEADERS "^() {" "phase:1,deny,id:1000000,t:urlDecode,status:400,log,msg:'CVE-2014-6271 - Bash Attack'" SERVER_PROTOCOL values: SecRule REQUEST_LINE "() {" "phase:1,deny,id:1000001,status:400,log,msg:'CVE-2014-6271 - Bash Attack'" GET/POST names: SecRule ARGS_NAMES "^() {" "phase:2,deny,id:1000002,t:urlDecode,t:urlDecodeUni,status:400,log,msg:'CVE-2014-6271 - Bash Attack'" GET/POST values: SecRule ARGS "^() {" "phase:2,deny,id:1000003,t:urlDecode,t:urlDecodeUni,status:400,log,msg:'CVE-2014-6271 - Bash Attack'" File names for uploads: SecRule FILES_NAMES "^() {" "phase:2,deny,id:1000004,t:urlDecode,t:urlDecodeUni,status:400,log,msg:'CVE-2014-6271 - Bash Attack'"
虽然有人给出了在iptable中添加规则,但是觉得在iptable中添加规则会规定的太死,不过也可以去尝试下:
iptables --append INPUT -m string --algo kmp --hex-string '|28 29 20 7B|' --jump DROP iptables using -m string --hex-string '|28 29 20 7B|'
0 Comments