Nmap http-vuln-cve2015-1427 NSE Script
This page contains detailed information about how to use the http-vuln-cve2015-1427 NSE script. For list of all NSE scripts, visit the Nmap NSE Library.
Select: |
---|
Script Overview
Script source code: https://github.com/nmap/nmap/tree/master/scripts/http-vuln-cve2015-1427.nse
Script categories: vuln, intrusive
Target service / protocol: http, tcp
Target network port(s): 9200
List of CVEs: CVE-2015-1427
Script Description
The http-vuln-cve2015-1427.nse script attempts to detect a vulnerability, CVE-2015-1427, which allows attackers to leverage features of this API to gain unauthenticated remote code execution (RCE).
Elasticsearch versions 1.3.0-1.3.7 and 1.4.0-1.4.2 have a vulnerability in the Groovy scripting engine. The vulnerability allows an attacker to construct Groovy scripts that escape the sandbox and execute shell commands as the user running the Elasticsearch Java VM.
Http-vuln-cve2015-1427 NSE Script Arguments
This is a full list of arguments supported by the http-vuln-cve2015-1427.nse script:
commandEnter the shell comannd to be executed. The script outputs the Java and Elasticsearch versions by default.
invasiveIf set to true then it creates an index if there are no indices.
smbdomainThe domain to log in with. If you aren't in a domain environment, then anything will (should?) be accepted by the server.
smbhashA password hash to use when logging in. This is given as a single hex string (32 characters) or a pair of hex strings (both 32 characters, optionally separated by a single character). These hashes are the LanMan or NTLM hash of the user's password, and are stored on disk or in memory. They can be retrieved from memory using the fgdump or pwdump tools.
smbnoguestUse to disable usage of the 'guest' account.
smbpasswordThe password to connect with. Be cautious with this, since some servers will lock accounts if the incorrect password is given. Although it's rare that the Administrator account can be locked out, in the off chance that it can, you could get yourself in trouble. To use a blank password, leave this parameter off altogether.
smbtypeThe type of SMB authentication to use. These are the possible options:
v1
: Sends LMv1 and NTLMv1.LMv1
: Sends LMv1 only.NTLMv1
: Sends NTLMv1 only (default).v2
: Sends LMv2 and NTLMv2.LMv2
: Sends LMv2 only.NTLMv2
: Doesn't exist; the protocol doesn't support NTLMv2 alone. The default,NTLMv1
, is a pretty decent compromise between security and compatibility. If you are paranoid, you might want to usev2
orlmv2
for this. (Actually, if you're paranoid, you should be avoiding this protocol altogether!). If you're using an extremely old system, you might need to set this tov1
orlm
, which are less secure but more compatible. For information, seesmbauth.lua
.
The SMB username to log in with. The forms "DOMAIN\username" and "username@DOMAIN" are not understood. To set a domain, use the smbdomain
argument.
Debug level at which default callbacks will print detailed parsing info. Default: 3
http.host
The value to use in the Host header of all requests unless otherwise set. By default, the Host header uses the output of stdnse.get_hostname()
.
Limit the received body to specific number of bytes. An oversized body results in an error unless script argument http.truncated-ok
or request option truncated_ok
is set to true. The default is 2097152 (2MB). Use value -1 to disable the limit altogether. This argument can be overridden case-by-case with request option max_body_size
.
The maximum memory size (in bytes) of the cache.
http.max-pipeline
If set, it represents the number of outstanding HTTP requests that should be sent together in a single burst. Defaults to http.pipeline
(if set), or to what function get_pipeline_limit
returns.
If set, it represents the number of HTTP requests that'll be sent on one connection. This can be set low to make debugging easier, or it can be set high to test how a server reacts (its chosen max is ignored).
http.truncated-ok
Do not treat oversized body as error. (Use response object flag truncated
to check if the returned body has been truncated.) This argument can be overridden case-by-case with request option truncated_ok
.
The value of the User-Agent header field sent with requests. By default it is "Mozilla/5.0 (compatible; Nmap Scripting Engine; https://nmap.org/book/nse.html)"
. A value of the empty string disables sending the User-Agent header field.
If set, vulnerabilities will be output in short format, a single line consisting of the host's target name or IP, the state, and either the CVE ID or the title of the vulnerability. Does not affect XML output.
vulns.showall
If set, the library will show and report all the registered vulnerabilities which includes the NOT VULNERABLE
ones. By default the library will only report the VULNERABLE
entries: VULNERABLE
, LIKELY VULNERABLE
, VULNERABLE (DoS)
and VULNERABLE (Exploitable)
. This argument affects the following functions: vulns.Report.make_output(): the default output function for portule/hostrule scripts. vulns.make_output(): the default output function for postrule scripts. vulns.format_vuln() and vulns.format_vuln_table() functions.
- - -
To use these script arguments, add them to the Nmap command line using the --script-args arg1=value,[arg2=value,..]
syntax. For example:
nmap --script=http-vuln-cve2015-1427 --script-args command=value,invasive=value <target>
Http-vuln-cve2015-1427 NSE Script Example Usage
Here's an example of how to use the http-vuln-cve2015-1427.nse script:
nmap --script=http-vuln-cve2015-1427 --script-args command= 'ls' <targets>
Http-vuln-cve2015-1427 NSE Script Example Output
Here's a sample output from the http-vuln-cve2015-1427.nse script:
| http-vuln-cve2015-1427:
| VULNERABLE:
| ElasticSearch CVE-2015-1427 RCE Exploit
| State: VULNERABLE (Exploitable)
| IDs: CVE:CVE-2015-1427
| Risk factor: High CVSS2: 7.5
| The vulnerability allows an attacker to construct Groovy
| scripts that escape the sandbox and execute shell commands as the user
| running the Elasticsearch Java VM.
| Exploit results:
| ElasticSearch version: 1.3.7
| Java version: 1.8.0_45
| References:
| http://carnal0wnage.attackresearch.com/2015/03/elasticsearch-cve-2015-1427-rce-exploit.html
| https://jordan-wright.github.io/blog/2015/03/08/elasticsearch-rce-vulnerability-cve-2015-1427/
| https://github.com/elastic/elasticsearch/issues/9655
|_ https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2015-1427
Http-vuln-cve2015-1427 NSE Script Example XML Output
There is no sample XML output for this module. However, by providing the -oX <file>
option, Nmap will produce a XML output and save it in the file.xml
file.
Authors
- Gyanendra Mishra
- Daniel Miller
References
- https://nmap.org/nsedoc/scripts/http-vuln-cve2015-1427.html
- https://github.com/nmap/nmap/tree/master/scripts/http-vuln-cve2015-1427.nse
- http://carnal0wnage.attackresearch.com/2015/03/elasticsearch-cve-2015-1427-rce-exploit.html
- https://jordan-wright.github.io/blog/2015/03/08/elasticsearch-rce-vulnerability-cve-2015-1427/
- https://github.com/elastic/elasticsearch/issues/9655
- https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2015-1427
See Also
Related NSE scripts to the http-vuln-cve2015-1427.nse script:
- http-vuln-cve2006-3392.nse
- http-vuln-cve2009-3960.nse
- http-vuln-cve2010-0738.nse
- http-vuln-cve2010-2861.nse
- http-vuln-cve2011-3192.nse
- http-vuln-cve2011-3368.nse
- http-vuln-cve2012-1823.nse
- http-vuln-cve2013-0156.nse
- http-vuln-cve2013-6786.nse
- http-vuln-cve2013-7091.nse
- http-vuln-cve2014-2126.nse
- http-vuln-cve2014-2127.nse
- http-vuln-cve2014-2128.nse
- http-vuln-cve2014-2129.nse
- http-vuln-cve2014-3704.nse
- http-vuln-cve2014-8877.nse
- http-vuln-cve2015-1635.nse
- http-vuln-cve2017-1001000.nse
- http-vuln-cve2017-5638.nse
- http-vuln-cve2017-5689.nse
- http-vuln-cve2017-8917.nse
- http-vuln-misfortune-cookie.nse
- http-vuln-wnr1000-creds.nse
Visit Nmap NSE Library for more scripts.
The http-vuln-cve2015-1427.nse script may fail with the following error messages. Check for the possible causes by using the code snippets highlighted below found in the script source code. This can often times help in identifying the root cause of the problem.
Parsing JSON failed(version checking). Probably not running Elasticsearch
Here is a relevant code snippet related to the "Parsing JSON failed(version checking). Probably not running Elasticsearch" error message:
124: --lets check the elastic search version.
125: local response = http.get(host, port, '/')
126: if response.status == 200 and response.body then
127: local status, parsed = json.parse(response.body)
128: if not(status) then
129: stdnse.debug1('Parsing JSON failed(version checking). Probably not running Elasticsearch')
130: return nil
131: else
132: if parsed.version.number then
133: --check if a vulnerable version is running
134: if (tostring(parsed.version.number):find('1.3.[0-7]') or tostring(parsed.version.number):find('1.4.[0-2]')) then
Could not delete index created by invasive script-arg
Here is a relevant code snippet related to the "Could not delete index created by invasive script-arg" error message:
163: if invasive then
164: local rand = rand.random_alpha(8)
165: cleanup = function()
166: local r = http.generic_request(host, port, "DELETE", ("/%s"):format(rand))
167: if r.status ~= 200 or not r.body:match('"acknowledged":true') then
168: stdnse.debug1( "Could not delete index created by invasive script-arg")
169: end
170: end
171: local data = { [rand] = rand }
172: stdnse.debug1("Creating Index. 5 seconds wait.")
173: response = http.put(host,port,('%s/%s/1'):format(rand, rand),nil,json.generate(data))
Didnt have any index. Creating index failed.
Here is a relevant code snippet related to the "Didnt have any index. Creating index failed." error message:
170: end
171: local data = { [rand] = rand }
172: stdnse.debug1("Creating Index. 5 seconds wait.")
173: response = http.put(host,port,('%s/%s/1'):format(rand, rand),nil,json.generate(data))
174: if not(response.status == 201) then
175: stdnse.debug1( "Didnt have any index. Creating index failed.")
176: return report:make_output(vuln_table)
177: end
178: stdnse.sleep(5) -- search will not return results immediately
179: else
180: stdnse.debug1("Not Indexed. Try the invasive option ;)")
Version
This page has been created based on Nmap version 7.92.
Go back to menu.