Files
metasploit-gs/api/Msf/ReflectiveDLLLoader.html
T
jenkins-metasploit c3f5bd3de2 Reboot gh-pages
2026-05-08 17:08:43 +00:00

392 lines
13 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
Module: Msf::ReflectiveDLLLoader
&mdash; 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::ReflectiveDLLLoader";
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 (R)</a> &raquo;
<span class='title'><span class='object_link'><a href="../Msf.html" title="Msf (module)">Msf</a></span></span>
&raquo;
<span class="title">ReflectiveDLLLoader</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::ReflectiveDLLLoader
</h1>
<div class="box_info">
<dl>
<dt>Included in:</dt>
<dd><span class='object_link'><a href="Payload/Windows/MeterpreterLoader.html" title="Msf::Payload::Windows::MeterpreterLoader (module)">Payload::Windows::MeterpreterLoader</a></span>, <span class='object_link'><a href="Payload/Windows/MeterpreterLoader_x64.html" title="Msf::Payload::Windows::MeterpreterLoader_x64 (module)">Payload::Windows::MeterpreterLoader_x64</a></span>, <span class='object_link'><a href="Payload/Windows/ReflectiveDllInject.html" title="Msf::Payload::Windows::ReflectiveDllInject (module)">Payload::Windows::ReflectiveDllInject</a></span>, <span class='object_link'><a href="Payload/Windows/ReflectiveDllInject_x64.html" title="Msf::Payload::Windows::ReflectiveDllInject_x64 (module)">Payload::Windows::ReflectiveDllInject_x64</a></span>, <span class='object_link'><a href="Post/Windows/ReflectiveDLLInjection.html" title="Msf::Post::Windows::ReflectiveDLLInjection (module)">Post::Windows::ReflectiveDLLInjection</a></span>, <span class='object_link'><a href="../Rex/Payloads/Meterpreter/Config.html" title="Rex::Payloads::Meterpreter::Config (class)">Rex::Payloads::Meterpreter::Config</a></span></dd>
</dl>
<dl>
<dt>Defined in:</dt>
<dd>lib/msf/core/reflective_dll_loader.rb</dd>
</dl>
</div>
<h2>
Constant Summary
<small><a href="#" class="constants_summary_toggle">collapse</a></small>
</h2>
<dl class="constants">
<dt id="EXPORT_REFLECTIVELOADER-constant" class="">EXPORT_REFLECTIVELOADER =
<div class="docstring">
<div class="discussion">
<p>This is the ordinal of the reflective loader by default In new RDI DLLs that come with MSF</p>
</div>
</div>
<div class="tags">
</div>
</dt>
<dd><pre class="code"><span class='int'>1</span></pre></dd>
</dl>
<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="#load_rdi_dll-instance_method" title="#load_rdi_dll (instance method)">#<strong>load_rdi_dll</strong>(dll_path, loader_name: &#39;ReflectiveLoader&#39;, loader_ordinal: EXPORT_REFLECTIVELOADER) &#x21d2; Array </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Load a reflectively-injectable DLL from disk and find the offset to the ReflectiveLoader function inside the DLL.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#load_rdi_dll_from_data-instance_method" title="#load_rdi_dll_from_data (instance method)">#<strong>load_rdi_dll_from_data</strong>(dll_data, loader_name: &#39;ReflectiveLoader&#39;, loader_ordinal: EXPORT_REFLECTIVELOADER) &#x21d2; Integer </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Load a reflectively-injectable DLL from a string and find the offset to the ReflectiveLoader function inside the DLL.</p>
</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="load_rdi_dll-instance_method">
#<strong>load_rdi_dll</strong>(dll_path, loader_name: &#39;ReflectiveLoader&#39;, loader_ordinal: EXPORT_REFLECTIVELOADER) &#x21d2; <tt>Array</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Load a reflectively-injectable DLL from disk and find the offset to the ReflectiveLoader function inside the DLL.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>dll_path</span>
<span class='type'>(<tt>String</tt>)</span>
&mdash;
<div class='inline'>
<p>Path to the DLL to load.</p>
</div>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>Array</tt>)</span>
&mdash;
<div class='inline'>
<p>Tuple of DLL contents and offset to the <code>ReflectiveLoader</code> function within the DLL.</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
26
27
28
29
30
31
32
33
34
35
36
37</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/msf/core/reflective_dll_loader.rb', line 26</span>
<span class='kw'>def</span> <span class='id identifier rubyid_load_rdi_dll'>load_rdi_dll</span><span class='lparen'>(</span><span class='id identifier rubyid_dll_path'>dll_path</span><span class='comma'>,</span> <span class='label'>loader_name:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>ReflectiveLoader</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='label'>loader_ordinal:</span> <span class='const'><span class='object_link'><a href="#EXPORT_REFLECTIVELOADER-constant" title="Msf::ReflectiveDLLLoader::EXPORT_REFLECTIVELOADER (constant)">EXPORT_REFLECTIVELOADER</a></span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_encrypted_dll'>encrypted_dll</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_binread'>binread</span><span class='lparen'>(</span><span class='id identifier rubyid_dll_path'>dll_path</span><span class='rparen'>)</span>
<span class='id identifier rubyid_dll'>dll</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>MetasploitPayloads</span><span class='op'>::</span><span class='const'>Crypto</span><span class='period'>.</span><span class='id identifier rubyid_decrypt'>decrypt</span><span class='lparen'>(</span><span class='label'>ciphertext:</span> <span class='id identifier rubyid_encrypted_dll'>encrypted_dll</span><span class='rparen'>)</span>
<span class='id identifier rubyid_offset'>offset</span> <span class='op'>=</span> <span class='id identifier rubyid_parse_pe'>parse_pe</span><span class='lparen'>(</span><span class='id identifier rubyid_dll'>dll</span><span class='comma'>,</span> <span class='label'>loader_name:</span> <span class='id identifier rubyid_loader_name'>loader_name</span><span class='comma'>,</span> <span class='label'>loader_ordinal:</span> <span class='id identifier rubyid_loader_ordinal'>loader_ordinal</span><span class='rparen'>)</span>
<span class='kw'>unless</span> <span class='id identifier rubyid_offset'>offset</span>
<span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Cannot find the ReflectiveLoader entry point in </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_dll_path'>dll_path</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span>
<span class='kw'>end</span>
<span class='kw'>return</span> <span class='id identifier rubyid_dll'>dll</span><span class='comma'>,</span> <span class='id identifier rubyid_offset'>offset</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="load_rdi_dll_from_data-instance_method">
#<strong>load_rdi_dll_from_data</strong>(dll_data, loader_name: &#39;ReflectiveLoader&#39;, loader_ordinal: EXPORT_REFLECTIVELOADER) &#x21d2; <tt>Integer</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Load a reflectively-injectable DLL from a string and find the offset to the ReflectiveLoader function inside the DLL.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>dll_data</span>
<span class='type'>(<tt>String</tt>)</span>
&mdash;
<div class='inline'>
<p>the DLL data to load.</p>
</div>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>Integer</tt>)</span>
&mdash;
<div class='inline'>
<p>offset to the <code>ReflectiveLoader</code> function within the DLL.</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
45
46
47
48
49
50
51
52
53
54</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/msf/core/reflective_dll_loader.rb', line 45</span>
<span class='kw'>def</span> <span class='id identifier rubyid_load_rdi_dll_from_data'>load_rdi_dll_from_data</span><span class='lparen'>(</span><span class='id identifier rubyid_dll_data'>dll_data</span><span class='comma'>,</span> <span class='label'>loader_name:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>ReflectiveLoader</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='label'>loader_ordinal:</span> <span class='const'><span class='object_link'><a href="#EXPORT_REFLECTIVELOADER-constant" title="Msf::ReflectiveDLLLoader::EXPORT_REFLECTIVELOADER (constant)">EXPORT_REFLECTIVELOADER</a></span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_decrypted_dll_data'>decrypted_dll_data</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>MetasploitPayloads</span><span class='op'>::</span><span class='const'>Crypto</span><span class='period'>.</span><span class='id identifier rubyid_decrypt'>decrypt</span><span class='lparen'>(</span><span class='label'>ciphertext:</span> <span class='id identifier rubyid_dll_data'>dll_data</span><span class='rparen'>)</span>
<span class='id identifier rubyid_offset'>offset</span> <span class='op'>=</span> <span class='id identifier rubyid_parse_pe'>parse_pe</span><span class='lparen'>(</span><span class='id identifier rubyid_decrypted_dll_data'>decrypted_dll_data</span><span class='comma'>,</span> <span class='label'>loader_name:</span> <span class='id identifier rubyid_loader_name'>loader_name</span><span class='comma'>,</span> <span class='label'>loader_ordinal:</span> <span class='id identifier rubyid_loader_ordinal'>loader_ordinal</span><span class='rparen'>)</span>
<span class='kw'>unless</span> <span class='id identifier rubyid_offset'>offset</span>
<span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Cannot find the ReflectiveLoader entry point in DLL data</span><span class='tstring_end'>&#39;</span></span>
<span class='kw'>end</span>
<span class='id identifier rubyid_offset'>offset</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
</div>
<div id="footer">
Generated on Fri May 8 17:01:44 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>