feat: support H2 packer

This commit is contained in:
ReaJason
2025-08-13 23:53:40 +08:00
parent f09ae066bd
commit 9fe2630c36
22 changed files with 341 additions and 10 deletions
+1 -1
View File
@@ -1,2 +1,2 @@
#!/bin/bash
jps | grep -E "jar" | awk '{print $1}' | tr -d '\n'
pgrep -a java | awk '{print $1}' | tr -d '\n'
@@ -348,6 +348,7 @@ public class ShellAssertionTool {
case Hessian2Deserialize -> VulTool.postData(url + "/hessian2", content);
case Base64 -> VulTool.postData(url + "/b64", content);
case XxlJob -> VulTool.xxlJobExecutor(url + "/run", content);
case H2, H2JS, H2Javac -> VulTool.postData(url + "/jdbc", content);
default -> throw new IllegalStateException("Unexpected value: " + packer);
}
}
@@ -58,13 +58,14 @@ public class SpringBoot2ContainerTest {
ShellType.SPRING_WEBMVC_CONTROLLER_HANDLER,
ShellType.SPRING_WEBMVC_AGENT_FRAMEWORK_SERVLET
);
List<Packers> testPackers = List.of(Packers.ScriptEngine, Packers.SpEL, Packers.Base64);
List<Packers> testPackers = List.of(Packers.ScriptEngine, Packers.SpEL, Packers.Base64, Packers.H2JS);
return TestCasesProvider.getTestCases(imageName, server, supportedShellTypes, testPackers);
}
@AfterAll
static void tearDown() {
String logs = container.getLogs();
log.info(logs);
assertThat("Logs should not contain any exceptions", logs, doesNotContainException());
}
@@ -92,7 +93,7 @@ public class SpringBoot2ContainerTest {
ShellType.AGENT_FILTER_CHAIN,
ShellType.CATALINA_AGENT_CONTEXT_VALVE
);
List<Packers> testPackers = List.of(Packers.ScriptEngine, Packers.SpEL, Packers.Base64);
List<Packers> testPackers = List.of(Packers.ScriptEngine, Packers.SpEL, Packers.Base64, Packers.H2JS);
return TestCasesProvider.getTestCases(imageName, server, supportedShellTypes, testPackers);
}
@@ -56,7 +56,7 @@ public class SpringBoot3ContainerTest {
ShellType.SPRING_WEBMVC_JAKARTA_CONTROLLER_HANDLER,
ShellType.SPRING_WEBMVC_AGENT_FRAMEWORK_SERVLET
);
List<Packers> testPackers = List.of(Packers.Base64);
List<Packers> testPackers = List.of(Packers.Base64, Packers.H2);
return TestCasesProvider.getTestCases(imageName, server, supportedShellTypes, testPackers, null, List.of(ShellTool.AntSword));
}
@@ -91,7 +91,7 @@ public class SpringBoot3ContainerTest {
ShellType.AGENT_FILTER_CHAIN,
ShellType.CATALINA_AGENT_CONTEXT_VALVE
);
List<Packers> testPackers = List.of(Packers.Base64);
List<Packers> testPackers = List.of(Packers.Base64, Packers.H2);
return TestCasesProvider.getTestCases(imageName, server, supportedShellTypes, testPackers, null, List.of(ShellTool.AntSword));
}
@@ -50,6 +50,7 @@ public class Tomcat8ExpressionContainerTest {
arguments(imageName, ShellType.FILTER, ShellTool.Godzilla, Packers.JXPath),
arguments(imageName, ShellType.FILTER, ShellTool.Godzilla, Packers.Aviator),
arguments(imageName, ShellType.FILTER, ShellTool.Godzilla, Packers.BeanShell),
arguments(imageName, ShellType.FILTER, ShellTool.Godzilla, Packers.ScriptEngine),
arguments(imageName, ShellType.FILTER, ShellTool.Godzilla, Packers.Groovy),
arguments(imageName, ShellType.FILTER, ShellTool.Godzilla, Packers.Rhino),
arguments(imageName, ShellType.FILTER, ShellTool.Godzilla, Packers.JinJava),