当前位置:网站首页>Samba 远程命令执行漏洞(CVE-2017-7494)
Samba 远程命令执行漏洞(CVE-2017-7494)
2022-07-31 13:15:00 【半点闲】
作者:高玉涵
时间:2022.7.29 17:00
博客:blog.csdn.net/cg_i
环境:Samba版本:4.6.3(该漏洞在4.6.4被修复)
原理
Samba允许连接一个远程的命名管道,并且在连接前会调用is_known_pipename()
函数验证管道名称是否合法。在is_known_pipename()
函数中,并没有检查管道名称中的特殊字符,加载了使用该名称的动态链接库。导致攻击者可以构造一个恶意的动态链接库文件,执行任意代码。
该漏洞要求的利用条件:
- 拥有共享文件写入权限,如:匿名可写等
- 需要知道共享目录的物理路径
参考:
- https://medium.com/@lucideus/sambacry-rce-exploit-lucideus-research-3a3e5bd9e17c
- https://github.com/opsxcq/exploit-CVE-2017-7494
- http://bobao.360.cn/learning/detail/3900.html
测试过程
测试环境运行后,监听445端口,默认开启了一个共享“myshare”,共享的目录为/home/share
,可读可写。
我们可以在Linux下用smbclient(安装:apt install smbclient
)连接试试:
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-PAXcIrlb-1659085057053)(02.png)]
成功连接。大家测试的时候如果连接不成功,有可能是国内运营商封了445端口,最好在本地或虚拟机测试,比如上图。
参考#224,新版metasploit可能无法复现这个漏洞。我们使用https://github.com/opsxcq/exploit-CVE-2017-7494来复现。
在目标服务器上执行/home/share/libbindshell-samba.so
,其中myshare是分享名称(在vulhub中为myshare
),而/home/share
是对应的可写目录。-u
和-p
用来指定用户名、密码,当前环境是一个匿名smb,所以填写任意信息均可。因为libbindshell-samba.so是一个bindshell,监听地址是6699,所以我们通过-P
指定这个端口。在实际渗透中,我们可以修改libbindshell-samba.c
,写入任意其他代码,如反弹shell,避免使用bindshell。
./exploit.py -t your-ip -e libbindshell-samba.so -s myshare -r /home/share/libbindshell-samba.so -u guest -p guest -P 6699
成功执行命令:
边栏推荐
- IDEA如何运行web程序
- 六石编程学:不论是哪个功能,你觉得再没用,会用的人都离不了,所以至少要做到99%
- golang八股文整理(持续搬运)
- 基于去噪自编码器的故障隔离与识别方法
- 硬盘分区,拓展C盘,不重装系统,不重装D盘软件的全教程。
- JSP response对象简介说明
- PyQt5 rapid development and actual combat 10.2 compound interest calculation && 10.3 refresh blog clicks
- ECCV2022: Recursion on Transformer without adding parameters and less computation!
- Install the latest pytorch gpu version
- Productivity Tools and Plugins
猜你喜欢
报错:npm ERR code EPERM
NameNode (NN) and SecondaryNameNode (2NN) working mechanism
golang-gin-优雅重启
CentOS7 安装MySQL 图文详细教程
Batch大小不一定是2的n次幂!ML资深学者最新结论
电脑重要文件很多,如何备份比较安全?
C# 中的Async 和 Await 的用法详解
How IDEA runs web programs
golang-gin-pprof-使用以及安全问题
Introduction to the PartImageNet Semantic Part Segmentation dataset
随机推荐
The use of C# control CheckBox
报错IDEA Terminated with exit code 1
网络协议及相关技术详解
PartImageNet物体部件分割(Semantic Part Segmentation)数据集介绍
SAP message TK 248 solved
爱可可AI前沿推介(7.31)
sqlalchemy 判断一个array 类型的字段是否和一个array有至少一个一致的数据
selenium被反爬了怎么办?
CentOS7 安装MySQL 图文详细教程
CentOS7 installation MySQL graphic detailed tutorial
P5019 [NOIP2018 提高组] 铺设道路
Productivity Tools and Plugins
分布式锁有哪些,怎么实现(分布式锁的三种实现的对比)
Centos7 install mysql5.7 steps (graphical version)
C#获得网卡信息 NetworkInterface IPInterfaceProperties
C#控件CheckBox的使用
Edge Cloud Explained in Simple Depth | 4. Lifecycle Management
C# List用法 List介绍
生产力工具和插件
Reasons and solutions for Invalid bound statement (not found)