563 lines
9.9 KiB
HTML
563 lines
9.9 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::Linux
|
|
|
|
— 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::Linux";
|
|
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> »
|
|
<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'><span class='object_link'><a href="../Local.html" title="Msf::Exploit::Local (class)">Local</a></span></span>
|
|
»
|
|
<span class="title">Linux</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::Linux
|
|
|
|
|
|
|
|
</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.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="#linux_x86_syscall_wrappers-instance_method" title="#linux_x86_syscall_wrappers (instance method)">#<strong>linux_x86_syscall_wrappers</strong>(metasm_exe) ⇒ 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="linux_x86_syscall_wrappers-instance_method">
|
|
|
|
#<strong>linux_x86_syscall_wrappers</strong>(metasm_exe) ⇒ <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
|
|
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
|
|
95
|
|
96
|
|
97
|
|
98
|
|
99
|
|
100
|
|
101
|
|
102
|
|
103
|
|
104
|
|
105
|
|
106
|
|
107
|
|
108
|
|
109
|
|
110
|
|
111
|
|
112
|
|
113
|
|
114
|
|
115
|
|
116
|
|
117
|
|
118
|
|
119
|
|
120
|
|
121
|
|
122
|
|
123
|
|
124
|
|
125
|
|
126
|
|
127
|
|
128
|
|
129
|
|
130
|
|
131
|
|
132
|
|
133
|
|
134
|
|
135
|
|
136
|
|
137
|
|
138
|
|
139
|
|
140
|
|
141
|
|
142
|
|
143
|
|
144
|
|
145
|
|
146
|
|
147
|
|
148
|
|
149
|
|
150
|
|
151
|
|
152
|
|
153
|
|
154
|
|
155
|
|
156
|
|
157
|
|
158
|
|
159
|
|
160
|
|
161
|
|
162
|
|
163
|
|
164
|
|
165
|
|
166
|
|
167
|
|
168
|
|
169
|
|
170
|
|
171
|
|
172
|
|
173
|
|
174
|
|
175
|
|
176
|
|
177
|
|
178
|
|
179
|
|
180
|
|
181
|
|
182
|
|
183
|
|
184
|
|
185
|
|
186
|
|
187
|
|
188
|
|
189
|
|
190
|
|
191
|
|
192
|
|
193</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File 'lib/msf/core/exploit/local/linux.rb', line 7</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_linux_x86_syscall_wrappers'>linux_x86_syscall_wrappers</span><span class='lparen'>(</span><span class='id identifier rubyid_metasm_exe'>metasm_exe</span><span class='rparen'>)</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'><<-EOC</span>
|
|
<span class='tstring_content'> #ifndef size_t
|
|
#define size_t int
|
|
#endif
|
|
#ifndef off_t
|
|
#define off_t unsigned long
|
|
#endif
|
|
|
|
#define O_CREAT 64
|
|
#define O_RDWR 2
|
|
|
|
#define MAP_PRIVATE 0x02
|
|
#define MAP_FIXED 0x10
|
|
#define MAP_ANONYMOUS 0x20
|
|
#define MAP_ANON MAP_ANONYMOUS
|
|
#define MAP_FAILED ((void *)-1)
|
|
|
|
#define PROT_READ 0x1
|
|
#define PROT_WRITE 0x2
|
|
#define PROT_EXEC 0x4
|
|
|
|
void exit(int status);
|
|
int read(int fd, void *buf, size_t count);
|
|
int write(int fd, void *buf, size_t count);
|
|
int open(const char *pathname, int flags, int mode);
|
|
int unlink(const char *pathname);
|
|
int ftruncate(int fd, off_t length);
|
|
int socket(int, int, int);
|
|
int sendfile(int in_fd, int out_fd, void *, int count);
|
|
void *__mmap2(void *addr, size_t length, int prot, int flags, int fd, off_t offset);
|
|
|
|
#ifdef DEBUGGING
|
|
void sigtrap();
|
|
#else
|
|
#define sigtrap()
|
|
#endif
|
|
void *__get_tls();
|
|
|
|
</span><span class='heredoc_end'> EOC
|
|
</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'><<-EOS</span>
|
|
<span class='tstring_content'> sigtrap:
|
|
int 3
|
|
ret
|
|
exit:
|
|
mov eax, 1 ; sys_exit
|
|
mov ebx, [esp+4]
|
|
int 0x80
|
|
ret
|
|
read:
|
|
mov eax, 3 ; sys_write
|
|
mov edx,[esp+12] ; length
|
|
mov ecx,[esp+8] ; string
|
|
mov ebx,[esp+4] ; file descriptor
|
|
int 0x80
|
|
ret
|
|
write:
|
|
mov eax, 4 ; sys_write
|
|
mov edx,[esp+12] ; length
|
|
mov ecx,[esp+8] ; string
|
|
mov ebx,[esp+4] ; file descriptor
|
|
int 0x80
|
|
ret
|
|
open:
|
|
mov eax, 5 ; sys_open
|
|
mov edx,[esp+12] ; mode
|
|
mov ecx,[esp+8] ; flags
|
|
mov ebx,[esp+4] ; file name
|
|
int 0x80
|
|
cmp eax, -129
|
|
jb 1f
|
|
neg eax
|
|
push eax
|
|
call __set_errno
|
|
add esp, 4
|
|
or eax, -1
|
|
1:
|
|
ret
|
|
ftruncate:
|
|
push ebx
|
|
push ecx
|
|
mov eax, 93 ; sys_ftruncate
|
|
mov ecx,[esp+16] ; file descriptor
|
|
mov ebx,[esp+12] ; size
|
|
int 0x80
|
|
cmp eax, -129
|
|
jb 1f
|
|
neg eax
|
|
push eax
|
|
call __set_errno
|
|
add esp, 4
|
|
or eax, -1
|
|
1:
|
|
pop ecx
|
|
pop ebx
|
|
ret
|
|
socket:
|
|
push ebx
|
|
push ecx
|
|
mov eax, 102 ; sys_socketcall
|
|
mov ebx, 1
|
|
mov ecx, esp
|
|
add ecx, 12
|
|
int 0x80
|
|
cmp eax, -129
|
|
jb 1f
|
|
neg eax
|
|
push eax
|
|
call __set_errno
|
|
add esp, 4
|
|
or eax, -1
|
|
1:
|
|
pop ecx
|
|
pop ebx
|
|
ret
|
|
sendfile:
|
|
push ebx
|
|
push ecx
|
|
push edx
|
|
push esi
|
|
|
|
mov eax, 187 ; sys_sendfile
|
|
mov esi,[esp+32] ; size
|
|
mov edx,[esp+28] ; offset
|
|
mov ecx,[esp+24] ; out_fd
|
|
mov ebx,[esp+20] ; in_fd
|
|
int 0x80
|
|
cmp eax, -129
|
|
jb 1f
|
|
neg eax
|
|
push eax
|
|
call __set_errno
|
|
add esp, 4
|
|
or eax, -1
|
|
1:
|
|
pop esi
|
|
pop edx
|
|
pop ecx
|
|
pop ebx
|
|
ret
|
|
|
|
unlink:
|
|
mov eax, 10 ; sys_unlink
|
|
mov ebx,[esp+4] ; filename
|
|
int 0x80
|
|
ret
|
|
|
|
; stolen from bionic
|
|
__mmap2:
|
|
push ebx
|
|
push ecx
|
|
push edx
|
|
push esi
|
|
push edi
|
|
push ebp
|
|
|
|
mov eax, 192
|
|
mov ebx, [esp+28]
|
|
mov ecx, [esp+32]
|
|
mov edx, [esp+36]
|
|
mov esi, [esp+40]
|
|
mov edi, [esp+44]
|
|
mov ebp, [esp+48]
|
|
int 0x80
|
|
cmp eax, -129
|
|
jb 1f
|
|
neg eax
|
|
push eax
|
|
call __set_errno
|
|
add esp, 4
|
|
or eax, -1
|
|
1:
|
|
pop ebp
|
|
pop edi
|
|
pop esi
|
|
pop edx
|
|
pop ecx
|
|
pop ebx
|
|
ret
|
|
|
|
; Thread Local Storage, used by errno
|
|
__get_tls:
|
|
mov eax, gs:[0]
|
|
ret
|
|
</span><span class='heredoc_end'> EOS
|
|
</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div id="footer">
|
|
Generated on Fri May 8 17:01:28 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> |