@@ -79,6 +79,13 @@ public void nextBytes(byte[] bytes) {
79
79
.setExecutionEnvironment (
80
80
PayloadGeneratorConfig .ExecutionEnvironment .EXEC_INTERPRETATION_ENVIRONMENT )
81
81
.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 ();
82
89
private static final PayloadGeneratorConfig WINDOWS_REFLECTIVE_RCE_CONFIG =
83
90
PayloadGeneratorConfig .newBuilder ()
84
91
.setVulnerabilityType (PayloadGeneratorConfig .VulnerabilityType .REFLECTIVE_RCE )
@@ -250,6 +257,36 @@ public void checkIfExecuted_withJavaConfiguration_andIncorrectInput_returnsFalse
250
257
ByteString .copyFromUtf8 ("TSUNAMI_PAYLOAD_START ffffffffffffffff TSUNAMI_PAYLOAD_END" )));
251
258
}
252
259
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
+
253
290
@ Test
254
291
public void getPayload_withSsrfConfiguration_returnsGooglePayload () {
255
292
Payload payload = payloadGenerator .generate (ANY_SSRF_CONFIG );
0 commit comments