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

295 lines
6.6 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::Local::LinuxKernel
&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::Exploit::Local::LinuxKernel";
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 (L)</a> &raquo;
<span class='title'><span class='object_link'><a href="../../../Msf.html" title="Msf (module)">Msf</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../../Exploit.html" title="Msf::Exploit (class)">Exploit</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Local.html" title="Msf::Exploit::Local (class)">Local</a></span></span>
&raquo;
<span class="title">LinuxKernel</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::Local::LinuxKernel
</h1>
<div class="box_info">
<dl>
<dt>Includes:</dt>
<dd><span class='object_link'><a href="CompileC.html" title="Msf::Exploit::Local::CompileC (module)">CompileC</a></span></dd>
</dl>
<dl>
<dt>Defined in:</dt>
<dd>lib/msf/core/exploit/local/linux_kernel.rb</dd>
</dl>
</div>
<h2>Instance Attribute Summary</h2>
<h3 class="inherited">Attributes included from <span class='object_link'><a href="CompileC.html" title="Msf::Exploit::Local::CompileC (module)">CompileC</a></span></h3>
<p class="inherited"><span class='object_link'><a href="CompileC.html#cparser-instance_method" title="Msf::Exploit::Local::CompileC#cparser (method)">#cparser</a></span>, <span class='object_link'><a href="CompileC.html#cpu-instance_method" title="Msf::Exploit::Local::CompileC#cpu (method)">#cpu</a></span></p>
<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="#current_task_struct_h-instance_method" title="#current_task_struct_h (instance method)">#<strong>current_task_struct_h</strong>(metasm_exe) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
</ul>
<h3 class="inherited">Methods included from <span class='object_link'><a href="CompileC.html" title="Msf::Exploit::Local::CompileC (module)">CompileC</a></span></h3>
<p class="inherited"><span class='object_link'><a href="CompileC.html#init_metasm-instance_method" title="Msf::Exploit::Local::CompileC#init_metasm (method)">#init_metasm</a></span>, <span class='object_link'><a href="CompileC.html#setup-instance_method" title="Msf::Exploit::Local::CompileC#setup (method)">#setup</a></span></p>
<div id="instance_method_details" class="method_details_list">
<h2>Instance Method Details</h2>
<div class="method_details first">
<h3 class="signature first" id="current_task_struct_h-instance_method">
#<strong>current_task_struct_h</strong>(metasm_exe) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/msf/core/exploit/local/linux_kernel.rb', line 7</span>
<span class='kw'>def</span> <span class='id identifier rubyid_current_task_struct_h'>current_task_struct_h</span><span class='lparen'>(</span><span class='id identifier rubyid_metasm_exe'>metasm_exe</span><span class='rparen'>)</span>
<span class='id identifier rubyid_metasm_exe'>metasm_exe</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span> <span class='heredoc_beg'>&lt;&lt;-EOS</span>
<span class='tstring_content'> current_stack_pointer:
mov eax, esp
ret
</span><span class='heredoc_end'> EOS
</span>
<span class='comment'># Taken from sock_sendpage.c
</span> <span class='id identifier rubyid_cparser'>cparser</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span> <span class='heredoc_beg'>&lt;&lt;-EOC</span>
<span class='tstring_content'>#define TASK_RUNNING 0
int current_stack_pointer(void);
static inline unsigned long
current_task_struct(void)
{
unsigned long task_struct, thread_info;
thread_info = current_stack_pointer() &amp; ~(4096 - 1);
if (*(unsigned long *)thread_info &gt;= 0xc0000000) {
task_struct = *(unsigned long *)thread_info;
/*
* The TASK_RUNNING is the only possible state for a process executing
* in user-space.
*/
if (*(unsigned long *)task_struct == TASK_RUNNING)
return task_struct;
}
/*
* Prior to the 2.6 kernel series, the task_struct was stored at the end
* of the kernel stack.
*/
task_struct = current_stack_pointer() &amp; ~(8192 - 1);
if (*(unsigned long *)task_struct == TASK_RUNNING)
return task_struct;
thread_info = task_struct;
task_struct = *(unsigned long *)thread_info;
if (*(unsigned long *)task_struct == TASK_RUNNING)
return task_struct;
return -1;
}
</span><span class='heredoc_end'>EOC
</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
</div>
<div id="footer">
Generated on Fri May 8 17:01:58 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>