# frozen_string_literal: true ## # This file is part of WhatWeb and may be subject to # redistribution and commercial restrictions. Please see the WhatWeb # web site for more information on licensing and terms of use. # http://www.morningstarsecurity.com/research/whatweb ## # Version 0.5 # 2013-03-29 # # Due to a renewed web interface (v3.8), all existing matches didn't see the QNAP anymore # New matches need to be determined # Version 0.4 # 2011-03-22 # # Removed aggressive section ## # Version 0.3 # # Added aggressive model, firmware and module extraction from /cgi-bin/authLogin.cgi ## # Version 0.2 # # Added passive model, firmware and module extraction support for /cgi-bin/authLogin.cgi ## WhatWeb::Plugin.define "QNAP-NAS" do @author = "Brendan Coles " # 2013-03-29 @version = "0.5" @description = "QNAP provides a series of network attached storage (NAS) products and network video recorder (NVR) solutions - homepage:http://www.qnap.com/" # Tested on TS Models: # TS-109 PRO, TS-109 PRO II, TS-119, TS-209 PRO, TS-209 PRO II, # TS-219, TS-239, TS-259, TS-409, TS-410U, TS-419P, TS-509, TS-559, TS-639 # Google results as at 2011-03-22 # # 229 for inurl:Qmultimedia/cgi-bin/thumb_index.cgi # Dorks # @dorks = [ 'inurl:Qmultimedia/cgi-bin/thumb_index.cgi', 'inurl:/cgi-bin/authLogin.cgi' ] # Matches # @matches = [ # Multimedia Station # URL pattern { ghdb: 'inurl:"Qmultimedia/cgi-bin/thumb_index.cgi" filetype:cgi', module: "Multimedia Station" }, # Photo Station module # Default title { text: "QNAP Photo Station", module: "Photo Station" }, # Download Station module # Default title { text: "QNAP Download Station", module: "Download Station" }, # Qmultimedia module # Default title { text: "QNAP Multimedia Station (Photo Album)", module: "Multimedia Station" }, # Qmultimedia module # Default title { text: "Multimedia Station", module: "Multimedia Station", certainty: 75 }, # Login page # Default JavaScript { certainty: 75, text: 'NavPage("http://"+ location_hostname_for_ipv6(location.hostname) +":"+ qweb_port +"/", 0);' }, # Index redirect page # Default JavaScript { certainty: 75, text: 'location.href=pr+"://["+location.hostname+"]"+pt+redirect_suffix;' }, { regexp: /^\/\/window.location = '\/indexnas\.cgi\?counter=' \+ Math\.floor\(\(diff1-diff2\)\/1000\);[\r\n]^window.location.replace\('\/indexnas\.cgi\?counter=' \+ Math\.floor\(\(diff1-diff2\)\/1000\)\);$/ }, # Login page # Default logo HTML { text: '' }, # QNAP NAS # Not TS Series # Default table HTML { text: '', model: "Unknown Model (not TS Series)" }, # Login page # /cgi-bin/html/login.html # Extract modules { text: 'Web Server', module: "QWeb Server" }, { text: 'Multimedia Station', module: "Multimedia Station" }, { text: 'Download Station', module: "Download Station" }, { text: 'Web File Manager', module: "Web File Manager" }, { text: 'Surveillance Station', module: "Surveillance Station" }, # ----- 3.8 version ----- # HTML title { text: 'Welcome to QNAP Turbo NAS' }, # favicon.ico { url: "/ajax_obj/images/favicon.ico", md5: "9afa5d60e5ef15dc75d7662e418cac72" }, ] # Passive # def passive(target) m = [] # /cgi-bin/authLogin.cgi # Check document is QNAP XML if (target.uri.path == "/cgi-bin/authLogin.cgi") && target.body =~ /^$/ # Firmware Version Detection m << { firmware: target.body.scan(/()?<\/version>/)[0][1] + " build " + target.body.scan(/()?<\/build>/)[0][1] } if target.body =~ /()?<\/version>/ && target.body =~ /()?<\/build>/ # Model Detection m << { model: target.body.scan(/()?<\/internalModelName>/)[0][1] } if target.body =~ /()?<\/internalModelName>/ # Module Detection m << { module: "WebFS" } if target.body =~ /()?<\/webFSEnabled>/ m << { module: "Multimedia Station" } if target.body =~ /()?<\/QMultimediaEnabled>/ m << { module: "MSV2" } if target.body =~ /()?<\/MSV2Supported>/ m << { module: "MSV2 Web" } if target.body =~ /()?<\/MSV2WebEnabled>/ m << { module: "Download Station" } if target.body =~ /()?<\/QDownloadEnabled>/ m << { module: "QWeb Server" } if target.body =~ /()?<\/QWebEnabled>/ m << { module: "Qweb Server SSL" } if target.body =~ /()?<\/QWebSSLEnabled>/ m << { module: "NVR" } if target.body =~ /()?<\/NVREnabled>/ m << { module: "Web File Manager 2" } if target.body =~ /()?<\/WFM2>/ end # ----- 3.8 version ----- # Firmware Version Detection if /var URL_RANDOM_NUM = "[0-9\.]+";/.match?(target.body) f = target.body.scan(/var URL_RANDOM_NUM = "([0-9\.]+)";/)[0] m << { name: "javascript variable", firmware: f } end # Return passive matches m end end