Ruby on Rails JSON Processor YAML Deserialization Scanner - Metasploit
This page contains detailed information about how to use the auxiliary/scanner/http/rails_json_yaml_scanner metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.
Module Overview
Name: Ruby on Rails JSON Processor YAML Deserialization Scanner
Module: auxiliary/scanner/http/rails_json_yaml_scanner
Source code: modules/auxiliary/scanner/http/rails_json_yaml_scanner.rb
Disclosure date: -
Last modification time: 2017-07-24 06:26:21 +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-2013-0156, CVE-2013-0333
This module attempts to identify Ruby on Rails instances vulnerable to an arbitrary object instantiation flaw in the JSON request processor.
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/rails_json_yaml_scanner
msf auxiliary(rails_json_yaml_scanner) > show options
... show and set options ...
msf auxiliary(rails_json_yaml_scanner) > set RHOSTS ip-range
msf auxiliary(rails_json_yaml_scanner) > exploit
Other examples of setting the RHOSTS option:
Example 1:
msf auxiliary(rails_json_yaml_scanner) > set RHOSTS 192.168.1.3-192.168.1.200
Example 2:
msf auxiliary(rails_json_yaml_scanner) > set RHOSTS 192.168.1.1/24
Example 3:
msf auxiliary(rails_json_yaml_scanner) > set RHOSTS file:/tmp/ip_list.txt
Required Options
- RHOSTS: The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
Go back to menu.
Msfconsole Usage
Here is how the scanner/http/rails_json_yaml_scanner auxiliary module looks in the msfconsole:
msf6 > use auxiliary/scanner/http/rails_json_yaml_scanner
msf6 auxiliary(scanner/http/rails_json_yaml_scanner) > show info
Name: Ruby on Rails JSON Processor YAML Deserialization Scanner
Module: auxiliary/scanner/http/rails_json_yaml_scanner
License: Metasploit Framework License (BSD)
Rank: Normal
Provided by:
jjarmoc
hdm <[email protected]>
Check supported:
No
Basic options:
Name Current Setting Required Description
---- --------------- -------- -----------
HTTP_METHOD POST yes HTTP Method (Accepted: GET, POST, PUT)
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
TARGETURI / yes The URI to test
THREADS 1 yes The number of concurrent threads (max one per host)
VHOST no HTTP server virtual host
Description:
This module attempts to identify Ruby on Rails instances vulnerable
to an arbitrary object instantiation flaw in the JSON request
processor.
References:
https://nvd.nist.gov/vuln/detail/CVE-2013-0333
Module Options
This is a complete list of options available in the scanner/http/rails_json_yaml_scanner auxiliary module:
msf6 auxiliary(scanner/http/rails_json_yaml_scanner) > show options
Module options (auxiliary/scanner/http/rails_json_yaml_scanner):
Name Current Setting Required Description
---- --------------- -------- -----------
HTTP_METHOD POST yes HTTP Method (Accepted: GET, POST, PUT)
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
TARGETURI / yes The URI to test
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/rails_json_yaml_scanner auxiliary module:
msf6 auxiliary(scanner/http/rails_json_yaml_scanner) > show advanced
Module advanced options (auxiliary/scanner/http/rails_json_yaml_scanner):
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/rails_json_yaml_scanner module can do:
msf6 auxiliary(scanner/http/rails_json_yaml_scanner) > show actions
Auxiliary actions:
Name Description
---- -----------
Evasion Options
Here is the full list of possible evasion options supported by the scanner/http/rails_json_yaml_scanner auxiliary module in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):
msf6 auxiliary(scanner/http/rails_json_yaml_scanner) > 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:
- <RHOST>:<RPORT> No reply to the initial JSON request
- <RHOST>:<RPORT> The server replied with <RES1.CODE> for our initial JSON request, double check TARGETURI and HTTP_METHOD
- <RHOST>:<RPORT> No reply to the initial YAML probe
- <RHOST>:<RPORT> No reply to the second YAML probe
- <RHOST>:<RPORT> is not likely to be vulnerable or TARGETURI & HTTP_METHOD must be set
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.
<RHOST>:<RPORT> No reply to the initial JSON request
Here is a relevant code snippet related to the "<RHOST>:<RPORT> No reply to the initial JSON request" error message:
47: res1 = send_probe(
48: "{ \"#{Rex::Text.rand_text_alpha(rand(8)+1)}\" : \"#{Rex::Text.rand_text_alpha(rand(8)+1)}\" }"
49: )
50:
51: unless res1
52: vprint_status("#{rhost}:#{rport} No reply to the initial JSON request")
53: return
54: end
55:
56: if res1.code.to_s =~ /^[5]/
57: vprint_error("#{rhost}:#{rport} The server replied with #{res1.code} for our initial JSON request, double check TARGETURI and HTTP_METHOD")
<RHOST>:<RPORT> The server replied with <RES1.CODE> for our initial JSON request, double check TARGETURI and HTTP_METHOD
Here is a relevant code snippet related to the "<RHOST>:<RPORT> The server replied with <RES1.CODE> for our initial JSON request, double check TARGETURI and HTTP_METHOD" error message:
52: vprint_status("#{rhost}:#{rport} No reply to the initial JSON request")
53: return
54: end
55:
56: if res1.code.to_s =~ /^[5]/
57: vprint_error("#{rhost}:#{rport} The server replied with #{res1.code} for our initial JSON request, double check TARGETURI and HTTP_METHOD")
58: return
59: end
60:
61: # Deserialize a hash, this should work if YAML deserializes.
62: res2 = send_probe("--- {}\n".gsub(':', '\u003a'))
<RHOST>:<RPORT> No reply to the initial YAML probe
Here is a relevant code snippet related to the "<RHOST>:<RPORT> No reply to the initial YAML probe" error message:
60:
61: # Deserialize a hash, this should work if YAML deserializes.
62: res2 = send_probe("--- {}\n".gsub(':', '\u003a'))
63:
64: unless res2
65: vprint_status("#{rhost}:#{rport} No reply to the initial YAML probe")
66: return
67: end
68:
69: # Deserialize a malformed object, inducing an error.
70: res3 = send_probe("--- !ruby/object:\x00".gsub(':', '\u003a'))
<RHOST>:<RPORT> No reply to the second YAML probe
Here is a relevant code snippet related to the "<RHOST>:<RPORT> No reply to the second YAML probe" error message:
68:
69: # Deserialize a malformed object, inducing an error.
70: res3 = send_probe("--- !ruby/object:\x00".gsub(':', '\u003a'))
71:
72: unless res3
73: vprint_status("#{rhost}:#{rport} No reply to the second YAML probe")
74: return
75: end
76:
77: vprint_status("Probe response codes: #{res1.code} / #{res2.code} / #{res3.code}")
78:
<RHOST>:<RPORT> is not likely to be vulnerable or TARGETURI & HTTP_METHOD must be set
Here is a relevant code snippet related to the "<RHOST>:<RPORT> is not likely to be vulnerable or TARGETURI & HTTP_METHOD must be set" error message:
85: :proto => 'tcp',
86: :name => self.name,
87: :info => "Module triggered a #{res3.code} reply",
88: :refs => self.references
89: })
90: else
91: # Otherwise we're not likely vulnerable.
92: vprint_status("#{rhost}:#{rport} is not likely to be vulnerable or TARGETURI & HTTP_METHOD must be set")
93: end
94: end
95: end
Go back to menu.
Related Pull Requests
- #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
- #3459 Merged Pull Request: Add newline at EOF
- #2525 Merged Pull Request: Change module boilerplate
- #1480 Merged Pull Request: New module for Rails JSON/YAML vuln CVE-2013-0333
References
See Also
Check also the following modules related to this module:
- exploit/multi/http/rails_json_yaml_code_exec
- exploit/multi/http/rails_secret_deserialization
- exploit/multi/http/rails_xml_yaml_code_exec
- auxiliary/scanner/http/rails_xml_yaml_scanner
- auxiliary/scanner/http/rails_mass_assignment
- auxiliary/admin/http/rails_devise_pass_reset
- auxiliary/dos/http/rails_action_view
- auxiliary/dos/http/rails_json_float_dos
- auxiliary/gather/rails_doubletap_file_read
- exploit/multi/http/rails_actionpack_inline_exec
- exploit/multi/http/rails_double_tap
- exploit/multi/http/rails_dynamic_render_code_exec
- exploit/multi/http/rails_web_console_v2_code_exec
- auxiliary/gather/flash_rosetta_jsonp_url_disclosure
- exploit/multi/fileformat/nodejs_js_yaml_load_code_exec
- exploit/unix/webapp/squash_yaml_exec
Related Nessus plugins:
- FreeBSD : rubygem-rails -- multiple vulnerabilities (ca5d3272-59e3-11e2-853b-00262d5ed8ee)
- Debian DSA-2604-1 : rails - insufficient input validation
- Fedora 18 : rubygem-actionpack-3.2.8-2.fc18 / rubygem-activerecord-3.2.8-3.fc18 / etc (2013-0568)
- Fedora 17 : rubygem-actionpack-3.0.11-8.fc17 / rubygem-activemodel-3.0.11-2.fc17 / etc (2013-0635)
- Fedora 16 : rubygem-actionpack-3.0.10-10.fc16 / rubygem-activemodel-3.0.10-2.fc16 / etc (2013-0686)
- RHEL 6 : Ruby on Rails in Subscription Asset Manager (RHSA-2013:0154)
- RHEL 6 : rubygem-activesupport in Subscription Asset Manager (RHSA-2013:0201)
- Debian DSA-2613-1 : rails - insufficient input validation
- Mac OS X : OS X Server < 2.2.1 Multiple Vulnerabilities
- Fedora 17 : rubygem-activesupport-3.0.11-8.fc17 (2013-1710)
Authors
- jjarmoc
- hdm
Version
This page has been produced using Metasploit Framework version 6.1.29-dev. For more modules, visit the Metasploit Module Library.
Go back to menu.