前言
jmet命令参数:
usage: jmet [host] [port]
-Q,--Queue <name> queue name(队列消息名)
-I,--impl <arg> ActiveMQ| Artemis| WebSphereMQ| Qpid10| Qpid09| HornetQ| SwiftMQ| RabbitMQ| OpenMQ(指定中间件类型/JMS客户端)
-Y,--ysoserial <CMD> Deser exploitation mode(指定命令)
-Yp,--payload <payloadname> Optional: Ysoserial Payload to use(可选:Ysoserial有效载荷使用) BeanShell1| CommonsBeanutils1| CommonsCollections1| CommonsCollections2| CommonsCollections3| CommonsCollections4| CommonsCollections5| Groovy1| Hibernate1| Hibernate2| Jdk7u21| JSON1| ROME| Spring1| Spring2
-C,--Custom <scriptname> Custom script exploitation mode(自定义脚本使用模式)
-f,--filter <scriptname> filter script(过滤脚本)
-pw,--password <pass> password for authentication(密码进行身份认证)
-s,--substitute Substituation mode: Use §§ to pass ysoserial payload name to CMD(使用§§ 来传递ysoserial有效载荷名称到cmd)
-T,--Topic <name> topic name(主题名)
-u,--user <id> user for authentication(用户身份认证)
-v,--verbose Running verbose mode(运行详细模式)
-X,--XXE <URL> XXE exploitation mode(XXE剥削模式)
-Xp,--xxepayload <payloadname> Optional: XXE Payload to use EXTERNAL| PARAMATER| DTD(XXE有效载荷使用)
-Zc,--channel <channel> channel name (only WebSphereMQ)(通道名称,只有WebSphereMQ)
-Zq,--queuemanager <name> queue manager name (only WebSphereMQ)(队列管理器名称)
-Zv,--vhost <name> vhost name (only AMQP-Brokers: RabbitMQ|QPid09|QPid10)
正文
在进行ActiveMQ 反序列化漏洞(CVE-2015-5254)测试的时候,使用的反序列化软件jmet出现了报错
Exception in thread "main" java.lang.IllegalAccessError: class ysoserial.payloads.util.Gadgets (in unnamed module @0x4015e7ec) cannot access class com.sun.org.apache.xalan.internal.xsltc.trax.TemplatesImpl (in module java.xml) because module java.xml does not export com.sun.org.apache.xalan.internal.xsltc.trax to unnamed module @0x4015e7ec
at ysoserial.payloads.util.Gadgets.createTemplatesImpl(Gadgets.java:101)
at ysoserial.payloads.ROME.getObject(ROME.java:34)
at ysoserial.payloads.ObjectPayload$Utils.makePayloadObject(ObjectPayload.java:69)
at de.codewhite.jmet.payload.impl.PayloadGenerator.createGadgetObjectPayloads(PayloadGenerator.java:28)
at de.codewhite.jmet.JMET.validateAndCreatePayloads(JMET.java:137)
at de.codewhite.jmet.JMET.setup(JMET.java:117)
at de.codewhite.jmet.JMET.main(JMET.java:58)
上网查了一堆资料都解决不了,最后决定去jmet作者的github下面寻找,最后找到了原文
JMET depends on a lot of libraries :(. For details see the maven pom file.
JMET works with Java 8. Expect unpleasant surprises with Java 11.
翻译一下,大致意思为JMET 可与 Java 8 配合使用。Java 11 可能会出现意外情况。·
使用命令java -version查看一下java版本,我现在的版本为java17,很明显高出了要求
下载一下java8的包
https://repo.huaweicloud.com/java/jdk/8u202-b08/jdk-8u202-linux-x64.tar.gz
创建Java文件夹
mkdir /usr/local/java
复制到/usr/local/java下
cp '/root/桌面/jdk-8u202-linux-x64.tar.gz' /usr/local/java
切换到java路径下
cd /usr/local/java
解压下载的压缩包
tar -zxvf jdk-8u202-linux-x64.tar.gz
配置一下java的环境变量
vim /etc/profile
粘贴以下内容
JAVA_HOME=/usr/local/java/jdk1.8.0_202
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
export JAVA_HOME
export PATH
使用以下变量声明java变量
update-alternatives --install "/usr/bin/java" "java" "/usr/local/java/jdk1.8.0_202/bin/java" 1
update-alternatives --install "/usr/bin/javac" "javac" "/usr/local/java/jdk1.8.0_202/bin/javac" 1
update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/local/java/jdk1.8.0_202/bin/javaws" 1
update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/local/java/jdk1.8.0_202/bin/javaws" 1
重新载入profile
source /etc/profile
输入
shutdown -r now
重启后查看java版本还是17
使用命令来切换
update-alternatives --config java
成功切换
再次尝试发现成功