Module: Msf::Exploit::Remote::TNS

Includes:
Tcp
Defined in:
lib/msf/core/exploit/tns.rb

Overview

This module exposes methods for querying a remote TNS service

Instance Method Summary collapse

Methods included from Tcp

#chost, #cleanup, #connect, #connect_timeout, #cport, #disconnect, #handler, #lhost, #lport, #proxies, #rhost, #rport, #set_tcp_evasions, #ssl, #ssl_version

Instance Method Details

#initialize(info = {}) ⇒ Object

Creates an instance of a TNS exploit module.


18
19
20
21
22
23
24
25
26
27
# File 'lib/msf/core/exploit/tns.rb', line 18

def initialize(info = {})
  super

  # Register the options that all TNS exploits may make use of.
  register_options(
    [
      Opt::RHOST,
      Opt::RPORT(1521),
    ], Msf::Exploit::Remote::TNS)
end

#tns_packet(connect_data) ⇒ Object


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
# File 'lib/msf/core/exploit/tns.rb', line 29

def tns_packet(connect_data)

  packet_length = [58 + connect_data.length].pack('n')

  # Packet length
  pkt =  packet_length
  # Checksum
  pkt << "\x00\x00"
  # Packet Type: Connect(1)
  pkt << "\x01"
  # Reserved
  pkt << "\x00"
  # Header Checksum
  pkt << "\x00\x00"
  # Version
  pkt << "\x01\x36"
  # Version (Compatible)
  pkt << "\x01\x2C"
  pkt << "\x00\x00\x08\x00"
  pkt << "\x7F\xFF"
  pkt << "\x7F\x08"
  pkt << "\x00\x00"
  pkt << "\x00\x01"
  pkt << [connect_data.length].pack('n')
  pkt << "\x00\x3A"
  pkt << "\x00\x00\x00\x00"
  pkt << "\x00\x00\x00\x00"
  pkt << "\x00"
  pkt << "\x00"
  pkt << "\x00\x00\x00\x00"
  # Unique Connection ID
  pkt << "\x00\x00\x34\xE6\x00\x00\x00\x01"
  # Connect Data
  pkt << "\x00\x00\x00\x00\x00\x00\x00\x00"
  pkt << connect_data

  return pkt

end

#tns_packet10g(connect_data) ⇒ Object


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
96
97
98
99
100
101
# File 'lib/msf/core/exploit/tns.rb', line 69

def tns_packet10g(connect_data)

  packet_length = [58 + connect_data.length].pack('n')

  # Packet length
  pkt =  packet_length
  # Checksum
  pkt << "\x00\x00"
  # Packet Type: Connect(1)
  pkt << "\x01"
  # Reserved
  pkt << "\x00"
  # Header Checksum
  pkt << "\x00\x00"
  # Version
  pkt << "\x01\x39"
  # Version (Compatible)
  pkt << "\x01\x2C"
  pkt << "\x00\x81\x08\x00"
  pkt << "\x7F\xFF"
  pkt << "\x7F\x08"
  pkt << "\x00\x00"
  pkt << "\x00\x01"
  pkt << [connect_data.length].pack('n')
  pkt << "\x00\x3A"
  pkt << "\x00\x00\x07\xf8"
  pkt << "\x0c\x0c\x00\x00"
  pkt << "\x00" * 22
  pkt << connect_data

  return pkt

end