当前位置:网站首页>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
成功执行命令:
边栏推荐
- Network layer key protocol - IP protocol
- 分布式锁有哪些,怎么实现(分布式锁的三种实现的对比)
- The operator,
- golang-gin - graceful restart
- C# control StatusStrip use
- 365天挑战LeetCode1000题——Day 044 最大层内元素和 层次遍历
- 基于神经网络的多柔性梁耦合结构振动控制
- SAP 电商云 Spartacus SSR Optimization Engine 几处 timeout 的执行顺序
- Six Stones Programming: No matter which function you think is useless, people who can use it will not be able to leave, so at least 99%
- 集群的安全模式
猜你喜欢
Reasons and solutions for Invalid bound statement (not found)
PyQt5 rapid development and actual combat 10.1 Get city weather forecast
爱可可AI前沿推介(7.31)
网络层重点协议——IP协议
抓住金三银四的尾巴,解锁程序员面试《刷题神器》
NameNode (NN) and SecondaryNameNode (2NN) working mechanism
PartImageNet物体部件分割(Semantic Part Segmentation)数据集介绍
C# 中的Async 和 Await 的用法详解
centos7安装mysql5.7步骤(图解版)
IDEA如何运行web程序
随机推荐
Hard disk partition, expand disk C, no reshipment system, not heavy D dish of software full tutorial.
C#中+=的用法
PHP序列化:eval
Adding data nodes and decommissioning data nodes in the cluster
golang-gin-pprof-使用以及安全问题
FastAPI encapsulates a generic response
SAP message TK 248 solved
报错IDEA Terminated with exit code 1
Optimization of five data submission methods
C#控件 ToolStripProgressBar 用法
系统集成项目管理工程师(软考中级)知识点总结【挣值分析】【关键路径】
C#获得网卡信息 NetworkInterface IPInterfaceProperties
Flutter keyboard visibility
Network layer key protocol - IP protocol
Save and load numpy matrices and vectors, and use the saved vectors for similarity calculation
Even if the image is missing in a large area, it can also be repaired realistically. The new model CM-GAN takes into account the global structure and texture details
使用openssl命令生成证书和对应的私钥,私钥签名,公钥验签
中望3D 2023正式发布,设计仿真制造一体化缩短产品开发周期
How to quickly split and merge cell data in Excel
Sliding window method to segment data