mirror of
https://github.com/ReaJason/MemShellParty.git
synced 2026-09-21 22:50:42 +08:00
feat: support servletNameFilter for JettyFilterProbe
This commit is contained in:
+7
-7
@@ -2,11 +2,14 @@ package com.reajason.javaweb.integration.probe.jetty;
|
||||
|
||||
import com.reajason.javaweb.Server;
|
||||
import com.reajason.javaweb.integration.ProbeAssertion;
|
||||
import com.reajason.javaweb.integration.ShellAssertion;
|
||||
import com.reajason.javaweb.integration.VulTool;
|
||||
import com.reajason.javaweb.integration.probe.DetectionTool;
|
||||
import com.reajason.javaweb.memshell.MemShellResult;
|
||||
import com.reajason.javaweb.memshell.ShellTool;
|
||||
import com.reajason.javaweb.memshell.ShellType;
|
||||
import com.reajason.javaweb.packer.Packers;
|
||||
import com.reajason.javaweb.probe.payload.FilterProbeFactory;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.bytebuddy.jar.asm.Opcodes;
|
||||
@@ -86,20 +89,17 @@ public class Jetty10ContainerTest {
|
||||
@Test
|
||||
void testFilterProbe() {
|
||||
String url = getUrl(container);
|
||||
String data = VulTool.post(url + "/b64", DetectionTool.getJettyFilterProbe());
|
||||
System.out.println(data);
|
||||
assertThat(data, anyOf(
|
||||
containsString("Context: ")
|
||||
));
|
||||
String data = VulTool.post(url + "/b64", FilterProbeFactory.getBase64ByServer(Server.Jetty));
|
||||
ShellAssertion.assertFilterProbeIsRight(data);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFilterFirstInject() {
|
||||
String url = getUrl(container);
|
||||
shellInjectIsOk(url, Server.Jetty, ShellType.FILTER, ShellTool.Command, org.objectweb.asm.Opcodes.V11, Packers.BigInteger, container);
|
||||
MemShellResult memShellResult = shellInjectIsOk(url, Server.Jetty, ShellType.FILTER, ShellTool.Command, org.objectweb.asm.Opcodes.V11, Packers.BigInteger, container);
|
||||
String data = VulTool.post(url + "/b64", DetectionTool.getJettyFilterProbe());
|
||||
List<String> filter = ProbeAssertion.getFiltersForContext(data, "/app");
|
||||
String filterName = ProbeAssertion.extractFilterName(filter.get(0));
|
||||
assertThat(filterName, anyOf(startsWith("org.eclipse.jetty.servlet.handlers")));
|
||||
assertEquals(filterName, memShellResult.getShellClassName());
|
||||
}
|
||||
}
|
||||
|
||||
+9
-8
@@ -2,11 +2,14 @@ package com.reajason.javaweb.integration.probe.jetty;
|
||||
|
||||
import com.reajason.javaweb.Server;
|
||||
import com.reajason.javaweb.integration.ProbeAssertion;
|
||||
import com.reajason.javaweb.integration.ShellAssertion;
|
||||
import com.reajason.javaweb.integration.VulTool;
|
||||
import com.reajason.javaweb.integration.probe.DetectionTool;
|
||||
import com.reajason.javaweb.memshell.MemShellResult;
|
||||
import com.reajason.javaweb.memshell.ShellTool;
|
||||
import com.reajason.javaweb.memshell.ShellType;
|
||||
import com.reajason.javaweb.packer.Packers;
|
||||
import com.reajason.javaweb.probe.payload.FilterProbeFactory;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.bytebuddy.jar.asm.Opcodes;
|
||||
@@ -24,7 +27,8 @@ import java.util.List;
|
||||
import static com.reajason.javaweb.integration.ContainerTool.getUrl;
|
||||
import static com.reajason.javaweb.integration.ContainerTool.warJakartaFile;
|
||||
import static com.reajason.javaweb.integration.ShellAssertion.shellInjectIsOk;
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.hamcrest.CoreMatchers.anyOf;
|
||||
import static org.hamcrest.CoreMatchers.startsWith;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
@@ -86,20 +90,17 @@ public class Jetty11ContainerTest {
|
||||
@Test
|
||||
void testFilterProbe() {
|
||||
String url = getUrl(container);
|
||||
String data = VulTool.post(url + "/b64", DetectionTool.getJettyFilterProbe());
|
||||
System.out.println(data);
|
||||
assertThat(data, anyOf(
|
||||
containsString("Context: ")
|
||||
));
|
||||
String data = VulTool.post(url + "/b64", FilterProbeFactory.getBase64ByServer(Server.Jetty));
|
||||
ShellAssertion.assertFilterProbeIsRight(data);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFilterFirstInject() {
|
||||
String url = getUrl(container);
|
||||
shellInjectIsOk(url, Server.Jetty, ShellType.JAKARTA_FILTER, ShellTool.Command, org.objectweb.asm.Opcodes.V17, Packers.BigInteger, container);
|
||||
MemShellResult memShellResult = shellInjectIsOk(url, Server.Jetty, ShellType.JAKARTA_FILTER, ShellTool.Command, Opcodes.V17, Packers.BigInteger, container);
|
||||
String data = VulTool.post(url + "/b64", DetectionTool.getJettyFilterProbe());
|
||||
List<String> filter = ProbeAssertion.getFiltersForContext(data, "/app");
|
||||
String filterName = ProbeAssertion.extractFilterName(filter.get(0));
|
||||
assertThat(filterName, anyOf(startsWith("org.eclipse.jetty.servlet.handlers")));
|
||||
assertEquals(filterName, memShellResult.getShellClassName());
|
||||
}
|
||||
}
|
||||
|
||||
+4
-5
@@ -2,11 +2,13 @@ package com.reajason.javaweb.integration.probe.jetty;
|
||||
|
||||
import com.reajason.javaweb.Server;
|
||||
import com.reajason.javaweb.integration.ProbeAssertion;
|
||||
import com.reajason.javaweb.integration.ShellAssertion;
|
||||
import com.reajason.javaweb.integration.VulTool;
|
||||
import com.reajason.javaweb.integration.probe.DetectionTool;
|
||||
import com.reajason.javaweb.memshell.ShellTool;
|
||||
import com.reajason.javaweb.memshell.ShellType;
|
||||
import com.reajason.javaweb.packer.Packers;
|
||||
import com.reajason.javaweb.probe.payload.FilterProbeFactory;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.bytebuddy.jar.asm.Opcodes;
|
||||
@@ -73,11 +75,8 @@ public class Jetty12ee10ContainerTest {
|
||||
@Test
|
||||
void testFilterProbe() {
|
||||
String url = getUrl(container);
|
||||
String data = VulTool.post(url + "/b64", DetectionTool.getJettyFilterProbe());
|
||||
System.out.println(data);
|
||||
assertThat(data, anyOf(
|
||||
containsString("Context: ")
|
||||
));
|
||||
String data = VulTool.post(url + "/b64", FilterProbeFactory.getBase64ByServer(Server.Jetty));
|
||||
ShellAssertion.assertFilterProbeIsRight(data);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+4
-5
@@ -2,11 +2,13 @@ package com.reajason.javaweb.integration.probe.jetty;
|
||||
|
||||
import com.reajason.javaweb.Server;
|
||||
import com.reajason.javaweb.integration.ProbeAssertion;
|
||||
import com.reajason.javaweb.integration.ShellAssertion;
|
||||
import com.reajason.javaweb.integration.VulTool;
|
||||
import com.reajason.javaweb.integration.probe.DetectionTool;
|
||||
import com.reajason.javaweb.memshell.ShellTool;
|
||||
import com.reajason.javaweb.memshell.ShellType;
|
||||
import com.reajason.javaweb.packer.Packers;
|
||||
import com.reajason.javaweb.probe.payload.FilterProbeFactory;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.bytebuddy.jar.asm.Opcodes;
|
||||
@@ -73,11 +75,8 @@ public class Jetty12ee11ContainerTest {
|
||||
@Test
|
||||
void testFilterProbe() {
|
||||
String url = getUrl(container);
|
||||
String data = VulTool.post(url + "/b64", DetectionTool.getJettyFilterProbe());
|
||||
System.out.println(data);
|
||||
assertThat(data, anyOf(
|
||||
containsString("Context: ")
|
||||
));
|
||||
String data = VulTool.post(url + "/b64", FilterProbeFactory.getBase64ByServer(Server.Jetty));
|
||||
ShellAssertion.assertFilterProbeIsRight(data);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+7
-7
@@ -2,11 +2,14 @@ package com.reajason.javaweb.integration.probe.jetty;
|
||||
|
||||
import com.reajason.javaweb.Server;
|
||||
import com.reajason.javaweb.integration.ProbeAssertion;
|
||||
import com.reajason.javaweb.integration.ShellAssertion;
|
||||
import com.reajason.javaweb.integration.VulTool;
|
||||
import com.reajason.javaweb.integration.probe.DetectionTool;
|
||||
import com.reajason.javaweb.memshell.MemShellResult;
|
||||
import com.reajason.javaweb.memshell.ShellTool;
|
||||
import com.reajason.javaweb.memshell.ShellType;
|
||||
import com.reajason.javaweb.packer.Packers;
|
||||
import com.reajason.javaweb.probe.payload.FilterProbeFactory;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.bytebuddy.jar.asm.Opcodes;
|
||||
@@ -79,20 +82,17 @@ public class Jetty12ee8ContainerTest {
|
||||
@Test
|
||||
void testFilterProbe() {
|
||||
String url = getUrl(container);
|
||||
String data = VulTool.post(url + "/b64", DetectionTool.getJettyFilterProbe());
|
||||
System.out.println(data);
|
||||
assertThat(data, anyOf(
|
||||
containsString("Context: ")
|
||||
));
|
||||
String data = VulTool.post(url + "/b64", FilterProbeFactory.getBase64ByServer(Server.Jetty));
|
||||
ShellAssertion.assertFilterProbeIsRight(data);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFilterFirstInject() {
|
||||
String url = getUrl(container);
|
||||
shellInjectIsOk(url, Server.Jetty, ShellType.FILTER, ShellTool.Command, Opcodes.V21, Packers.BigInteger, container);
|
||||
MemShellResult memShellResult = shellInjectIsOk(url, Server.Jetty, ShellType.FILTER, ShellTool.Command, Opcodes.V21, Packers.BigInteger, container);
|
||||
String data = VulTool.post(url + "/b64", DetectionTool.getJettyFilterProbe());
|
||||
List<String> filter = ProbeAssertion.getFiltersForContext(data, "/app");
|
||||
String filterName = ProbeAssertion.extractFilterName(filter.get(0));
|
||||
assertThat(filterName, anyOf(startsWith("org.eclipse.jetty.servlet.handlers")));
|
||||
assertEquals(filterName, memShellResult.getShellClassName());
|
||||
}
|
||||
}
|
||||
|
||||
+4
-5
@@ -2,11 +2,13 @@ package com.reajason.javaweb.integration.probe.jetty;
|
||||
|
||||
import com.reajason.javaweb.Server;
|
||||
import com.reajason.javaweb.integration.ProbeAssertion;
|
||||
import com.reajason.javaweb.integration.ShellAssertion;
|
||||
import com.reajason.javaweb.integration.VulTool;
|
||||
import com.reajason.javaweb.integration.probe.DetectionTool;
|
||||
import com.reajason.javaweb.memshell.ShellTool;
|
||||
import com.reajason.javaweb.memshell.ShellType;
|
||||
import com.reajason.javaweb.packer.Packers;
|
||||
import com.reajason.javaweb.probe.payload.FilterProbeFactory;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.bytebuddy.jar.asm.Opcodes;
|
||||
@@ -73,11 +75,8 @@ public class Jetty12ee9ContainerTest {
|
||||
@Test
|
||||
void testFilterProbe() {
|
||||
String url = getUrl(container);
|
||||
String data = VulTool.post(url + "/b64", DetectionTool.getJettyFilterProbe());
|
||||
System.out.println(data);
|
||||
assertThat(data, anyOf(
|
||||
containsString("Context: ")
|
||||
));
|
||||
String data = VulTool.post(url + "/b64", FilterProbeFactory.getBase64ByServer(Server.Jetty));
|
||||
ShellAssertion.assertFilterProbeIsRight(data);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+7
-9
@@ -2,11 +2,14 @@ package com.reajason.javaweb.integration.probe.jetty;
|
||||
|
||||
import com.reajason.javaweb.Server;
|
||||
import com.reajason.javaweb.integration.ProbeAssertion;
|
||||
import com.reajason.javaweb.integration.ShellAssertion;
|
||||
import com.reajason.javaweb.integration.VulTool;
|
||||
import com.reajason.javaweb.integration.probe.DetectionTool;
|
||||
import com.reajason.javaweb.memshell.MemShellResult;
|
||||
import com.reajason.javaweb.memshell.ShellTool;
|
||||
import com.reajason.javaweb.memshell.ShellType;
|
||||
import com.reajason.javaweb.packer.Packers;
|
||||
import com.reajason.javaweb.probe.payload.FilterProbeFactory;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.bytebuddy.jar.asm.Opcodes;
|
||||
@@ -24,8 +27,6 @@ import java.util.List;
|
||||
import static com.reajason.javaweb.integration.ContainerTool.getUrl;
|
||||
import static com.reajason.javaweb.integration.ContainerTool.warFile;
|
||||
import static com.reajason.javaweb.integration.ShellAssertion.shellInjectIsOk;
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
/**
|
||||
@@ -86,20 +87,17 @@ public class Jetty61ContainerTest {
|
||||
@Test
|
||||
void testFilterProbe() {
|
||||
String url = getUrl(container);
|
||||
String data = VulTool.post(url + "/b64", DetectionTool.getJettyFilterProbe());
|
||||
System.out.println(data);
|
||||
assertThat(data, anyOf(
|
||||
containsString("Context: ")
|
||||
));
|
||||
String data = VulTool.post(url + "/b64", FilterProbeFactory.getBase64ByServer(Server.Jetty));
|
||||
ShellAssertion.assertFilterProbeIsRight(data);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFilterFirstInject() {
|
||||
String url = getUrl(container);
|
||||
shellInjectIsOk(url, Server.Jetty, ShellType.FILTER, ShellTool.Command, org.objectweb.asm.Opcodes.V1_6, Packers.BigInteger, container);
|
||||
MemShellResult memShellResult = shellInjectIsOk(url, Server.Jetty, ShellType.FILTER, ShellTool.Command, Opcodes.V1_6, Packers.BigInteger, container);
|
||||
String data = VulTool.post(url + "/b64", DetectionTool.getJettyFilterProbe());
|
||||
List<String> filter = ProbeAssertion.getFiltersForContext(data, "/app");
|
||||
String filterName = ProbeAssertion.extractFilterName(filter.get(0));
|
||||
assertThat(filterName, anyOf(startsWith("org.eclipse.jetty.servlet.handlers")));
|
||||
assertEquals(filterName, memShellResult.getShellClassName());
|
||||
}
|
||||
}
|
||||
|
||||
+7
-9
@@ -2,11 +2,14 @@ package com.reajason.javaweb.integration.probe.jetty;
|
||||
|
||||
import com.reajason.javaweb.Server;
|
||||
import com.reajason.javaweb.integration.ProbeAssertion;
|
||||
import com.reajason.javaweb.integration.ShellAssertion;
|
||||
import com.reajason.javaweb.integration.VulTool;
|
||||
import com.reajason.javaweb.integration.probe.DetectionTool;
|
||||
import com.reajason.javaweb.memshell.MemShellResult;
|
||||
import com.reajason.javaweb.memshell.ShellTool;
|
||||
import com.reajason.javaweb.memshell.ShellType;
|
||||
import com.reajason.javaweb.packer.Packers;
|
||||
import com.reajason.javaweb.probe.payload.FilterProbeFactory;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.bytebuddy.jar.asm.Opcodes;
|
||||
@@ -23,8 +26,6 @@ import java.util.List;
|
||||
import static com.reajason.javaweb.integration.ContainerTool.getUrl;
|
||||
import static com.reajason.javaweb.integration.ContainerTool.warFile;
|
||||
import static com.reajason.javaweb.integration.ShellAssertion.shellInjectIsOk;
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
/**
|
||||
@@ -80,20 +81,17 @@ public class Jetty75ContainerTest {
|
||||
@Test
|
||||
void testFilterProbe() {
|
||||
String url = getUrl(container);
|
||||
String data = VulTool.post(url + "/b64", DetectionTool.getJettyFilterProbe());
|
||||
System.out.println(data);
|
||||
assertThat(data, anyOf(
|
||||
containsString("Context: ")
|
||||
));
|
||||
String data = VulTool.post(url + "/b64", FilterProbeFactory.getBase64ByServer(Server.Jetty));
|
||||
ShellAssertion.assertFilterProbeIsRight(data);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFilterFirstInject() {
|
||||
String url = getUrl(container);
|
||||
shellInjectIsOk(url, Server.Jetty, ShellType.FILTER, ShellTool.Command, org.objectweb.asm.Opcodes.V1_6, Packers.BigInteger, container);
|
||||
MemShellResult memShellResult = shellInjectIsOk(url, Server.Jetty, ShellType.FILTER, ShellTool.Command, Opcodes.V1_6, Packers.BigInteger, container);
|
||||
String data = VulTool.post(url + "/b64", DetectionTool.getJettyFilterProbe());
|
||||
List<String> filter = ProbeAssertion.getFiltersForContext(data, "/app");
|
||||
String filterName = ProbeAssertion.extractFilterName(filter.get(0));
|
||||
assertThat(filterName, anyOf(startsWith("org.eclipse.jetty.servlet.handlers")));
|
||||
assertEquals(filterName, memShellResult.getShellClassName());
|
||||
}
|
||||
}
|
||||
|
||||
+8
-8
@@ -2,11 +2,14 @@ package com.reajason.javaweb.integration.probe.jetty;
|
||||
|
||||
import com.reajason.javaweb.Server;
|
||||
import com.reajason.javaweb.integration.ProbeAssertion;
|
||||
import com.reajason.javaweb.integration.ShellAssertion;
|
||||
import com.reajason.javaweb.integration.VulTool;
|
||||
import com.reajason.javaweb.integration.probe.DetectionTool;
|
||||
import com.reajason.javaweb.memshell.MemShellResult;
|
||||
import com.reajason.javaweb.memshell.ShellTool;
|
||||
import com.reajason.javaweb.memshell.ShellType;
|
||||
import com.reajason.javaweb.packer.Packers;
|
||||
import com.reajason.javaweb.probe.payload.FilterProbeFactory;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.bytebuddy.jar.asm.Opcodes;
|
||||
@@ -77,23 +80,20 @@ public class Jetty76ContainerTest {
|
||||
ProbeAssertion.responseBytecodeIsOk(url, Server.Jetty, Opcodes.V1_6);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test
|
||||
void testFilterProbe() {
|
||||
String url = getUrl(container);
|
||||
String data = VulTool.post(url + "/b64", DetectionTool.getJettyFilterProbe());
|
||||
System.out.println(data);
|
||||
assertThat(data, anyOf(
|
||||
containsString("Context: ")
|
||||
));
|
||||
String data = VulTool.post(url + "/b64", FilterProbeFactory.getBase64ByServer(Server.Jetty));
|
||||
ShellAssertion.assertFilterProbeIsRight(data);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFilterFirstInject() {
|
||||
String url = getUrl(container);
|
||||
shellInjectIsOk(url, Server.Jetty, ShellType.FILTER, ShellTool.Command, org.objectweb.asm.Opcodes.V1_6, Packers.BigInteger, container);
|
||||
MemShellResult memShellResult = shellInjectIsOk(url, Server.Jetty, ShellType.FILTER, ShellTool.Command, org.objectweb.asm.Opcodes.V1_6, Packers.BigInteger, container);
|
||||
String data = VulTool.post(url + "/b64", DetectionTool.getJettyFilterProbe());
|
||||
List<String> filter = ProbeAssertion.getFiltersForContext(data, "/app");
|
||||
String filterName = ProbeAssertion.extractFilterName(filter.get(0));
|
||||
assertThat(filterName, anyOf(startsWith("org.eclipse.jetty.servlet.handlers")));
|
||||
assertEquals(filterName, memShellResult.getShellClassName());
|
||||
}
|
||||
}
|
||||
|
||||
+8
-8
@@ -2,11 +2,14 @@ package com.reajason.javaweb.integration.probe.jetty;
|
||||
|
||||
import com.reajason.javaweb.Server;
|
||||
import com.reajason.javaweb.integration.ProbeAssertion;
|
||||
import com.reajason.javaweb.integration.ShellAssertion;
|
||||
import com.reajason.javaweb.integration.VulTool;
|
||||
import com.reajason.javaweb.integration.probe.DetectionTool;
|
||||
import com.reajason.javaweb.memshell.MemShellResult;
|
||||
import com.reajason.javaweb.memshell.ShellTool;
|
||||
import com.reajason.javaweb.memshell.ShellType;
|
||||
import com.reajason.javaweb.packer.Packers;
|
||||
import com.reajason.javaweb.probe.payload.FilterProbeFactory;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.bytebuddy.jar.asm.Opcodes;
|
||||
@@ -77,23 +80,20 @@ public class Jetty81ContainerTest {
|
||||
ProbeAssertion.responseBytecodeIsOk(url, Server.Jetty, Opcodes.V1_7);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test
|
||||
void testFilterProbe() {
|
||||
String url = getUrl(container);
|
||||
String data = VulTool.post(url + "/b64", DetectionTool.getJettyFilterProbe());
|
||||
System.out.println(data);
|
||||
assertThat(data, anyOf(
|
||||
containsString("Context: ")
|
||||
));
|
||||
String data = VulTool.post(url + "/b64", FilterProbeFactory.getBase64ByServer(Server.Jetty));
|
||||
ShellAssertion.assertFilterProbeIsRight(data);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFilterFirstInject() {
|
||||
String url = getUrl(container);
|
||||
shellInjectIsOk(url, Server.Jetty, ShellType.FILTER, ShellTool.Command, org.objectweb.asm.Opcodes.V1_6, Packers.BigInteger, container);
|
||||
MemShellResult memShellResult = shellInjectIsOk(url, Server.Jetty, ShellType.FILTER, ShellTool.Command, org.objectweb.asm.Opcodes.V1_6, Packers.BigInteger, container);
|
||||
String data = VulTool.post(url + "/b64", DetectionTool.getJettyFilterProbe());
|
||||
List<String> filter = ProbeAssertion.getFiltersForContext(data, "/app");
|
||||
String filterName = ProbeAssertion.extractFilterName(filter.get(0));
|
||||
assertThat(filterName, anyOf(startsWith("org.eclipse.jetty.servlet.handlers")));
|
||||
assertEquals(filterName, memShellResult.getShellClassName());
|
||||
}
|
||||
}
|
||||
|
||||
+8
-8
@@ -2,11 +2,14 @@ package com.reajason.javaweb.integration.probe.jetty;
|
||||
|
||||
import com.reajason.javaweb.Server;
|
||||
import com.reajason.javaweb.integration.ProbeAssertion;
|
||||
import com.reajason.javaweb.integration.ShellAssertion;
|
||||
import com.reajason.javaweb.integration.VulTool;
|
||||
import com.reajason.javaweb.integration.probe.DetectionTool;
|
||||
import com.reajason.javaweb.memshell.MemShellResult;
|
||||
import com.reajason.javaweb.memshell.ShellTool;
|
||||
import com.reajason.javaweb.memshell.ShellType;
|
||||
import com.reajason.javaweb.packer.Packers;
|
||||
import com.reajason.javaweb.probe.payload.FilterProbeFactory;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.bytebuddy.jar.asm.Opcodes;
|
||||
@@ -78,23 +81,20 @@ public class Jetty92ContainerTest {
|
||||
ProbeAssertion.responseBytecodeIsOk(url, Server.Jetty, Opcodes.V1_7);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test
|
||||
void testFilterProbe() {
|
||||
String url = getUrl(container);
|
||||
String data = VulTool.post(url + "/b64", DetectionTool.getJettyFilterProbe());
|
||||
System.out.println(data);
|
||||
assertThat(data, anyOf(
|
||||
containsString("Context: ")
|
||||
));
|
||||
String data = VulTool.post(url + "/b64", FilterProbeFactory.getBase64ByServer(Server.Jetty));
|
||||
ShellAssertion.assertFilterProbeIsRight(data);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFilterFirstInject() {
|
||||
String url = getUrl(container);
|
||||
shellInjectIsOk(url, Server.Jetty, ShellType.FILTER, ShellTool.Command, org.objectweb.asm.Opcodes.V1_6, Packers.BigInteger, container);
|
||||
MemShellResult memShellResult = shellInjectIsOk(url, Server.Jetty, ShellType.FILTER, ShellTool.Command, org.objectweb.asm.Opcodes.V1_6, Packers.BigInteger, container);
|
||||
String data = VulTool.post(url + "/b64", DetectionTool.getJettyFilterProbe());
|
||||
List<String> filter = ProbeAssertion.getFiltersForContext(data, "/app");
|
||||
String filterName = ProbeAssertion.extractFilterName(filter.get(0));
|
||||
assertThat(filterName, anyOf(startsWith("org.eclipse.jetty.servlet.handlers")));
|
||||
assertEquals(filterName, memShellResult.getShellClassName());
|
||||
}
|
||||
}
|
||||
|
||||
+8
-8
@@ -2,11 +2,14 @@ package com.reajason.javaweb.integration.probe.jetty;
|
||||
|
||||
import com.reajason.javaweb.Server;
|
||||
import com.reajason.javaweb.integration.ProbeAssertion;
|
||||
import com.reajason.javaweb.integration.ShellAssertion;
|
||||
import com.reajason.javaweb.integration.VulTool;
|
||||
import com.reajason.javaweb.integration.probe.DetectionTool;
|
||||
import com.reajason.javaweb.memshell.MemShellResult;
|
||||
import com.reajason.javaweb.memshell.ShellTool;
|
||||
import com.reajason.javaweb.memshell.ShellType;
|
||||
import com.reajason.javaweb.packer.Packers;
|
||||
import com.reajason.javaweb.probe.payload.FilterProbeFactory;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.bytebuddy.jar.asm.Opcodes;
|
||||
@@ -77,23 +80,20 @@ public class Jetty93ContainerTest {
|
||||
ProbeAssertion.responseBytecodeIsOk(url, Server.Jetty, Opcodes.V1_8);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test
|
||||
void testFilterProbe() {
|
||||
String url = getUrl(container);
|
||||
String data = VulTool.post(url + "/b64", DetectionTool.getJettyFilterProbe());
|
||||
System.out.println(data);
|
||||
assertThat(data, anyOf(
|
||||
containsString("Context: ")
|
||||
));
|
||||
String data = VulTool.post(url + "/b64", FilterProbeFactory.getBase64ByServer(Server.Jetty));
|
||||
ShellAssertion.assertFilterProbeIsRight(data);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFilterFirstInject() {
|
||||
String url = getUrl(container);
|
||||
shellInjectIsOk(url, Server.Jetty, ShellType.FILTER, ShellTool.Command, org.objectweb.asm.Opcodes.V1_6, Packers.BigInteger, container);
|
||||
MemShellResult memShellResult = shellInjectIsOk(url, Server.Jetty, ShellType.FILTER, ShellTool.Command, org.objectweb.asm.Opcodes.V1_6, Packers.BigInteger, container);
|
||||
String data = VulTool.post(url + "/b64", DetectionTool.getJettyFilterProbe());
|
||||
List<String> filter = ProbeAssertion.getFiltersForContext(data, "/app");
|
||||
String filterName = ProbeAssertion.extractFilterName(filter.get(0));
|
||||
assertThat(filterName, anyOf(startsWith("org.eclipse.jetty.servlet.handlers")));
|
||||
assertEquals(filterName, memShellResult.getShellClassName());
|
||||
}
|
||||
}
|
||||
|
||||
+8
-8
@@ -2,11 +2,14 @@ package com.reajason.javaweb.integration.probe.jetty;
|
||||
|
||||
import com.reajason.javaweb.Server;
|
||||
import com.reajason.javaweb.integration.ProbeAssertion;
|
||||
import com.reajason.javaweb.integration.ShellAssertion;
|
||||
import com.reajason.javaweb.integration.VulTool;
|
||||
import com.reajason.javaweb.integration.probe.DetectionTool;
|
||||
import com.reajason.javaweb.memshell.MemShellResult;
|
||||
import com.reajason.javaweb.memshell.ShellTool;
|
||||
import com.reajason.javaweb.memshell.ShellType;
|
||||
import com.reajason.javaweb.packer.Packers;
|
||||
import com.reajason.javaweb.probe.payload.FilterProbeFactory;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.bytebuddy.jar.asm.Opcodes;
|
||||
@@ -77,23 +80,20 @@ public class Jetty94ContainerTest {
|
||||
ProbeAssertion.responseBytecodeIsOk(url, Server.Jetty, Opcodes.V1_8);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test
|
||||
void testFilterProbe() {
|
||||
String url = getUrl(container);
|
||||
String data = VulTool.post(url + "/b64", DetectionTool.getJettyFilterProbe());
|
||||
System.out.println(data);
|
||||
assertThat(data, anyOf(
|
||||
containsString("Context: ")
|
||||
));
|
||||
String data = VulTool.post(url + "/b64", FilterProbeFactory.getBase64ByServer(Server.Jetty));
|
||||
ShellAssertion.assertFilterProbeIsRight(data);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFilterFirstInject() {
|
||||
String url = getUrl(container);
|
||||
shellInjectIsOk(url, Server.Jetty, ShellType.FILTER, ShellTool.Command, org.objectweb.asm.Opcodes.V1_6, Packers.BigInteger, container);
|
||||
MemShellResult memShellResult = shellInjectIsOk(url, Server.Jetty, ShellType.FILTER, ShellTool.Command, org.objectweb.asm.Opcodes.V1_6, Packers.BigInteger, container);
|
||||
String data = VulTool.post(url + "/b64", DetectionTool.getJettyFilterProbe());
|
||||
List<String> filter = ProbeAssertion.getFiltersForContext(data, "/app");
|
||||
String filterName = ProbeAssertion.extractFilterName(filter.get(0));
|
||||
assertThat(filterName, anyOf(startsWith("org.eclipse.jetty.servlet.handlers")));
|
||||
assertEquals(filterName, memShellResult.getShellClassName());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user