@@ -79,6 +79,13 @@ public void nextBytes(byte[] bytes) {
7979 .setExecutionEnvironment (
8080 PayloadGeneratorConfig .ExecutionEnvironment .EXEC_INTERPRETATION_ENVIRONMENT )
8181 .build ();
82+ private static final PayloadGeneratorConfig JSP_REFLECTIVE_RCE_CONFIG =
83+ PayloadGeneratorConfig .newBuilder ()
84+ .setVulnerabilityType (PayloadGeneratorConfig .VulnerabilityType .REFLECTIVE_RCE )
85+ .setInterpretationEnvironment (PayloadGeneratorConfig .InterpretationEnvironment .JSP )
86+ .setExecutionEnvironment (
87+ PayloadGeneratorConfig .ExecutionEnvironment .EXEC_INTERPRETATION_ENVIRONMENT )
88+ .build ();
8289 private static final PayloadGeneratorConfig WINDOWS_REFLECTIVE_RCE_CONFIG =
8390 PayloadGeneratorConfig .newBuilder ()
8491 .setVulnerabilityType (PayloadGeneratorConfig .VulnerabilityType .REFLECTIVE_RCE )
@@ -250,6 +257,36 @@ public void checkIfExecuted_withJavaConfiguration_andIncorrectInput_returnsFalse
250257 ByteString .copyFromUtf8 ("TSUNAMI_PAYLOAD_START ffffffffffffffff TSUNAMI_PAYLOAD_END" )));
251258 }
252259
260+ @ Test
261+ public void getPayload_withJspConfiguration_returnsPrintfPayload () {
262+ Payload payload = payloadGenerator .generate (JSP_REFLECTIVE_RCE_CONFIG );
263+
264+ assertThat (payload .getPayload ())
265+ .isEqualTo (
266+ "<% out.print(String.format(\" %s%s%s\" ,\" TSUNAMI_PAYLOAD_START\" , \" ffffffffffffffff\" ,"
267+ + " \" TSUNAMI_PAYLOAD_END\" )); %>" );
268+ assertFalse (payload .getPayloadAttributes ().getUsesCallbackServer ());
269+ }
270+
271+ @ Test
272+ public void checkIfExecuted_withJspConfiguration_andCorrectInput_returnsTrue () {
273+ Payload payload = payloadGenerator .generate (JSP_REFLECTIVE_RCE_CONFIG );
274+
275+ assertTrue (
276+ payload .checkIfExecuted (
277+ ByteString .copyFromUtf8 (
278+ "RANDOMOUTPUTTSUNAMI_PAYLOAD_STARTffffffffffffffffTSUNAMI_PAYLOAD_END" )));
279+ }
280+
281+ @ Test
282+ public void checkIfExecuted_withJspConfiguration_andIncorrectInput_returnsFalse () {
283+ Payload payload = payloadGenerator .generate (JSP_REFLECTIVE_RCE_CONFIG );
284+
285+ assertFalse (
286+ payload .checkIfExecuted (
287+ ByteString .copyFromUtf8 ("TSUNAMI_PAYLOAD_START ffffffffffffffff TSUNAMI_PAYLOAD_END" )));
288+ }
289+
253290 @ Test
254291 public void getPayload_withSsrfConfiguration_returnsGooglePayload () {
255292 Payload payload = payloadGenerator .generate (ANY_SSRF_CONFIG );
0 commit comments