Skip to content

Commit f4f0d56

Browse files
committed
fix: godzilla listener check error
1 parent b5a91fa commit f4f0d56

File tree

5 files changed

+37
-20
lines changed

5 files changed

+37
-20
lines changed

README.md

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# MemShellParty
22

3-
![license](https://img.shields.io/github/license/reajason/memshellparty?style=flat-square)
4-
![build](https://img.shields.io/github/actions/workflow/status/reajason/memshellparty/ci.yaml?branch=master&style=flat-square)
5-
![coverage](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/reajason/memshellparty/master/.github/badges/jacoco.json)
3+
[![license](https://img.shields.io/github/license/reajason/memshellparty?style=flat-square)](https://github.com/ReaJason/MemShellParty?tab=MIT-1-ov-file)
4+
[![build](https://img.shields.io/github/actions/workflow/status/reajason/memshellparty/ci.yaml?branch=master&style=flat-square)](https://github.com/ReaJason/MemShellParty/actions)
5+
[![coverage](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/reajason/memshellparty/master/.github/badges/jacoco.json)](https://github.com/ReaJason/MemShellParty/actions)
66

77
> [!WARNING]
88
> 本工具仅供安全研究人员、网络管理员及相关技术人员进行授权的安全测试、漏洞评估和安全审计工作使用。使用本工具进行任何未经授权的网络攻击或渗透测试等行为均属违法,使用者需自行承担相应的法律责任。
@@ -16,7 +16,7 @@
1616

1717
为了更好地学习,Real-World Attack 的例子比起 Demo 总是会让人更感兴趣,那么什么是一次真实场景下的内存马注入攻击顺序呢(我认为的,我并没有攻击实战经验)。
1818

19-
> 某些工具的交互方式显然有些问题,虽然不影响使用但是值得优化
19+
> 某些工具的交互方式有一点问题,虽然不影响使用不过值得优化
2020
2121
1. 确认目标站点的中间件类型,Tomcat、WebLogic 等等。
2222
2. 选择注入内存马类型,Servlet、Filter、Listener 等等。
@@ -40,20 +40,23 @@ JDK 版本:
4040

4141
1. JDK1.6、JDK1.7
4242
2. JDK8
43-
3. JDK11
44-
4. JDK17
43+
3. JDK9
44+
4. JDK11
45+
5. JDK17
4546

4647
中间件:
4748

48-
1. [Tomcat](https://tomcat.apache.org/)[Jetty](https://jetty.org/)
49-
2. [Undertow](https://undertow.io/) ([JBossAS](https://jbossas.jboss.org/downloads/)/[JBossEAP](https://developers.redhat.com/products/eap/download)/[WildFly](https://www.wildfly.org/downloads/))
50-
3. [SpringMVC 框架](https://docs.spring.io/spring-framework/reference/web/webmvc.html)
51-
4. [WebLogic](https://www.oracle.com/middleware/technologies/weblogic-server-installers-downloads.html)
52-
5. [WebSphere](https://www.ibm.com/products/websphere-application-server)
53-
6. [Resin](https://caucho.com/products/resin/download)
54-
7. [GlassFish](https://javaee.github.io/glassfish/download)/[Payara](https://www.payara.fish/downloads/payara-platform-community-edition/)
55-
8. [东方通](https://www.tongtech.com/pctype/25.html)
56-
9. [宝兰德](https://www.bessystem.com/product/0ad9b8c4d6af462b8d15723a5f25a87d/info?p=101)
49+
1. [Tomcat](https://tomcat.apache.org/)
50+
2. [Jetty](https://jetty.org/)
51+
3. [Undertow](https://undertow.io/) ([JBossAS](https://jbossas.jboss.org/downloads/)/[JBossEAP](https://developers.redhat.com/products/eap/download)/[WildFly](https://www.wildfly.org/downloads/))
52+
4. [SpringMVC 框架](https://docs.spring.io/spring-framework/reference/web/webmvc.html)
53+
5. [SpringWebflux 框架](https://docs.spring.io/spring-framework/reference/web/webflux.html)
54+
6. [WebLogic](https://www.oracle.com/middleware/technologies/weblogic-server-installers-downloads.html)
55+
7. [WebSphere](https://www.ibm.com/products/websphere-application-server)
56+
8. [Resin](https://caucho.com/products/resin/download)
57+
9. [GlassFish](https://javaee.github.io/glassfish/download)/[Payara](https://www.payara.fish/downloads/payara-platform-community-edition/)
58+
10. [东方通](https://www.tongtech.com/pctype/25.html)
59+
11. [宝兰德](https://www.bessystem.com/product/0ad9b8c4d6af462b8d15723a5f25a87d/info?p=101)
5760

5861
内存马类型:
5962

@@ -68,7 +71,7 @@ JDK 版本:
6871
9. Netty
6972
10. Spring Controller(多种方式)
7073
11. Spring Interceptor
71-
12. Spring Webflux
74+
12. Spring WebFlux
7275

7376
内存马功能:
7477

generator/src/main/java/com/reajason/javaweb/godzilla/GodzillaManager.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,16 +194,20 @@ private static boolean isValidResponse(String response, String md5) {
194194
if (StringUtils.isEmpty(response)) {
195195
return false;
196196
}
197-
return response.length() > 32 && response.startsWith(md5.substring(0, 16)) && response.trim().endsWith(md5.substring(16));
197+
if (response.length() < 32) {
198+
return false;
199+
}
200+
return response.contains(md5.substring(0, 16)) && response.trim().contains(md5.substring(16));
198201
}
199202

200203
@SneakyThrows
201204
public static String getResultFromRes(String responseBody, String key, String md5) {
202205
if (!isValidResponse(responseBody, md5)) {
203206
return responseBody;
204207
}
208+
int lastIndex = responseBody.indexOf(md5.substring(16));
205209
String result = responseBody.substring(16);
206-
result = result.substring(0, result.length() - 16);
210+
result = result.substring(0, lastIndex);
207211
byte[] bytes = Base64.decodeBase64(result);
208212
byte[] x = aes(key, bytes, false);
209213
GZIPInputStream gzipInputStream = new GZIPInputStream(new ByteArrayInputStream(x));

generator/src/main/java/com/reajason/javaweb/memsell/tomcat/injector/TomcatListenerInjector.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414

1515
/**
1616
* Tomcat Listener 注入器
17-
* Author: pen4uin
1817
* 测试版本:
1918
* jdk v1.8.0_275
2019
* tomcat v5.5.36, v6.0.9, v7.0.32, v8.5.83, v9.0.67
20+
* @author pen4uin, ReaJason
2121
*/
2222
public class TomcatListenerInjector {
2323

generator/src/test/java/com/reajason/javaweb/godzilla/GodzillaManagerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ void testManager() {
3333
.build()) {
3434
assertTrue(manager.start());
3535
assertTrue(manager.test());
36-
} catch (IOException e) {
36+
} catch (IOException ignored) {
3737
}
3838
}
3939

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
services:
2+
tomcat88:
3+
image: tomcat:8-jre8
4+
ports:
5+
- "8080:8080"
6+
- "5005:5005"
7+
environment:
8+
JAVA_OPTS: -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005
9+
volumes:
10+
- ../../../vul-webapp/build/libs/vul-webapp.war:/usr/local/tomcat/webapps/app.war

0 commit comments

Comments
 (0)