本文主要是介绍linux漏洞修复步骤,redhat 破壳漏洞修补方法,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
***利用该漏洞,可以执行任意代码,甚至可以不需要经过认证,就能远程取得系统的控制权,包括执行恶意程序,或在系统内植入***,或获取敏感信息。而且,Bash从Bash 1.14到Bash 4.3版本全部存在该漏洞。
检测脚本:#!/bin/bash
EXITCODE=0
# CVE-2014-6271
CVE20146271=$(env 'x=() { :;}; echo vulnerable' 'BASH_FUNC_x()=() { :;}; echo vulnerable' bash -c "echo test" 2>&1 | grep 'vulnerable' | wc -l)
echo -n "CVE-2014-6271 (original shellshock): "
if [ $CVE20146271 -gt 0 ]; then
echo -e "\033[91mVULNERABLE\033[39m"
EXITCODE=$((EXITCODE+1))
else
echo -e "\033[92mnot vulnerable\033[39m"
fi
# CVE-2014-6277
# it is fully mitigated by the environment function prefix passing avoidance
CVE20146277=$((shellshocker="() { x() { _;}; x() { _;} </dev/null || echo vulnerable) | grep 'vulnerable' | wc -l)
echo -n "CVE-2014-6277 (segfault): "
if [ $CVE20146277 -gt 0 ]; then
echo -e "\033[91mVULNERABLE\033[39m"
EXITCODE=$((EXITCODE+2))
else
echo -e "\033[92mnot vulnerable\033[39m"
fi
# CVE-2014-6278
CVE20146278=$(shellshocker='() { echo vulnerable; }' bash -c shellshocker 2>/dev/null | grep 'vulnerable' | wc -l)
echo -n "CVE-2014-6278 (Florian's patch): "
if [ $CVE20146278 -gt 0 ]; then
echo -e "\033[91mVULNERABLE\033[39m"
EXITCODE=$((EXITCODE+4))
else
echo -e "\033[92mnot vulnerable\033[39m"
fi
# CVE-2014-7169
CVE20147169=$((cd /tmp; rm -f /tmp/echo; env X='() { (a)=>\' bash -c "echo echo nonvuln" 2>/dev/null; [[ "$(cat echo 2> /dev/null)" == "nonvuln" ]] && echo "vulnerable" 2> /dev/null) | grep 'vulnerable' | wc -l)
echo -n "CVE-2014-7169 (taviso bug): "
if [ $CVE20147169 -gt 0 ]; then
echo -e "\033[91mVULNERABLE\033[39m"
EXITCODE=$((EXITCODE+8))
else
echo -e "\033[92mnot vulnerable\033[39m"
fi
# CVE-2014-7186
CVE20147186=$((bash -c 'true </dev/null || echo "vulnerable") | grep 'vulnerable' | wc -l)
echo -n "CVE-2014-7186 (redir_stack bug): "
if [ $CVE20147186 -gt 0 ]; then
echo -e "\033[91mVULNERABLE\033[39m"
EXITCODE=$((EXITCODE+16))
else
echo -e "\033[92mnot vulnerable\033[39m"
fi
# CVE-2014-7187
CVE20147187=$(((for x in {1..200}; do echo "for x$x in ; do :"; done; for x in {1..200}; do echo done; done) | bash || echo "vulnerable") | grep 'vulnerable' | wc -l)
echo -n "CVE-2014-7187 (nested loops off by one): "
if [ $CVE20147187 -gt 0 ]; then
echo -e "\033[91mVULNERABLE\033[39m"
EXITCODE=$((EXITCODE+32))
else
echo -e "\033[92mnot vulnerable\033[39m"
fi
# CVE-2014-
CVE2014=$(env X=' () { }; echo vulnerable' bash -c 'date' | grep 'vulnerable' | wc -l)
echo -n "CVE-2014- (exploit 3 on http://shellshocker.net/): "
if [ $CVE2014 -gt 0 ]; then
echo -e "\033[91mVULNERABLE\033[39m"
EXITCODE=$((EXITCODE+64))
else
echo -e "\033[92mnot vulnerable\033[39m"
fi
exit $EXITCODE
执行代码如果显示如下结果,则说明该机器存在该漏洞。
解决办法:
1、使用 yum update bash 更新升级 bash。
2、登录redhat官网,下载最新bash,编译更新。
这篇关于linux漏洞修复步骤,redhat 破壳漏洞修补方法的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!